Deadline Monotonic Scheduling
Give each task one fixed priority, highest for the shortest relative deadline, then prove every task safe by computing its worst-case response time. It is the best possible fixed ranking when deadlines are no longer than periods, and it matches rate monotonic when they are equal.
Rank Tasks by Their Deadlines
- List each task's C (work per job), T (period) and D (relative deadline)
- Sort by D, shortest first, and give priorities in that order
- Check each task with response time analysis before running
- At run time, always run the highest-priority ready job
Deadline monotonic scheduling gives every periodic task one priority before the system starts, and the task with the shortest relative deadline gets the highest. The relative deadline D is how long a job may take after its release; the period T is how often the task releases a job. The ranking never changes at run time, and the scheduler simply runs the highest-ranked ready job, preempting anything lower.
"Monotonic" just means the priority order follows the deadline order: shorter D, higher priority, with no exceptions. The rule only makes sense when D ≤ T, so each job finishes before the next one of the same task arrives.
- Priorities are fixed per task, set offline
- Ties in D can be broken any way
Deadline Monotonic vs Rate Monotonic
Rate monotonic ranks by period instead: the task that repeats most often goes first. When every deadline equals its period the two orders are identical, so the choice between deadline monotonic and rate monotonic only matters for constrained deadlines, D < T.
That case is common. A sensor read every 8 ms whose value must reach the control loop within 5 ms has T = 8 but D = 5. Rate monotonic sees the long period and ranks it low; deadline monotonic sees the short deadline and ranks it high. Leung and Whitehead proved in 1982 that for D ≤ T the deadline order is optimal among fixed priorities: if any fixed ranking meets every deadline, the deadline monotonic ranking does too. Both cost the same to run, so there is no reason to prefer rate monotonic once deadlines differ from periods.
- D = T for every task: same ranking, same result
- Some D < T: deadline monotonic is never worse, often better
Response Time Analysis
- R = C of the task
- New R = C + for each higher task: ceil(R / T) × its C
- Same as the old R: done, compare with D
- Bigger than D: the task can miss, stop
- Otherwise repeat with the new R
Utilisation alone cannot prove a constrained-deadline set safe; a set at 40% can still miss if its deadlines are tight. Response time analysis computes each task's worst-case response time R directly and compares it with D.
The worst case for task i is the critical instant: every higher-priority task releases at the same moment as task i. Within a window of length R, a higher-priority task j releases ⌈R / Tⱼ⌉ times and each release takes Cⱼ. So Rᵢ = Cᵢ + Σ ⌈Rᵢ / Tⱼ⌉ · Cⱼ over the tasks ranked above i.
R appears on both sides, so solve it by iteration: start with R = Cᵢ, compute the right side, and repeat with the new value. A longer window may let in more higher-priority releases, which lengthens it again. The value only grows, so it either repeats (that is the worst-case response time) or passes Dᵢ (the task can miss, stop). For independent tasks with D ≤ T this test is exact: pass means it never misses, fail means the critical instant really makes it late.
Real systems add terms to the same equation: a blocking term B for the longest time a lower-priority task can hold a shared lock (see real-time operating systems for why that must be bounded), release jitter, and the cost of context switches.
- Exact for independent tasks with D ≤ T
- Extend with blocking, jitter and switch costs
Response time analysis, then rate monotonic vs deadline monotonic
from math import ceil
def response_times(tasks, order):
ok = True
for k, name in enumerate(order):
c, _, d = tasks[name]
r, seq = c, [c]
while True:
# interference: every release of a higher-priority task inside the window r
nxt = c + sum(ceil(r / tasks[h][1]) * tasks[h][0] for h in order[:k])
if nxt == r:
break
seq.append(nxt)
r = nxt
if r > d:
break # already late, no need to iterate further
verdict = f"<= {d} ok" if r <= d else f"> {d} MISS"
ok = ok and r <= d
print(f" {name}: {' -> '.join(map(str, seq))} {verdict}")
return ok
def check(title, tasks, rule):
key = 1 if rule == "rate monotonic" else 2 # order by period or by deadline
order = sorted(tasks, key=lambda n: tasks[n][key])
print(f"{title}, {rule} order {' '.join(order)}")
print(" schedulable" if response_times(tasks, order) else " not schedulable")
tasks = {"A": (1, 4, 4), "B": (2, 6, 6), "C": (3, 8, 8)} # name: (C, T, D)
check("D = T", tasks, "deadline monotonic")
tasks["C"] = (2, 8, 5) # lighter, but must finish within 5 of its release
check("C has D = 5", tasks, "rate monotonic")
check("C has D = 5", tasks, "deadline monotonic")#include <algorithm>
#include <cstdio>
#include <string>
#include <vector>
struct Task { char name; int c, t, d; };
bool responseTimes(const std::vector<Task>& order) {
bool ok = true;
for (size_t k = 0; k < order.size(); k++) {
const Task& me = order[k];
int r = me.c;
std::string seq = std::to_string(r);
while (true) {
int next = me.c; // interference: every release of a higher-priority task inside the window r
for (size_t h = 0; h < k; h++) next += (r + order[h].t - 1) / order[h].t * order[h].c;
if (next == r) break;
seq += " -> " + std::to_string(next);
r = next;
if (r > me.d) break; // already late, no need to iterate further
}
ok = ok && r <= me.d;
std::printf(" %c: %s %s %d %s\n", me.name, seq.c_str(), r <= me.d ? "<=" : ">", me.d, r <= me.d ? "ok" : "MISS");
}
return ok;
}
void check(const char* title, std::vector<Task> tasks, bool rateMonotonic) {
std::stable_sort(tasks.begin(), tasks.end(), [&](const Task& a, const Task& b) {
return rateMonotonic ? a.t < b.t : a.d < b.d; // order by period or by deadline
});
std::printf("%s, %s order", title, rateMonotonic ? "rate monotonic" : "deadline monotonic");
for (const Task& k : tasks) std::printf(" %c", k.name);
std::printf("\n");
bool ok = responseTimes(tasks);
std::printf("%s\n", ok ? " schedulable" : " not schedulable");
}
int main() {
std::vector<Task> tasks = {{'A', 1, 4, 4}, {'B', 2, 6, 6}, {'C', 3, 8, 8}};
check("D = T", tasks, false);
tasks[2] = {'C', 2, 8, 5}; // lighter, but must finish within 5 of its release
check("C has D = 5", tasks, true);
check("C has D = 5", tasks, false);
}import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;
public class Main {
record Task(char name, int c, int t, int d) {}
static boolean responseTimes(List<Task> order) {
boolean ok = true;
for (int k = 0; k < order.size(); k++) {
Task me = order.get(k);
int r = me.c();
StringBuilder seq = new StringBuilder(String.valueOf(r));
while (true) {
int next = me.c(); // interference: every release of a higher-priority task inside the window r
for (int h = 0; h < k; h++) next += (r + order.get(h).t() - 1) / order.get(h).t() * order.get(h).c();
if (next == r) break;
seq.append(" -> ").append(next);
r = next;
if (r > me.d()) break; // already late, no need to iterate further
}
ok = ok && r <= me.d();
System.out.printf(" %c: %s %s %d %s%n", me.name(), seq, r <= me.d() ? "<=" : ">", me.d(), r <= me.d() ? "ok" : "MISS");
}
return ok;
}
static void check(String title, List<Task> tasks, boolean rateMonotonic) {
List<Task> order = new ArrayList<>(tasks);
order.sort(Comparator.comparingInt(rateMonotonic ? Task::t : Task::d)); // by period or by deadline
StringBuilder names = new StringBuilder();
for (Task k : order) names.append(' ').append(k.name());
System.out.println(title + ", " + (rateMonotonic ? "rate monotonic" : "deadline monotonic") + " order" + names);
System.out.println(responseTimes(order) ? " schedulable" : " not schedulable");
}
public static void main(String[] args) {
List<Task> tasks = new ArrayList<>(List.of(new Task('A', 1, 4, 4), new Task('B', 2, 6, 6), new Task('C', 3, 8, 8)));
check("D = T", tasks, false);
tasks.set(2, new Task('C', 2, 8, 5)); // lighter, but must finish within 5 of its release
check("C has D = 5", tasks, true);
check("C has D = 5", tasks, false);
}
}Step through it
Running on A (1 every 4), B (2 every 6), C (3 every 8) · then C = 2 ticks due within 5
Worked Example: One Set, Two Versions
The EDF lesson uses the same tasks: A (C 1, T 4), B (C 2, T 6), C (C 3, T 8), with D = T and U = 23/24. Ranked A, B, C: R(A) = 1, R(B) = 2 → 3. For C the window grows 3 → 6 → 7 → 9, and 9 is past its deadline of 8. The timeline shows C actually finishing at 10. No fixed ranking saves this set, while earliest deadline first scheduling meets every deadline on it.
Now make C 2 ticks but due within 5. Rate monotonic keeps C last because its period is longest: 2 → 5 → 6, past 5. Deadline monotonic ranks A (4), C (5), B (6): R(C) = 2 → 3, and B, now last, goes 2 → 5 → 6, exactly on its deadline. Same tasks, same load, only the ranking changed.
- D = T: C fails, R = 10 > 8, under RM and DM alike
- C due within 5: RM fails C (6 > 5), DM passes all three
Deadline Monotonic vs EDF
Deadline monotonic against EDF is the trade between a fixed ranking and a moving one. EDF reorders jobs by absolute deadline and fits more work: with D = T it is safe up to U = 1, while the shared set already defeats every fixed ranking at 0.958. Deadline monotonic keeps the strengths of fixed priority: a simple dispatcher, fewer preemptions, and predictable overload, where only the lowest-ranked task misses.
That last point is why automotive and avionics software mostly runs fixed-priority preemptive scheduling checked with response time analysis: the AUTOSAR OS standard is built on fixed priorities, and certification wants a worst case you can prove task by task.
| Version of the set | Rate monotonic | Deadline monotonic | EDF |
|---|---|---|---|
| D = T, U = 0.958 | C late | C late | All met |
| C: 2 ticks, D 5, U = 0.833 | C late | All met | All met |
| C: 4 ticks, U = 1.083 (overload) | Only C late | Only C late | A, B and C late |
- EDF fits the most work
- Deadline monotonic is the best fixed ranking and fails safely under overload