Operating System - Round Robin Scheduling
Let us understand Round Robin Scheduling of processes in an Operating system.
Round Robin Scheduling is mainly designed for time shared systems. This algorithm defines that each process is executed by the fixed amount of time called time quantum.
The time quantum or time slice is a small unit of time which is generally range from 10 to 100 millisecond.
The process is executed within the time slice. After that the process is preempted and allows the other process to execute for the given time slice.
It is similar to FCFS scheduling but the preemption is added to switch between the processes.
We use Context switch to store the process state.
The performance of this algorithm mainly depends on the effect of context switching and size of the time quantum.
If time quantum is too large, its result is same as a FCFS scheduling. If time quantum is too low, the processor through put is reduced because more time is spent on context switching.
For example consider the set of processes that arrive at time 0 and CPU-burst time given in millisecond:
Process | CPU-Burst Time |
---|---|
P1 | 20 |
P2 | 4 |
P3 | 3 |
Here we assume time quantum of 4 millisecond. Following shows the resulting Gantt Chart: