How do you make sure a real-time system always meets its deadlines?
What the interviewer wants to hear
- Identify tasks with period, deadline and worst-case execution time
- Priority assignment such as rate-monotonic
- Schedulability analysis: utilisation bounds and response time analysis
- Account for interrupts, blocking and jitter
- Measure WCET and timing on real hardware with margins
Model answer
First I list every task and interrupt with its period or minimum inter-arrival time, deadline and worst-case execution time. WCET comes from measurement on the real target with caches and worst-case inputs, plus margin, or from static analysis tools for safety-critical work. Then I assign priorities, typically rate-monotonic, where shorter periods get higher priority, or deadline-monotonic if deadlines are shorter than periods. For a quick check, the Liu and Layland bound says that n tasks are schedulable under rate-monotonic if total utilisation is below n times (2 to the power 1/n minus 1), about 69% for many tasks. A more exact method is response time analysis, which adds each task's execution time, interference from higher-priority tasks and interrupts, and blocking time from shared resources. I keep critical sections short and use priority inheritance. Finally I verify on hardware by toggling GPIOs and measuring with an oscilloscope or tracing tools like SEGGER SystemView.
Can you answer it under time pressure?
Take a timed hard round and get scored on every answer.
More hard Embedded Systems Engineer questions
- Design the firmware for a battery-powered sensor that must run for 5 years on a coin cell and report data every 15 minutes.
- How would you secure an IoT device's firmware against tampering and cloning?
- How do you build a strong automated testing strategy for embedded firmware?
- How do you choose a microcontroller for a new product?
- Design a secure, fail-safe over-the-air firmware update system for a fleet of IoT devices.
- You receive the first prototype of a new custom board. How do you bring it up?
- What changes when you write firmware for a safety-critical product, such as automotive or medical?
- How do you safely share data between interrupt handlers and tasks while keeping interrupt latency low?
- A variable is randomly overwritten in devices running in the field, but you cannot reproduce it on your desk. How do you find the cause?