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).