Systems study
Offline — showing the cached copy.
Home / OS Theory / 7. CPU scheduling algorithms

7. CPU scheduling algorithms

One-liner. Every scheduler chooses what to optimize: response, turnaround, throughput or fairness.

Memorize

  • FCFS: simple, suffers the convoy effect (short jobs stuck behind long ones).
  • SJF / SRTF: optimal average waiting time, needs future knowledge (predict from history).
  • Round robin: fairness via quantum; too small = context-switch overhead, too large = FCFS behaviour.
  • Priority + aging: prevents starvation by raising waiting tasks' priority.
  • MLFQ: multiple queues, demotion on CPU use, promotion on wait — approximates SJF without prediction.
  • Lottery/stride: proportional share by tickets/stride.
  • CFS used vruntime; EEVDF (Linux 6.6+) uses eligible tasks with virtual deadlines.
  • RM/EDF for real-time: EDF is optimal for preemptive uniprocessor scheduling when utilization ≤ 1.
ROUND ROBIN Ready queue: P1P2 P3 run P1 forquantum preempt P2 P3 P1 …
Round robin

Trap. Choosing SJF in a general-purpose OS — you cannot know the next burst, and long jobs starve. Do this. Pick the metric first (latency vs throughput vs fairness), then the algorithm.

Check

Which scheduling policy minimizes average waiting time when burst times are known?