Skip to content
Tech Interview Prep
Technical interview guide

Real-Time Embedded Systems

Why robotics software has hard timing deadlines that general-purpose software doesn't, and how real-time systems guarantee them.

Minutes to read
4
Practice MCQs
25
Interview Q&A
25
Edition
v5
Editorial status
Reviewed

Scope: Current FreeRTOS, Zephyr, CMSIS-RTOS2, Arm Cortex-M, Linux real-time, Embedded Rust, SEI CERT C, IEC functional-safety, NIST firmware resiliency, and Renode references reviewed 2026-09-04.

Overview

Curated: · Written: · Reviewed:

Real-Time Embedded Systems

In one line

Real-time means bounded: every job must finish before its deadline in the worst case, not on average. Reach for it whenever a late result changes physical behaviour, and prove the bound with worst-case analysis on target hardware, not with a benchmark.

Key definitions

  • Hard real-time: a missed deadline is a system failure (PWM update, attitude loop).
  • Firm real-time: a late result is discarded; the system survives.
  • Soft real-time: value decays with lateness (telemetry, UI).
  • WCET: upper bound on one job's execution time on this hardware, with this cache state and these inputs.
  • Blocking (B): time a task waits on a lock held by a lower-priority task.
  • Jitter: variation in latency or response time across events.

Formulas and complexity

Response-time analysis, iterated until R_i converges or exceeds D_i:

Ri=Bi+Ci+∑j∈hp(i)⌈RiTj⌉CjR_i = B_i + C_i + \sum_{j \in hp(i)} \left\lceil \frac{R_i}{T_j} \right\rceil C_j

The task set is schedulable when R_i is at most D_i for every task. Rate-monotonic assigns higher priority to shorter periods (deadline equals period). EDF can reach 100% utilization for independent preemptible tasks; fixed priority cannot.

How it works

The delay from event to effect is a pipeline, and each stage has its own owner and fix.

Hardware edge Interrupt latency ISR: ack, timestamp, enqueue Scheduler: context switch Task WCET Output and DMA transfer Physical effect
  • The preemptive scheduler always runs the highest-priority ready task, so higher-priority interference is analyzable.
  • ISRs stay short. Variable work goes to a task through an ISR-safe queue or event flag.
  • A low-priority lock holder blocks a high-priority task. Priority inheritance bounds that blocking to the critical section length.
  • A watchdog turns hangs into resets. It only protects you if it is fed by evidence that the control loop progressed.

When to use and when not to

OptionChoose whenWatch out for
Fixed priority (RM/DM)Periods are fixed and each task must be analyzed on its ownAdding a task can break schedulability; overload hits low-priority tasks first
EDFYou need near-full utilization or deadlines vary per jobOne overload cascades misses across tasks; harder to certify
Bare-metal superloop with ISRsFew tasks and one deadline pathEvery new path reopens the timing analysis by hand
Full RTOSMany tasks, blocking IPC, need for inheritanceAdds scheduler overhead and lock behaviour to analyze
Heap allocation on the control pathAlmost neverFragmentation makes malloc latency unbounded

Traps interviewers probe

  1. "Real-time means fast." Fix: state the bound and what a miss does. A guaranteed 100 ms response can be real-time; a 1 ms average with a 500 ms tail is not.
  2. Benchmarks as WCET. Fix: measure with adversarial inputs and cold and warm caches, add margin, and use response-time analysis for the bound. Samples can fail to disprove a bound, but they cannot establish one.
  3. Unbounded priority inversion. Fix: priority inheritance or a priority ceiling, short critical sections, and no blocking calls inside locks. Mars Pathfinder reset repeatedly until inheritance was enabled on the bus mutex.
  4. Watchdog fed from a timer tick. Fix: feed only after checking that the control loop and its inputs progressed. A tick-fed watchdog hides a dead loop.
  5. Adding a task without re-running analysis. Fix: repeat the response-time calculation for every task whose interference changed, then check margin.

Interview tips

Opening: classify the task by the consequence of a miss, then name the bound. For example: "This is hard real-time. A miss means the PWM update is late, so I need a WCET and a worst-case response time below the period."

Expect these follow-ups:

  • How do you prove the task set is schedulable? (Response-time analysis with blocking and interference, on target hardware.)
  • What is priority inversion and why does inheritance fix it? What does inheritance cost?
  • Where does the time go between a sensor edge and the actuator? (Interrupt latency, ISR, context switch, task, output.)
  • How do ISR and task share data safely? (Atomics or a critical section, plus explicit buffer ownership.)
  • How do you handle DMA and cache coherency? (Clean or invalidate at ownership transfers, and barriers.)
  • How does the watchdog know the system is healthy?

30-second outline:

  1. Classify the task by what a miss physically causes.
  2. Name the bound: WCET plus blocking plus higher-priority interference.
  3. Say how you prove it: response-time analysis, adversarial inputs, cold and warm caches, margin.
  4. Name the risks: unbounded inversion, ISR overrun, heap use on the control path, a watchdog that hides a hang.
  5. Say what you watch in the field: deadline-miss counters, reset causes, queue depth, stack margin.

Feedback on this overview

Log in free to save your progress and keep bookmarks and notes for a quick revision before your interview.