Every scheduler so far optimised an average — mean turnaround, a fair long-run share. A real-time system does not care about averages. It cares about a single question asked of every job: will it finish before its deadline? When an airbag controller detects a crash, computing the correct deployment 10 ms late is not "a bit slow" — it is a failure as total as computing the wrong answer. The engine controller, the flight surface actuator, the software-defined radio, the robot joint: all are governed not by throughput but by deadlines.
Real-time scheduling flips the whole problem. Instead of "make good jobs run well on average", it asks "can I prove, before we ship, that every deadline will always be met?" That proof is a schedulability test, and this lesson is about the two classic algorithms that come with one — Rate-Monotonic (RM) and Earliest-Deadline-First (EDF) — and the nasty surprise (priority inversion) that once nearly killed a Mars mission.
A hard real-time deadline must never be missed — a miss is a system failure
(avionics, anti-lock brakes, a pacemaker). A soft deadline should usually be met;
an occasional miss degrades quality but is survivable (a dropped video frame, a stutter in audio). The
classic analysis models a set of periodic tasks: task
If
Rate-Monotonic scheduling assigns each task a fixed priority once, by its rate:
the shorter the period, the higher the priority. It is a static priority scheme — priorities never
change at run time — which makes it simple, predictable, and cheap to implement in a small RTOS. Below is a
concrete RM schedule for two tasks,
Liu and Layland proved (1973) that RM is the optimal fixed-priority assignment, and that any set of
Read that ceiling carefully: as the number of tasks grows, the guaranteed-safe utilization falls to about
Earliest-Deadline-First throws out fixed priorities. At every instant it runs whichever
ready job has the nearest absolute deadline — a dynamic priority that changes as deadlines
approach. This flexibility buys a remarkable result: EDF is optimal for a single processor,
and a periodic task set is schedulable under EDF if and only if
An admission controller runs exactly this arithmetic before accepting a new task: compute
Days after landing, Pathfinder began mysteriously resetting itself. The cause was
priority inversion. A low-priority weather task grabbed a shared data bus (protected by a
mutex), then was preempted. A high-priority bus-management task then needed the same mutex — and had to
wait for the low-priority task to release it. But medium-priority tasks kept preempting the
low-priority one, so it never ran, never released the mutex, and the high-priority task missed its deadline.
A watchdog timer, seeing the critical task overrun, dutifully reset the spacecraft. JPL diagnosed it on a
replica on Earth and uploaded a fix that switched on priority inheritance — the mutex
temporarily lends the blocking low-priority task the high task's priority so it can finish and release. It is
the canonical real-time bug, and we will meet its cure in full when we study
The Liu–Layland bound
If EDF is optimal and wastes no CPU, why does so much safety-critical code still use RM? Because RM's
static priorities are dead simple to reason about, cheap to implement, and — crucially — degrade
predictably under overload: when the system is over-committed, RM sheds the lowest-rate tasks
first, in a known order, while EDF can suffer a domino effect where one missed deadline cascades
into many. Certification authorities like predictability. So RM (and its cousin deadline-monotonic) rules
avionics and automotive RTOSes, while EDF and its variants power systems that prize utilization — real-time
multimedia, and Linux's own