Round Robin
Time slices in a cycle. The quantum is the whole design.
Level: beginner
What is it?
Ready threads sit in a FIFO. Each runs for at most one quantum, then is preempted to the tail. Fair in the sense of equal CPU over a long window; response time depends on n × quantum.
Why does it matter?
It is the first preemptive scheduler people implement, and the quantum question is a real engineering knob (too small: context-switch tax; too large: FCFS in disguise).
Mental model
A talking stick with a kitchen timer.
How it works
- Quantum q. n runnable threads → a thread waits about (n-1)q between slices.
- I/O-bound threads often yield before q; they look snappy.
- CPU-bound threads are sliced; they need other policies (priority, CFS vruntime) for fairness in work, not just time.
Real-world usage
- Time-sharing Unix
- Interview Gantt charts
- Cooperative thread pools with a time slice
Common mistakes
- q = 1ms on a machine whose switch costs 0.3ms
- Calling RR 'optimal' — it is not SJF
Interview questions
Effect of a tiny quantum?
Response time looks good until context-switch overhead dominates utilization.
RR vs FCFS?
RR is preemptive FCFS with a cap. Long jobs cannot convoy the CPU for their whole burst.