Definition
A real-time system is a computing system whose correctness depends on when a result takes effect as well as on what the result is. Each piece of work must finish by a deadline: the latest time at which its result is still acceptable. Requirements are classed by the cost of a miss: hard when a miss can cause failure or harm, firm when a late result is worthless but occasional misses are tolerated, and soft when a late result keeps some value. Real-time means predictable, not fast.
The idea
An airbag controller decides correctly to fire the airbag, but the decision arrives after the occupant has already struck the steering wheel. The computation was right and the system failed. A video player that decodes a frame too late to show it drops the frame, and the picture stutters. A weather display that updates a little late harms nobody. The same lateness is a catastrophe, a degradation or nothing, depending on what the result is for.
A real-time requirement therefore has two parts: a time limit for each piece of work, and a statement of what a miss costs. The second part decides what evidence is needed. A hard requirement needs an argument that the worst case meets the deadline, because a single miss is a failure. A soft requirement can be judged from measured distributions, because an occasional miss only lowers quality. Speed alone gives neither: a system that is fast on average can still be slow at the one moment that matters.
How it works
The vocabulary:
Job: one execution of a piece of work, for example one run of a control loop.
Task: the recurring source of jobs, for example the control loop as a whole.
Release time : the moment a job becomes ready to run, usually when the event that triggers it arrives.
Relative deadline : the time allowed from release to the required effect.
Absolute deadline : the clock time by which the job must be done.
Finishing time : the moment the job’s required effect happens, for example when the actuator receives the command, not when some function returns.
Response time §9.32 , and lateness . Negative lateness means the job finished early.
Worst-case execution time (WCET) §9.33: an upper bound on the processor time that one job needs when it runs without interruption.
A real-time requirement is set up and checked in this order.
Name the event that releases each job and the effect that completes it.
Set the relative deadline from the physics or the service: how long after the event the effect is still useful.
Classify a miss as hard, firm or soft.
Bound the load: how often jobs can be released, for example a minimum time between two releases, and the WCET of each job.
Show that every job meets its deadline (hard), that misses stay within the tolerated pattern (firm), or that the distribution of lateness stays within the stated bound (soft). For a hard requirement this means computing the worst-case response time: the job’s own execution time plus all the time the job can spend waiting for higher-priority work, for locks held by other threads, for interrupt handlers §6.12 and for devices. A real-time operating system (RTOS) helps here, because its priority scheduling and bounded kernel operations make that waiting time calculable.
Worked example
A task is released every 20 ms, at ms, and each job has the relative deadline ms. The five jobs finish at ms. All times are in milliseconds:
| Job | response | lateness | |||
|---|---|---|---|---|---|
| 1 | 0 | 8 | 5 | 5 | |
| 2 | 20 | 28 | 26 | 6 | |
| 3 | 40 | 48 | 52 | 12 | |
| 4 | 60 | 68 | 67 | 7 | |
| 5 | 80 | 88 | 86 | 6 |
The average response time is ms, below the 8 ms deadline. Yet job 3 finished at 52 ms, ms after its absolute deadline. The average hides exactly the job that matters.
What the miss means depends on the task.
Hard. If each job commands a brake actuator, job 3 is a system failure. The design must change until the worst-case response time is at most 8 ms.
Firm. If each job decodes a video frame, frame 3 arrives too late to show and is dropped. A requirement of at most 1 dropped frame in any 5 consecutive frames is met by this trace: it has exactly 1 miss in its 5 jobs.
Soft. If each job refreshes a display, and the value of a refresh falls in a straight line from 1 at the deadline to 0 at 10 ms after the deadline, job 3 is worth . The five jobs together are worth out of a possible 5.
Stated precisely
For job , let be its release time, its relative deadline, its absolute deadline, and the time at which its required effect happens, all in the same unit. Job meets its deadline exactly when Its lateness is , and its tardiness, the amount by which it was late, is .
The three classes are three kinds of requirement over all jobs.
Hard: for every job that the system can ever release. This is a claim about the worst case, so it rests on four named assumptions: a bound on how often jobs are released, a WCET bound for every job, a bound on every source of waiting, and a fault model §1.30 that states which hardware faults are excluded.
Firm: a late job’s result is discarded, and the misses are bounded, for example by requiring that at least of any consecutive jobs meet their deadlines, called an -firm constraint.
Soft: a late result is still used, and the requirement bounds a statistic of tardiness, such as its mean or its 99th percentile §11.16, or bounds the total value under a value function that falls as lateness grows.
The periodic task model of Liu and Layland (1973) is the classic setting for hard requirements: each task releases a job every time units, each job needs at most units of processor time, and each deadline equals the period, .
Limits and common mistakes
Real-time does not mean fast. A system that always answers within 100 ms meets a 100 ms hard deadline; a system that usually answers in 1 ms but occasionally takes 200 ms does not.
The largest response time seen in tests is not the worst case, because tests exercise only the paths and timings that happen to occur. A hard claim needs an analysis that covers every case the assumptions allow, and it is only as strong as those assumptions: if jobs arrive more often than assumed, or a fault outside the fault model occurs, it says nothing.
Using an RTOS does not make a system real-time. The RTOS bounds its own overheads; the application’s execution times, priorities, locks and devices decide whether deadlines are met.
The deadline must name the effect. A job that has handed a command to a queue has not yet moved the actuator, so a response time measured to the hand-off understates the true one.
A timeout §9.34 is not a deadline. A timeout says when a waiting party stops waiting; the work itself may continue, and enforcing a timeout makes no work finish on time. The entry on deadlines and timeouts treats the difference.
The class belongs to each requirement, not to the whole system. One device can have a hard deadline for a motor command, a firm one for a radio reply and a soft one for its display.
Questions answered
Is a missed deadline catastrophic, degraded, or merely inconvenient?
Whether a missed deadline is catastrophic, degrading or merely inconvenient depends on what the result is for, and each real-time requirement must state which of the three applies. A missed deadline is catastrophic in a hard real-time requirement, where a late result can cause failure or harm, such as a late brake command; no miss is acceptable, and the worst-case response time must be shown to fit the deadline. It degrades the service in a firm real-time requirement, where a late result is worthless and discarded but occasional misses are tolerable, such as a video frame that arrives too late to show; the requirement bounds how many misses may occur, for example at most one in any five consecutive jobs. It is merely inconvenient in a soft real-time requirement, where a late result still has some value, such as a slow display update; the requirement bounds a statistic of lateness, such as the 99th percentile of the response time.
The application decides the class, not the operating system and not the average speed. The class in turn decides the evidence needed: a worst-case argument for hard, a bound on the pattern of misses for firm, and a measured distribution for soft.
Related entries: Deadline versus timeout (§9.34), Schedulability (§9.37), Worst-case execution time (WCET) (§9.33), Response time versus execution time (§9.32), Fixed-priority response-time analysis (§19.4.7), Zephyr RTOS (§6.33). Further reading: [86].