# Round Robin Process Scheduling algorithm in operating systems

By Prof. Fazal Rehman Shamil

This tutorial covers the concepts of Round Robin Scheduling.

Round Robin Scheduling is the preemptive scheduling algorithm.

We assign a fixed time to all processes for execution, this time is called time quantum.

All processes can execute only until their time quantum and then leave the CPU and give a chance to other processes to complete their execution according to time quantum.

Context switching mechanisms store the states of preempted processes.

The formula of Round robin Turn Around Time = Completion Time – Arrival Time
The formula of Round robin Waiting Time(W.T): Time Difference between the turnaround and the burst time.
The formula of Round robin Waiting Time = Turn Around Time – Burst Time

## Examples of Round-robin scheduling

Let’s see a round-robin scheduling example with arrival time, burst time, waiting time, and time quantum.

Time quantum = 2

Animation and Video of Round Robin Scheduling   There are many advantages of Round-robin Scheduling. Some of the advantages are mentioned below;

1. Round-robin Scheduling avoids starvation or convoy effect.
2. In Round-robin Scheduling , all the jobs get a fair and efficient allocation of CPU.
3. Round-robin Scheduling don’t care about priority of the processes.
4. Round-robin Scheduling gives the best performance in terms of average response time.
5. We can assume the worst case response time for the process, If we know the total number of processes on the running queue.
6. Round-robin Scheduling is easily implementable on the system because it does not depend upon burst time.
7. Round-robin Scheduling promotes Context switching to save the states of the preempted processes.

1. There are many disadvantages of Round-robin Scheduling. Some of the disadvantages are mentioned below;
2. Round-robin Scheduling utilize more time on context switching which is not good in some cases.
3. The processor output will be reduced in Round-robin Scheduling, If slicing time of OS is low.
4. If the time quantum is low, then it increases the context switching time in Round-robin Scheduling .
5. Round-robin Scheduling can leads to decreases the comprehension
6. In Round-robin Scheduling , it’s a difficult task to decide a correct time quantum to increase the efficiency and speed.
7. In Round-robin Scheduling , We can’t set priorities for the processes.
8. Performance of Round-robin Scheduling heavily depends on time quantum given to the processes.

## Round robin scheduling program in C++

Output ## Round Robin Implementation in Java

Let us see the Round Robin Implementation in Java. Prof.Fazal Rehman Shamil (Available for Professional Discussions)
1. Message on Facebook page for discussions,