Round Robin Scheduling
Round Robin (RR) shares CPU access through FIFO turns. A selected process runs for at most one quantum. If it finishes earlier, the next process can start immediately. If it is unfinished when the quantum expires, it returns to the queue tail.
The rule
The quantum limits a turn, not the process's total CPU service. A job can need many turns. If no other process is ready, the current process can continue without an actual change of CPU owner.
Worked example: quantum 2
| Process | Arrival | Burst |
|---|---|---|
| P1 | 0 | 7 |
| P2 | 1 | 3 |
| P3 | 2 | 1 |
One CPU · One burst per process · No I/O · Dispatch cost 0 · Quantum 2. Times are abstract units.
At 2, P1 ends its first slice with 5 left. After selection, the CPU runs P2; Ready is P3, P1. Arrivals at this boundary entered before the expired turn returned to the tail.
The full CPU trace is P1 [0, 2), P2 [2, 4), P3 [4, 5), P1 [5, 7), P2 [7, 8), P1 [8, 11). Completion can end a turn before the full 2-unit quantum.
At 10, a quantum expires but the same owner continues because no peer is waiting.
Admit boundary arrivals before returning the expired owner to the tail.
Ready lists the next FIFO turns, after the selected owner has left the queue.
- P1: [0, 2)
- P2: [2, 4)
- P3: [4, 5)
- P1: [5, 7)
- P2: [7, 8)
- P1: [8, 11)
Quantum expiry keeps the same owner at 10. Completion can end a turn early.
Calculate the result
| Process | Completion | Waiting | Turnaround | Response |
|---|---|---|---|---|
| P1 | 11 | 4 | 11 | 0 |
| P2 | 8 | 4 | 7 | 1 |
| P3 | 5 | 2 | 3 | 2 |
P2: turnaround = 8 − 1 = 7. Waiting = 7 − 3 = 4. First response = 2 − 1 = 1.
Waiting and first response coincide for a nonpreempted process; interrupted work can wait again after its first turn.
Mean waiting = (4 + 4 + 2) / 3 ≈ 3.333 units. Mean response = 1 units.
Choosing a quantum
A shorter quantum creates more opportunities to take a turn, but can also produce more process changes and dispatch overhead. A sufficiently long quantum makes RR behave like FCFS for a finite workload whose bursts all finish within one turn.
For this input, RR changes processes 5 times, compared with 2 for FCFS. Both finish at 11 because dispatch cost is zero. Counting only quantum expirations would miss changes caused by completion.