The idea: the whole schedule is a table, made before the system runs

A priority scheduler decides at run time which job goes next. A cyclic executive decides nothing at run time. Before the system is built, the designer writes a table that says which pieces of work run in each short time slot, the frame. A hardware timer interrupts at the start of every frame. The executive looks up the frame's entry, runs those pieces one after another, and then lets the CPU idle until the next interrupt. After the last frame the table starts again from the top. This is clock-driven (or static, or off-line) scheduling. It is old and very plain, and that is why it is still used where timing must be easy to prove: flight control software, and the fixed partition windows of ARINC 653 avionics systems.

A timer interrupts every f = 2 ms. At each interrupt the cyclic executive computes k = n mod 10 and reads entry k of a static table of 10 frames (T1 T3, T2, T1 T4a, T2, T1 T4b, T2, T1, empty, T1, T2), runs those slices, then runs aperiodic work in the slack or idles until the next interrupt. After frame 9 the table starts again at frame 0, every 20 ms.
At run time the executive only counts frames and reads one table entry; every decision was made when the table was built.

Hyperperiod, frames and the task set

The page uses four periodic tasks, written as (period T, execution time C) in ms, each with its deadline D equal to its period: T1 = (4, 1), T2 = (5, 1.8), T3 = (20, 1) and T4 = (20, 2). They are the classic example in Jane Liu's textbook. Their pattern repeats every hyperperiod H, the least common multiple of the periods: lcm(4, 5, 20) = 20 ms. In 20 ms there are 5 + 4 + 1 + 1 = 11 jobs, with 5 + 7.2 + 1 + 2 = 15.2 ms of work, so the CPU is busy 76 % of the time (U = 0.76). The hyperperiod is cut into F frames of size f, so H = F × f. Some books call H the major cycle and f the minor cycle.

The three frame-size rules

A frame is the smallest unit the executive controls: it gets control back only at frame boundaries. So f cannot be chosen freely. It must pass three rules (Demo: the three rules for f = 1 to 5):

  1. f ≥ the largest C. Every job fits in one frame, so no job must be cut just because frames are short.
  2. f divides H. The hyperperiod is a whole number of frames, so the table can start again on a frame boundary.
  3. 2f − gcd(f, T) ≤ D for every task. Between any release of the task and its deadline there is at least one whole frame. A job released just after a frame starts must wait for the next frame; gcd(f, T) is the smallest gap that can occur between a frame start and a release.
frule 1: f ≥ 2rule 2: 20 mod frule 3: T1 / T2 / T3 / T4 against D = 4 / 5 / 20 / 20result
1 ms✗0 ✓1 / 1 / 1 / 1 ✓✗ rule 1
2 ms✓0 ✓2 / 3 / 2 / 2 ✓✓ the only one
3 ms✓2 ✗5 ✗ / 5 / 5 / 5✗ rules 2 and 3
4 ms✓0 ✓4 / 7 ✗ / 4 / 4✗ rule 3 for T2
5 ms✓0 ✓9 ✗ / 5 / 5 / 5✗ rule 3 for T1

f = 4 is the instructive failure. It is long enough and divides 20, but 2 × 4 − gcd(4, 5) = 7 > 5. Concretely, T2's second job is released at 5 ms, just after the frame that starts at 4 ms, and is due at 10 ms. The next whole frame is 8–12 ms, which ends after the deadline. With f = 2 the same job has the frame 6–8 ms. Larger frames (10 and 20 ms) also fail rule 3, for T1.

Two time lines from 0 to 12 ms for T2's job 2, released at 5 ms with deadline 10 ms. With f = 4 the frames are 4–8 and 8–12; neither lies inside 5–10, so the job has no whole frame and rule 3 fails: 2f − gcd(f, T) = 8 − 1 = 7 > 5. With f = 2 the frames 6–8 and 8–10 lie inside 5–10, rule 3 holds: 4 − 1 = 3 ≤ 5.
Rule 3 asks for one whole frame between release and deadline; with f = 4, T2's job released at 5 ms gets none.

Building the table, and slicing a job

With f = 2 there are F = 10 frames. The page fills them one at a time (Demo: build the table for f = 2). For frame k, from 2k to 2k + 2 ms, a job is a candidate if it is released by 2k and due at 2k + 2 or later, so it can run anywhere in the frame. Candidates are taken earliest deadline first and placed whole when they fit. The result:

frame0123456789
slicesT1 T3T2T1 T4aT2T1 T4bT2T1–T1T2
slack, ms00.200.200.21210.2

In frame 2, T1's second job takes 1 ms and T4 needs 2 ms, but only 1 ms is left. T4's code is written in two parts, so the table slices it: T4a (1 ms) runs in frame 2 and T4b (1 ms) in frame 4. A slice is a piece of a job that runs from start to end inside one frame; the job is "preempted" only at a frame boundary, and only where the designer planned it. Slicing has a price: the job's state must survive between the parts, and its code must be split by hand. T2 is not sliced: after its 1.8 ms, 0.2 ms are left in its frame, and that is slack. The slack of all frames adds up to 4.8 ms = 20 − 15.2. Real tools find tables with a search or network-flow algorithm (Liu, section 5.5); a greedy fill like this one can fail for task sets where a search would succeed.

The executive at run time

At frame n the timer interrupt fires at 2n ms. The executive first checks that the last frame's work is finished. Then it computes k = n mod F and runs the slices of table[k] in order. When they are done it serves aperiodic work in the remaining slack, and otherwise idles (Demo: one hyperperiod, frame by frame: 12 slices, 0 overruns, 4.8 ms idle). There is no ready queue, no priority, and no context switch inside a frame. Frame 10, at 20 ms, has k = 0 and runs table[0] again (Demo: the second hyperperiod repeats). Because the table is fixed, the exact time every job runs is known in advance, and testing one hyperperiod tests the system.

The time-triggered co-operative scheduler is a close relative. It also has one timer and tasks that run to completion, but it keeps per-task counters (Delay, Period) instead of a full table. The embedded software architectures page puts both next to the round-robin super loop and an RTOS.

Frame overruns

The table assumes each job takes at most its C. If a job runs longer, its slice is still running when the next frame interrupt comes. That is a frame overrun, and the executive must do something about it. On the page, T2's second job takes 2.4 ms instead of 1.8 ms in frame 3 (6–8 ms). Two common choices:

  • Abort the job and log the error (Demo: T2 overruns frame 3, abort it). The overrun is found at 8 ms, T2's job 2 is dropped, and frame 4 starts on time. The cost: that job had only 0.4 ms left and would have met its deadline at 10 ms.
  • Let it run on and start the next slices late (Demo: T2 overruns frame 3, let it run on). T2 ends at 8.4 ms, frame 4's T1 and T4b then end at 10.4 ms, past the next interrupt, and frame 5's T2 ends at 12.2 ms. So there are overruns at 8, 10 and 12 ms. Frame 6 has 1 ms of slack and absorbs the 0.2 ms delay: it idles from 13.2 ms. No deadline is missed here, but three frames ran late.
Two CPU timelines from 6 to 14 ms, frames 3 to 6. Abort: T2 runs 6 to 8 ms and is aborted at the frame interrupt at 8; T1 8 to 9, T4b 9 to 10, T2 10 to 11.8, T1 12 to 13 run on time. Run on: T2 runs 6 to 8.4 ms, T1 8.4 to 9.4, T4b 9.4 to 10.4, T2 10.4 to 12.2, T1 12.2 to 13.2; the interrupts at 8, 10 and 12 ms all find a slice still running; idle from 13.2 ms.
Aborting keeps every later frame on time but loses a job; running on keeps the job but delays the next frames until slack absorbs it.

A third choice is to suspend the job and finish it later in slack. Either way the overrun is a fault in the design or the timing measurements, and many systems also arm a watchdog timer that resets the processor if the executive itself stops reaching its frame interrupts.

Slack and aperiodic jobs

Jobs with no fixed period, such as an operator command, are aperiodic. A cyclic executive runs them only in the slack: after the frame's slices and until the next frame interrupt, where they are cut and wait for the next slack (Demo: an aperiodic job uses the slack). Job A needs 2 ms and arrives at 11 ms, while frame 5's T2 is running. It gets 11.8–12 ms (0.2 ms), 13–14 ms (1 ms, after frame 6's T1) and 14–14.8 ms (frame 7 is empty), and finishes at 14.8 ms: a response time of 3.8 ms. The periodic jobs are not delayed at all. Liu's slack stealing goes one step further: if a frame has slack, the aperiodic job may run first in that frame, which shortens its response time without moving any periodic job past its deadline.

Cyclic executive vs priority scheduling

cyclic executivefixed or dynamic priorities
decidedbefore run time, in a tableat run time, by priority or deadline
proof of timingread the tablean analysis: rate-monotonic response times, or the EDF bound U ≤ 1
locks for shared datanone: slices never overlapneeded, with protocols such as priority ceiling and SRP
a new task or a changed periodrebuild the whole tablere-run the analysis
periodsbest when they are harmonic; a period like 4.9 ms makes H hugeany periods
aperiodic workonly in slacka server or background priority

Locke's 1992 comparison concluded that a fixed-priority executive with rate-monotonic priorities is usually easier to maintain, while the cyclic executive remains attractive where the simplest possible run-time and a fully predictable schedule matter most. How EDF and least-slack-time decide at run time is on EDF vs least slack time; the Linux real-time classes are on real-time scheduling, and the general-purpose schedulers on CPU scheduling.

See also time-triggered communication, where a schedule table made before run time fixes which node may send on the bus in each slot of a TDMA round.

What the page leaves out

One CPU, all tasks released at 0 with D = T, and an executive that takes no time; a real one costs some microseconds per frame, which is added to the frame's load. The table here comes from a greedy fill, not the network-flow search of Liu's book, and only one task may be sliced. Release jitter, the check that a slice's job has really been released, sporadic jobs with hard deadlines and their acceptance test, slack stealing, mode changes that switch to another table, and multiprocessor tables are not shown.

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