Research notes
How real operating systems schedule
The classroom algorithms are the foundation. These notes cover how production kernels build on them, plus a few papers worth reading.
The Completely Fair Scheduler models an idealized multitasking CPU using a red-black tree keyed on virtual runtime (vruntime). Each task accrues vruntime proportional to its weight; the scheduler always picks the task with the smallest vruntime. As of kernel 6.6 it transitions to EEVDF (Earliest Eligible Virtual Deadline First), adding latency-sensitivity via per-task deadlines.
Windows uses 32 priority levels across two classes (real-time 16–31, variable 1–15) with per-CPU ready queues. It applies priority boosts on I/O completion, foreground focus, and starvation avoidance (the balance-set manager boosts starved threads), then decays them after a quantum.
Rate Monotonic Scheduling assigns static priorities by period (shorter period → higher priority) and is optimal among fixed-priority policies, with the Liu & Layland bound U ≤ n(2^(1/n) − 1). EDF is dynamic-priority and optimal up to U ≤ 1, but degrades unpredictably under overload.
Modern schedulers balance load across cores while respecting cache affinity and NUMA locality. Techniques include per-CPU run queues with periodic load balancing, gang scheduling for parallel jobs, and energy-aware placement on heterogeneous (big.LITTLE) architectures.
Papers worth reading
Scheduling Algorithms for Multiprogramming in a Hard-Real-Time Environment
Foundational RMS/EDF optimality results and the utilization bound.
The Linux Scheduler: a Decade of Wasted Cores
Identifies subtle load-balancing bugs leaving cores idle despite runnable work.
Lottery Scheduling: Flexible Proportional-Share Resource Management
Randomized proportional-share scheduling via ticket allocation.
An Experimental Time-Sharing System
Describes CTSS, whose multilevel scheduling is the origin of the multilevel feedback queue.