Computer Science / Unit 6 CS 0309 worked example, 60 to 90 seconds
Round-Robin, Run to the Clock
The idea
A round-robin schedule grants each process one time slice in rotation — a finished process releases the CPU early, an unfinished one rejoins the back of the queue — and a full trace shows exactly when everyone completes.
In practice
Three processes arrive needing 3, 4, and 2 milliseconds of work, with a 2-millisecond slice. The rotation begins. First slice: process one runs 2 of its 3 — one remains — and goes to the back. Second slice: process two runs 2 of its 4 — two remain. Third slice: process three runs its full 2 and finishes at millisecond 6, releasing the CPU on time. Fourth turn: process one needs only 1 — it finishes at millisecond 7 and releases the slice early. Fifth turn: process two runs its last 2 and finishes at millisecond 9. Nine milliseconds of work, nine milliseconds of clock, three finishing times the trace predicted to the tick: 6, 7, 9. Every process waited, none starved, and the strategy's fairness is visible in the arithmetic.
Where people slip
A trace at classroom scale is the honest way to see a policy — the same rotation runs beneath every busy machine, thousands of turns per second.
Your place on the trail
Every lesson rests on earlier ones and opens later ones. Tap any to jump.
Unlocks
- Nothing yet depends on this.
Something wrong in this lesson? Flag it · Sources for Computer Science