Open In App

Difference between Priority Scheduling and Round Robin (RR) CPU scheduling

Last Updated : 21 Feb, 2023
Improve
Improve
Like Article
Like
Save
Share
Report

1. Priority Scheduling Algorithm : Priority scheduling algorithm executes the processes depending upon their priority. Each process is allocated a priority and the process with the highest priority is executed first. Priorities can be defined internally as well as externally. Internal priorities are decided by the system depending upon the number of resources required, time needed etc. whereas external priorities are based upon the time in which the work is needed or the amount being paid for the work done or the importance of process. Priority scheduling can be preemptive or non- preemptive. 

Note –

  • If two processes have the same priority then tie is broken using FCFS.
  • The waiting time for the highest priority process is always zero in preemptive mode while it may not be zero in case of non preemptive mode.

Disadvantages: The major problem is the starvation or indefinite blocking. It may so happen that in stream of processes, the system keeps executing the high priority processes and the low priority processes never get executed. 

2. Round-Robin (RR) : Round-Robin (RR) Scheduling Algorithm is particularly designed for time sharing systems. The processes are put into the ready queue which is a circular queue in this case. In this case a small unit of time known as time quantum is defined. The algorithm selects the first process from the queue and executes it for the time defined by the time quantum. If the process has burst time less than the time quantum then the CPU executes the next process but if it has burst time higher than the time quantum then the process is interrupted and next process is executed for same time quantum. If a process is interrupted then a context switch happens and the process is put back at the tail of the queue. It is preemptive in nature. This algorithm mainly depends on the time quantum. Very large time quantum makes RR same as the FCFS while a very small time quantum will lead to the overhead as context switch will happen again and again after very small intervals. The major advantage of this algorithm is that all processes get executed one after the other which does not lead to starvation of processes or waiting by process for quite long time to get executed. 

Disadvantages : Quantum size: The quantum size must be carefully chosen, a larger quantum size leads to longer waiting times for smaller processes, while a smaller quantum size results in increased overhead.
The difference between Priority Scheduling and Round-Robin (RR) scheduling algorithm are as follows:

Priority Scheduling Round-Robin (RR)
Priority Scheduling executes the processes according to the priority i.e. process with higher priority is executed first. Round-Robin (RR) executes the processes based upon the time quantum defined i.e. each process is executed for a fixed amount of time.
Priority Scheduling is both preemptive and non-preemptive in nature. Round-Robin (RR) is preemptive in nature.
The average waiting time and average response time is unknown beforehand. The average waiting time for given set of processes is quite small and depends on the time quantum.
It is easy to implement and best suited for real time operating systems. It is quite easy to implement RR in any system.
The problem of blocking of a process can be solved using aging. Each process is executed and every user feels that his work is being done as the CPU gives equal amount of time to each process.

Like Article
Suggest improvement
Share your thoughts in the comments

Similar Reads