Round Robin

Lists of Descriptive Questions Answers and Short Study Notes On Operating System – Round Robin scheduling algorithms

  • (1) Explain Round Robin scheduling algorithms with illustration.

 

Question-1  Explain Round Robin scheduling algorithms with illustration.

 

Selection Criteria:

Each selected process is assigned a time interval, called time quantum or time slice.

Process is allowed to run only for this time interval. Here, two things are possible:

  1. First, Process is either blocked or terminated before the quantum has elapsed. In this case the CPU switching is done and another process is scheduled to run.
  2. Second, Process needs CPU burst longer than time quantum. In this case, process is running at the end of the time quantum. Now, it will be preempted and moved to the end of the queue. CPU will be allocated to another process. Here, length of time quantum is critical to determine.

 

Decision Mode:

Preemptive

 

Implementation:

This strategy can be implemented by using circular FIFO queue. If any process comes, or process releases CPU, or process is preempted. It is moved to the end of the queue.

When CPU becomes free, a process from the first position in a queue is selected to run.

 

Example:

Consider the following set of four processes. Their arrival time and time required to complete the execution are given in the following table. All time values are in milliseconds. Consider that time quantum is of 4 ms, and context switch overhead is of 1 ms

 

Process Arrival Time (T0) Time required for completion (∆T)(CPU Burst Time)
P0 0 10
P1 1 6
P2 3 2
P3 5 4

 

 

Gantt Chart:

P0 P1 P2 P0 P3 P1 P0
0          4 5 9 10 12 13 17 18 22 23 25 26 28

 

 

At 4ms, process P0 completes its time quantum. So it preempted and another process P1 is allowed to run. At 12 ms, process P2 voluntarily releases CPU, and another process is selected to run. 1 ms is wasted on each context switch as overhead. This procedure is repeated till all process completes their execution.

 

Statistics:

Process Arrival Time(T0) CPU Burst Time(∆T) Finish Time(T1) Turnaround Time(TAT=T1-T0) Waiting Time (WT=TAT-∆T)
P0 0 10 28 28 18
P1 1 6 25 24 18
P2 3 2 12 9 7
P3 5 4 22 17 13

 

 

Average Turnaround Time: (28+24+9+17)/4 = 78 / 4 = 19.5 ms

Average Waiting Time: (18+18+7+13)/4 = 56 / 4 = 14 ms

 

Advantages:

  • One of the oldest, simplest, fairest and most widely used algorithms.

 

Disadvantages:

  • Context switch overhead is there.
  • Determination of time quantum is too critical. If it is too short, it causes frequent context switches and lowers CPU efficiency. If it is too long, it causes poor response for short interactive process.