/ COMPUTER-FUNDAMENTAL

Round Robin Scheduling Algorithm

Round Robin scheduling algorithm


This algorithm comes from the round-robin principle,
where each person gets an equal share of something in turns.

In RR scheduling, each ready task runs turn by turn only in a cyclic queue for “a limited time” slice. It offers starvation free execution of processes.


Characteristics of RR algorithm

  • CPU shifts to another process after fixed interval time,
    which is called “time quantum”/”time slice”.
  • Preempted Process will be added to the end of the queue.
  • It responds to the event within a specific time limit.

How RR scheduling works

Suppose that Process queue has 3: P1, P2, and P3.
Burst time is P1: 4, P2: 3, P3: 5.

IPC

1) P1 executes for 2 secs first, is preempted, and go to the end of queue.
2) At time 2, P2 executes for 2sec.
3) At time 4, P3 executes for 2sec.
4) At time 6, P1 executes last 2 secs and done.
5) At time 8, P2 executes last 1 sec and done.
6) At time 9, P3 executes for 2secs.
7) At time 11, P3 executes last 1 sec and done.

The waiting time

  • P1 = 0 + 4 = 4
  • P2 = 2 + 4 = 6
  • P3 = 4 + 3 = 7

Advantages of Round-Robin scheduling

  • no issue of starvation or convey effect
  • fair allocation of resource
  • not depending on burst time

Disadvantages of Round-Robin scheduling

  • If time slice is low, output will be reduced
  • spending more time for context switching
  • Finding correct time slice is difficult

Worst case latency

This term is used for the maximum time for execution of all the tasks.