Explain Round robin scheduling with example.

 

Answer: - Round Robin Scheduling

·         Round-robin Scheduling is similar to FCFS scheduling, except CPU bursts are assigned with time quantum limits.

·         When a process is given the CPU, a timer is set for whatever value has been set for a time quantum.

Ø  If the process finishes its burst before the time quantum timer expires, then it is swapped out of the CPU just like the average FCFS algorithm.

Ø  If the timer goes off first, then the process is swapped out of the CPU and moved to the back end of the ready queue.

 ·         The ready queue is maintained as a circular queue, so when all processes have had a turn, then the schedular gives the process another turn, and so on.

·         RR scheduling can give the effect of all processors sharing the CPU equally, although the average wait time can be longer than other scheduling algorithms. In the following example, the average wait time is 5.66 ms. 

Process

Burst Time

P1

24

P2

3

P3

3


·         The performance of RR is sensitive to the time quantum selected. If the quantum is large enough then RR reduces to the FCFS algorithm. If it is very small, then each process gets 1/nth of the processor time and share the CPU equally.

·         BUT a real system invokes overhead for every context switch, and the smaller the time quantum the more context switches there are. Most modern system use time quantum between 10 and 100 milliseconds, and context switch times on the order of 10 microseconds, so the overhead is small relative to be the time quantum. 

Post a Comment