Site icon DataFlair

Round Robin Scheduling Algorithm

Round Robin scheduling algorithm

FREE Online Courses: Click for Success, Learn for Free - Start Now!

This algorithm works on the principle of round-robin, where an equal share of an object is given to each person in turns. Mostly used for multitasking, this is the oldest and simplest scheduling algorithm that offers starvation-free execution. Each ready task has to run turn by turn in a cyclic queue for a limited time period in round-robin (RR).

Example of Round Robin Algorithm

Following are three processes with their burst time:

Process Queue Burst time
P1 4
P2 3
P3 5

Step 1: Process P1 executes first. Every process executes for 2 seconds so processes P2 and P3 are in the waiting queue.

Step 2: At time = 2, P2 starts executing and P1 is added to the end of the Queue.

Step 3: At time = 4, P3 starts executing and P2 is added at the end of the queue.

Step 4: At time = 6, P1 starts executing and P3 is added at the end of the queue.

Technology is evolving rapidly!
Stay updated with DataFlair on WhatsApp!!

Step 5: At time = 8, As P1 has a burst time of 4 it completes execution and P2 starts execution.

Step 6: With a burst time of 3, process P2 executes for 2 intervals. At time = 9, P2 completes execution and P3 starts execution till completion.

Step 7: Average waiting time is:
Waiting time
P1 = 0 + 4 = 4
P2 = 2 + 4 = 6
P3 = 4 + 3 = 7

Characteristics of Round Robin Scheduling

Following are some important characteristics of RR:

Advantages of Round Robin Algorithm

Following are the advantages of RR:

Disadvantages of Round Robin Algorithm

Following are the disadvantages of RR:

Worst Case Latency

Worst Case Latency is the maximum time taken for execution of all tasks. Following is the formula for worst-case latency is:
Tworst = {(dti + sti + eti), + (dti + sti + eti)2 +…+ (dti + sti + eti)N., + (dti + sti + eti + eti)N} + tISR

t,SR = sum of all execution times
dt = Detection time when a task enters the list
st = Time required to switch from one task to another
et = Execution time of task

Summary

Round Robin process scheduling algorithm works on the principle of round-robin, where an equal share of an object is given to each person in turns. Oldest, fairest, and easiest scheduling algorithms. It spends a lot of time on context switching. Worst-case latency is the maximum time taken for the execution of all the tasks in the OS.

Exit mobile version