Skip to content
Related Articles

Related Articles

Fixed-priority pre-emptive scheduling

View Discussion
Improve Article
Save Article
  • Last Updated : 16 Apr, 2020
View Discussion
Improve Article
Save Article

Prerequisite – CPU Scheduling in Operating Systems
Fixed priority pre-emptive scheduling algorithm is mostly used in real time systems.
In this scheduling algorithm the processor make sure that the highest priority task is to be performed first ignoring the other task to be executed.

The process having highest priority is served first.

Decision Mode:
Pre-emptive: When a process arrives its priority is compared with the current process’s priority.If the new job have higher priority then the current process, the current process is suspended and new process is started.

Sorted FIFO queue is used for this strategy. As the new process is identified it is placed in the queue according to it’s priority.Hence the process having higher priority is considered first as it is placed at higher position.

Let us take the following example having 4 set of processes along with its arrival time and time taken to complete the process.Also the priority of all the process are mentioned.Consider all time values in millisecond and small value of priority means higher priority of process.

ProcessArrival Time(T0)Time Required for Completion(T`)Priority

Gantt chart:

Initially only P0 is present and it is allowed to run.But when P1 comes, it has higher priority.So, P0 is pre-empted and P1 is allowed to run.This process repeated till all processes complete their execution.

Statistic :

ProcessArrival Time(T0)Completion time(T`)Finish Time(T1)TurnAround time(TAT=T1-T0)Waiting time(TAT-T`)

Average Turnaround time:

= (22+12+2+4) / 4    
= 40 / 4
= 10 ms 

Average Waiting time:

= (12+6+0+0) / 4    
= 18 / 4
= 4.5 ms 

Priority is considered.Critical process can get even better response.

Starvation is possible for low priority process.It can be overcome by using technique called “Aging“. Aging gradually increases the priority of the process that wait in the system for long time. Context switch overhead is there.

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!