Priority Based Scheduling Algorithm

Priority Based Scheduling Algorithm

Priority Based Scheduling Algorithm

It is a Priority based scheduling algorithm of an operating system.

  • In the Priority based scheduling algorithm, Priority is assigned for each process.
  • It is an integer number.
  • It can be Preemptive or Non-Preemptive.
  • A process with the highest priority is executed first and so on.
  • Same Priority Can be broken with FCFS Algorithm.
  • No Importance of Arrival Time and Burst Time.
Process Arrival Time Burst Time Priority
P0 0 5 1
P1 1 3 2
P2 2 8 1
P3 3 6 3

Priority Based Scheduling Algorithm Preemptive

  • Only one process is arriving at 0 time P0. so, we have to do the execution of process P0 for 1 unit time.
  • After that First process is getting the executes the process p1 has arrived and the priority of P1 is higher than P0. So, process P1 getting the execution.
  • After that, process P2 arrives. but the priority of process P2 is less than the P1. so P1 again gets an execution.
  • Similarly, All the processes execute likewise.

Gantt Chart

priority preemptive

Process Arrival Time Burst Time Priority Completion Time Turn around Time Waiting Time
P0 0 5 1 14 14 9
P1 1 3 2 10 9 6
P2 2 8 1 22 10 2
P3 3 6 3 9 6 0

Priority Based Scheduling Algorithm Non-Preemptive:

  • Only one process is arriving at 0 time, we have to do execution of process P0.
  • After the completion of process P0. All the processes have arrived.
  • but the priority of Process is P3. so that, process P3 gets the execution first.
  • Likewise, all the processes get the execution.

Gantt Chart

priority non preemptive

Process Arrival Time Burst Time Priority Completion Time Turn around Time Waiting Time
P0 0 5 1 5 5 0
P1 1 3 2 14 13 10
P2 2 8 1 12 20 12
P3 3 6 3 11 8 2


  • Starvation – low priority processes may never execute.
  • In Priority-Based Scheduling Algorithm the chances of indefinite blocking and starvation.
  • When CPU runs on other process It blocked Priority Scheduling when it is ready to run.


  • Aging – increasing the priority of those process that has been waiting long because of low priority after some specified amount of time.

Also Check –> Round Robbin Scheduling Algorithm. 

Implementation of Priority algorithm in C language


int main()
int p[30],pr[30],key,loc,bt[30],temp,max,wt[30],ta[30],sum=0,i,j,n;
printf("enter the number of processes=");
printf("enter the burst time for each process");
printf("priority of p%d=",i+1);
{ max=i;
if(pr[j] <pr[max])
{ wt[i+1]=bt[i]+wt[i];
printf("\n waiting time for p[%d]=%d",p[i],wt[i]);
printf("\t turn around time for p[%d]=%d",p[i],ta[i]);
printf("\n\n average turn around=%d",sum/n);
return 1;

Aging Technique with Priority based scheduling algorithm

This technique generally used to prevent the starvation of any process. If we increasing priority that considers low-priority based on the waiting time. (Aging technique)

For example if we decide the aging factor 0.4 and we decide the priority 30 (whichever is low priority) It added into the queue, the next day the priority increase to the 29.6 and so on.


If you have any comments or query then don’t hesitate to ask us. Just comment below or contact us via social media pages.

To learn more concept about Priority go to

For Android projects goto the ANDROID

Stay Connect with our app

For Assignment Questions and Explanation of a theory topic visit


Note for Visitors

Here easy engineering provides materials related to exams online by this blog. The main aim of the blog is to provide materials that are not able to buy books from the market. If you like our service then please kindly share it with your university students and other students who are not able to buy books.


this copy of books is not for sale.

Declaimers provides material by collecting from different websites, so we are not the original publishers of books or materials. we are publishers of contents or posts which can help to your carrier. for any quarries contact us on I hope you like this education blog and we are ready to help those students who really deserve to learn but they can’t afford the money.

Join our telegram group for daily updates of websites

Join our Facebook page for more details and daily updates

About easyengineering 37 Articles provides you to all subject and exam related materials online like GPSC, UPSC, IES, GATE, etc. As well as we provide daily job notification, some life-related books and other online courses which are useful too in your study.


  1. I’m really enjoying the design and layout of your website.
    It’s a very easy on the eyes which makes it much more pleasant for me to come here and visit more often. Did you hire
    out a developer to create your theme? Outstanding work!

Leave a Reply

Your email address will not be published.