Q&A-1Classify timing requirements for an embedded product.
Answer
Core answer. Classification is a property of the contract between an event and its physical consequence, not of the component that handles it. For each event I ask four things: what triggers it, what result it must produce, the deadline by which that result is useful, and what happens physically if it is late. Then:
- Hard: a missed deadline is itself a failure. The result has no value after the deadline and the miss is a fault. Motor commutation, airbag firing, ABS pressure control.
- Firm: the result is worthless after the deadline, but a bounded miss rate is acceptable. A dropped frame, a sensor sample re-derived next cycle.
- Soft: the result still has value late, degraded. UI refresh, telemetry log.
The class decides the analysis and the verification method, which is why it cannot come from component names. Hard tasks need worst-case analysis (WCET, response-time analysis, a utilization bound) with no probabilistic argument. Firm tasks are specified as a deadline-miss ratio and can be measured statistically. Soft tasks are specified as a percentile latency.
| Event | Arrival | Deadline | Jitter budget | Miss tolerance | Class |
|---|---|---|---|---|---|
| Motor current control | periodic, 100 µs | 100 µs (same period) | ±5 µs | 0 | Hard |
| IMU fusion | periodic, 10 ms | 10 ms | ±200 µs | 1e-3 | Firm |
| Telemetry log | periodic, 1 s | 1 s | ±50 ms | 1e-2, stale 5 s | Soft |
Why the class changes the method. Three periodic tasks with C/T = 0.30, 0.30, 0.25 give U = 0.85. Rate-monotonic's utilization bound for n = 3 is 3(2^(1/3) − 1) ≈ 0.78, so RM gives no guarantee at U = 0.85; EDF's bound is 1.0, so EDF is still feasible. A hard classification forces you to pick the scheduler that matches the bound, not the other way round. Firm and soft tasks can be overbooked and their misses counted.
Budgeting. A 10 ms sensor-to-actuator path: sensing 1.0, bus 0.5, scheduling delay 0.5, compute 3.0, actuation 1.0 = 6.0 ms, leaving 4.0 ms margin. Jitter adds along the chain: end-to-end jitter is the sum of per-stage jitter, so a ±200 µs budget across five stages gives each stage roughly ±40 µs.
Failure modes and detection.
- Priority inversion. A low-priority task holds a shared I2C mutex; the 1 ms motor task blocks, misses its deadline, current is not updated, overcurrent trips. Detect with a per-task deadline-overrun counter; fix with priority inheritance or a priority-ceiling protocol.
- Overload. Arrival rate exceeds design. Hard tasks must still meet deadlines, so the overload response is to shed firm and soft work first. Detect with queue-depth and utilization monitors.
- Jitter accumulation. Control-loop phase margin degrades once actuation jitter exceeds budget. Detect by timestamping at each stage and logging the end-to-end distribution.
When not to classify this way. Do not classify by safety integrity level. A hard real-time task can be low ASIL (a display refresh with a hard deadline) and a soft task can be high ASIL. ASIL drives the safety mechanism; the deadline contract drives the timing class. And calling something hard when you cannot defend a zero miss rate forces expensive WCET analysis for no benefit, if 1e-3 misses are tolerable, say so and measure it.
Curated: · Written: · Reviewed:
Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.