The idea: prove every deadline is met before the system runs

A control loop, a sensor reader or an audio callback runs again and again at a fixed rate. Each one is a periodic task τi = (Ci, Ti, Di): every Ti ticks it releases a job that needs Ci ticks of CPU (its worst-case execution time) and must finish within Di ticks of the release, its deadline. Usually D = T: a job must be done before the next one arrives. The scheduler uses fixed priorities and preempts at once, as SCHED_FIFO on Linux does. The question this page answers is the one an engineer must settle before shipping: with these priorities, can any job ever miss its deadline? There are two tests on paper, a quick one and an exact one, and the page checks both against the real schedule.

A chart of the Liu–Layland bound n times (2 to the power 1 over n, minus 1) for n from 1 to 8 tasks: 1.000, 0.828, 0.780, 0.757, falling towards ln 2 = 0.693. Below the curve is the green zone 'guaranteed', between the curve and U = 1 the blue zone 'inconclusive, run the exact test', above 1 the red zone 'overloaded'. Set D (U = 0.583, n = 3) sits in the green zone, set A (0.833, n = 3) and set B (0.971, n = 2) in the blue zone
The utilization test only gives an answer under the curve; sets A and B fall in the gap where only the exact test decides.

Rate-monotonic priorities

Rate-monotonic (RM) priorities are simple: the shorter the period, the higher the priority. On the page's set A, τ1 (C = 1, T = 4) gets priority 1, τ2 (C = 2, T = 6) priority 2 and τ3 (C = 3, T = 12) priority 3. Liu and Layland proved in 1973 that, when every deadline equals the period, RM is optimal among fixed-priority orders: if any fixed order meets every deadline, RM does too. The wrong order shows why it matters. Give the longest period the top priority and τ3 takes ticks 0–2, τ2 ticks 3–4, and τ1, which needs one tick out of every four, has not run by tick 4 (Demo: wrong priorities, longest period first: τ1 misses at ticks 4 and 8). With RM priorities the same set meets every deadline.

The utilization bound

The utilization U = Σ Ci/Ti is the share of the CPU the tasks ask for. Above 1, no scheduler can keep up. Liu and Layland's bound gives a quick sufficient test for RM with D = T:

U=∑iCiTi≤n(21/n−1)

For n = 2 tasks the bound is 0.828, for 3 tasks 0.780, and it falls towards ln 2 ≈ 0.693 as n grows. Set D, U = 1/4 + 1/6 + 2/12 = 0.583, is under 0.780, so every deadline is met without further work (Demo: under the bound, set D). Set A has U = 1/4 + 2/6 + 3/12 = 0.833, above 0.780 but below 1. The test is only sufficient: above the bound it says nothing at all, neither "safe" nor "unsafe" (Demo: utilization test, set A).

Response-time analysis

The exact test computes each task's worst-case response time Ri, the longest time from a release to the end of that job. A job of τi is delayed only by higher-priority tasks, and in a window of R ticks a task τj is released ⌈R/Tj⌉ times. So R must satisfy

Ri=Ci+∑j∈hp(i)⌈RiTj⌉Cj

R appears on both sides, so it is found by iteration. Start from R⁰ = Ci plus one job of every higher-priority task, put the value into the right side, and repeat until it stops changing (then Ri ≤ Di ✓) or passes Di (✗). For τ3 in set A (Demo: response-time analysis, set A):

stepwindowτ1 releasesτ2 releasesR = 3 + τ1 work + τ2 work
R⁰–113 + 1 + 2 = 6
R¹6⌈6/4⌉ = 2⌈6/6⌉ = 13 + 2 + 2 = 7
R²7⌈7/4⌉ = 2⌈7/6⌉ = 23 + 2 + 4 = 9
R³9⌈9/4⌉ = 3⌈9/6⌉ = 23 + 3 + 4 = 10
R⁴10⌈10/4⌉ = 3⌈10/6⌉ = 23 + 3 + 4 = 10, the same: stop

R3 = 10 ≤ 12 ✓, and τ1 (R = 1) and τ2 (R = 2 + ⌈3/4⌉·1 = 3) pass too. Set A is schedulable although its U is above the bound.

A staircase W(t) = 3 + ceiling(t/4) times 1 + ceiling(t/6) times 2, the work τ3 and the higher-priority tasks need by time t, drawn against the diagonal line y = t, the time the CPU has. The iteration points 6, 7, 9 and 10 climb the staircase; at t = 10 the staircase meets the diagonal for the first time, before the deadline 12
Each iteration asks "how much work arrives in this window?"; the first point where the CPU has caught up with that work is the response time, R3 = 10.

The critical instant and the hyperperiod

Why does a formula stand for every job? Liu and Layland showed that a task's worst response happens at the critical instant, when it is released together with every higher-priority task. The page releases all tasks at t = 0, so the first job of each task is its worst one. The schedule repeats every hyperperiod H = lcm(Ti), 12 ticks for set A, so one hyperperiod shows everything (Demo: RM schedule over the hyperperiod: τ1 at tick 0, τ2 at 1–2, τ3 at 3, preempted by τ1 at 4, on at 5, preempted by τ2 at 6–7 and τ1 at 8, done at 10; the worst response times seen are 1, 3 and 10, exactly the analysis, and the CPU idles 2 of 12 ticks).

When the test fails: set B

Set B has τ1 (C = 2, T = 5) and τ2 (C = 4, T = 7): U = 0.4 + 0.571 = 0.971, above the two-task bound 0.828. The analysis gives R⁰ = 6, then R¹ = 4 + ⌈6/5⌉·2 = 8 > 7 ✗. The schedule agrees (Demo: set B misses a deadline): τ1 runs 0–1, τ2 2–4, τ1 is released again at 5 and takes 5–6, and at tick 7 τ2 still has one tick of work left. It finishes late, at 8. In the rest of the 35-tick hyperperiod no other job misses: one miss is enough to fail a hard real-time system. Swapping the priorities does not help either (τ1 would then wait 4 ticks for τ2 and finish at 6 > 5), so no fixed order schedules set B. A dynamic-priority scheduler such as earliest deadline first (EDF) meets every deadline whenever U ≤ 1, at the cost of priorities that change from job to job.

Deadlines shorter than periods: deadline-monotonic

If a task must react faster than it repeats (D < T), the utilization bound does not apply. Set C adds a sensor task τ3 with C = 1, T = 12 but D = 2. Its U is only 0.667, under 0.780, yet under RM τ3 has the lowest priority and its first job waits for τ1 and τ2 until tick 3: it misses at tick 2 (Demo: D < T, rate-monotonic fails; the analysis gives R⁰ = 4 > 2 ✗). Deadline-monotonic (DM) priorities order tasks by D instead of T. Leung and Whitehead proved in 1982 that DM is the optimal fixed order when D ≤ T. Now τ3 runs first and the response times are τ3 1, τ1 2, τ2 4, all within their deadlines (Demo: deadline-monotonic fixes it). When D = T, DM and RM are the same order.

testwhat it needsanswercost
U ≤ n(21/n − 1)RM priorities, D = T"yes" or "don't know"one sum
U ≤ 1any scheduler"no" if U > 1one sum
response-time analysisany fixed priorities, D ≤ Texact yes or noa few iterations per task
simulate one hyperperiodrelease times knownexact for that release patternH ticks (can be huge)

See also real-time scheduling (SCHED_FIFO and SCHED_RR, priority inversion and the Mars Pathfinder), CPU scheduling (FCFS, SJF, round robin and CFS on the same processes) and preemptive vs cooperative scheduling.

See also EDF vs least slack, where set B meets every deadline under earliest deadline first and an overloaded set shows EDF's domino effect.

See also interrupt priorities and nesting for what fixed priorities and preemption cost on a microcontroller, counted in cycles.

See also a time-triggered co-operative scheduler, the simpler non-preemptive alternative on small microcontrollers, where offsets keep every tick's work under 10 ms.

See also the CAN bus, where fixed message priorities decide who sends first, just as fixed task priorities do here.

See also the cyclic executive, which fixes the whole schedule in a table of frames before the system runs instead of using priorities.

See also embedded software architectures for why a preemptive RTOS gives the top-priority task a response of almost nothing while a super loop makes it wait for every handler.

See also priority ceiling protocols and the stack resource policy, which adds the blocking term B to response-time analysis and shows a task set that fails under priority inheritance but passes under a ceiling protocol.

What the page leaves out

One CPU, integer ticks, and a context switch that takes no time; real analyses add switch and interrupt costs to C. Tasks here never block or share resources, so there are no blocking terms in the formula; locking protocols that bound blocking (priority inheritance, priority ceiling) are a separate topic. Jobs never start late (no release jitter), never run shorter than C, and never arrive sporadically. The page does not cover EDF in depth, clock-driven tables (cyclic executives), deadlines longer than periods, the hyperbolic bound, or multiprocessor scheduling.

On the mind map

Open the Operating Systems mind mapOperatingSystemsBoot and program start: from power on to main()Boot and program startProcesses and the kernel: how user code talks to the kernelProcesses and the kernelInterrupts and devices: hardware interrupts the CPUInterrupts and devicesScheduling and deadlock: who runs next, who gets whatScheduling and deadlockVirtual memory: every address is translatedVirtual memoryPhysical memory: who gets which bytes of RAMPhysical memoryFiles and storage: from open() down to the diskFiles and storageDisks and RAID: blocks down to platter or flashDisks and RAIDIsolation and security: limit what a process can doIsolation and securityContext switchContext switchswitch_mm loads CR3, switch_to swaps stacksCPU scheduling algorithmsCPU scheduling algorithmsFCFS, SJF, RR, CFS: compare waiting timeMultiprocessor SchedulingMultiprocessor SchedulingPer-CPU queues + stealing beat one lockMulti-Level Feedback QueueMulti-Level Feedback QueueUse your quantum, drop a levelLottery & strideLottery & strideTickets set shares; stride runs lowest passPreemptive vs cooperativePreemptive vs cooperativetimer forces a switch, or wait for yieldReal-time schedulingReal-time schedulingpriority inversion, fixed by inheritanceRate-monotonic analysisShort period = high priority; RTA decidesPriority ceiling and SRPPriority ceiling and SRPOne lower critical section, no deadlockEDF vs Least SlackEDF vs Least SlackEDF: any set with U ≤ 1; overload dominoesTime-triggered schedulerTime-triggered schedulerISR only flags; super loop runs, then sleepsCyclic executiveCyclic executivea timer runs a fixed frame tableSuper loop to RTOSSuper loop to RTOSUART worst: 13, 13, 8, 1 msLoad averageLoad averagedamped count of R and D tasksBanker's algorithmBanker's algorithmgrant only if a safe order still existsDeadlock detectionDeadlock detectionFind the cycle, then kill a victimOpen the Operating Systems mind mapOperating Systemswho runs next, who gets whatScheduling and deadlockContext switchContext switchswitch_mm loads CR3, switch_to swaps stacksCPU scheduling algorithmsCPU scheduling algorithmsFCFS, SJF, RR, CFS: compare waiting timeMultiprocessor SchedulingMultiprocessor SchedulingPer-CPU queues + stealing beat one lockMulti-Level Feedback QueueMulti-Level Feedback QueueUse your quantum, drop a levelLottery & strideLottery & strideTickets set shares; stride runs lowest passPreemptive vs cooperativePreemptive vs cooperativetimer forces a switch, or wait for yieldReal-time schedulingReal-time schedulingpriority inversion, fixed by inheritanceRate-monotonic analysisShort period = high priority; RTA decidesPriority ceiling and SRPPriority ceiling and SRPOne lower critical section, no deadlockEDF vs Least SlackEDF vs Least SlackEDF: any set with U ≤ 1; overload dominoesTime-triggered schedulerTime-triggered schedulerISR only flags; super loop runs, then sleepsCyclic executiveCyclic executivea timer runs a fixed frame tableSuper loop to RTOSSuper loop to RTOSUART worst: 13, 13, 8, 1 msLoad averageLoad averagedamped count of R and D tasksBanker's algorithmBanker's algorithmgrant only if a safe order still existsDeadlock detectionDeadlock detectionFind the cycle, then kill a victim
This page on the Operating Systems mind map · 78 pages in 9 branches · open it to see the whole map and test yourself in recall mode.