How does Round Robin scheduling work, and how does the time quantum affect it?
MediumConceptCPU Scheduling
Answer
Round Robin (RR) gives each ready process a fixed slice of CPU time called the time quantum, typically 10–100 ms. If a process has not finished when its quantum expires, it is preempted and moved to the back of the ready queue.
- It is designed for time-sharing: with n processes, each waits at most (n − 1) × q before its next turn, so response time is good and no process starves.
- If the quantum is too large, RR behaves like FCFS. If it is too small, much of the CPU time goes to context switches. A common rule of thumb is that about 80% of CPU bursts should be shorter than the quantum.
- Average waiting time is usually higher than with SJF; RR trades that for responsiveness.
Example: q = 2, and P1, P2 and P3 arrive at time 0 with bursts of 5, 3 and 1.
Gantt chart: P1 0–2 | P2 2–4 | P3 4–5 | P1 5–7 | P2 7–8 | P1 8–9
| Process | Burst | Completion = TAT | WT = TAT − Burst |
|---|---|---|---|
| P1 | 5 | 9 | 4 |
| P2 | 3 | 8 | 5 |
| P3 | 1 | 5 | 4 |
Average WT = 13 / 3 ≈ 4.33. Response times are 0, 2 and 4, so every process starts within 4 time units.