Why Scheduling Algorithms Trade Off Fairness Against Throughput
CPU scheduling algorithms decide which waiting process gets the processor next, and different algorithms optimize for genuinely different, sometimes conflicting goals. FCFS (First-Come-First-Served) is simple and fair in arrival order, but a single long process can force every process behind it to wait — the "convoy effect." SJF (Shortest Job First) minimizes average waiting time provably, but risks starving long processes indefinitely if short jobs keep arriving. Priority scheduling respects explicit importance levels, but faces the same starvation risk for low-priority processes without an aging mechanism. Round Robin gives every process a fixed time slice in rotation, guaranteeing fairness and responsiveness at the cost of higher overhead from frequent context switching.
Turnaround time (total time from arrival to completion) and waiting time (time spent ready but not running) are the standard metrics for comparing algorithms on a given workload — and the "best" algorithm genuinely depends on what a system actually needs: a responsive interactive system favors Round Robin's fairness, while a batch-processing system might prefer SJF's throughput optimization.
Visualizing the same process set as a Gantt chart under each algorithm side by side is the fastest way to build real intuition for these tradeoffs, since the abstract fairness-vs-throughput tension becomes concrete once you see the actual timeline differences.
Worked example
Four processes P1 to P4 arrive at times 0, 1, 2 and 3 with burst times 8, 4, 9 and 5 (the "Load example" set):
- FCFS: P1 runs 0–8, P2 8–12, P3 12–21, P4 21–26. Waiting times are 0, 7, 10 and 18, so the average waiting time is 8.75 and the average turnaround time 15.25. Every later process waits behind the long P1: the convoy effect.
- SJF (non-preemptive): P1 still runs first because it is alone at time 0, then P2, P4 and P3 in order of burst time. Average waiting time drops to 7.75.
- SRTF (preemptive SJF): P1 is preempted at time 1 by the shorter P2, giving P1 0–1, P2 1–5, P4 5–10, P1 10–17, P3 17–26. Average waiting time falls to 6.5 and average turnaround to 13.
- Round Robin, quantum 2: the average waiting time rises to 12.75, but the average response time is just 2, the best of all six. That trade-off is why interactive systems use Round Robin.
Turnaround time is completion time minus arrival time (TAT = CT − AT), and waiting time is turnaround minus burst (WT = TAT − BT).
Round Robin step by step: tracking the ready queue
Round Robin questions are marked on the ready queue, so here is a short one solved the exam way. Four processes arrive at 0, 1, 2 and 3 with bursts 5, 3, 1 and 2, and the time quantum is 2. Enter 0 1 2 3 and 5 3 1 2, pick Round Robin and the calculator draws the same Gantt chart.
| Time | Runs | Ready queue afterwards |
|---|---|---|
| 0–2 | P1 (3 left) | P2, P3, P1 |
| 2–4 | P2 (1 left) | P3, P1, P4, P2 |
| 4–5 | P3 finishes | P1, P4, P2 |
| 5–7 | P1 (1 left) | P4, P2, P1 |
| 7–9 | P4 finishes | P2, P1 |
| 9–10 | P2 finishes | P1 |
| 10–11 | P1 finishes | — |
Two rules decide every step. A process that has used its full quantum goes to the back of the queue. A process that arrives during a slice, or exactly when it ends, joins the queue before the preempted one: at time 2, P3 arrives just as P1's slice ends, so the queue is P2, P3, P1 and not P2, P1, P3. A process with less than a quantum left (P3 here) runs only for what it needs, and the next slice starts at once.
Completion times are 11, 10, 5 and 9, giving turnaround times 11, 9, 3 and 6 (average 7.25) and waiting times 6, 6, 2 and 4 (average 4.5). FCFS on the same processes averages 6.75 and 4, which is lower, but its average response time is 4 against Round Robin's 1.75. That is the whole trade-off: Round Robin answers everyone sooner and finishes the long job later.
Where this fits
CPU scheduling is one of the core operating-systems topics. The others in this toolkit are page replacement (FIFO, LRU and Optimal), disk scheduling (FCFS, SSTF, SCAN, C-SCAN, LOOK, C-LOOK) and deadlock avoidance with the banker's algorithm. For Round Robin solved slice by slice with screenshots, read the Round Robin scheduling example.