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.

Read
45 min
Practice MCQs
25
Interview Q&A
25
Edition
v4
Editorial status
Reviewed
Relevant for
Robotics Engineer

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.

Curated: · Written: · Reviewed:

25 questions

MCQ-1A drone's attitude-control loop runs every 2.5 ms with a measured worst-case execution time of 1.8 ms; a missed deadline lets the aircraft tumble. A logging task on the same single-core board has a 200 ms deadline, and a miss just drops that log entry while the flight continues. Which classification is correct?
MCQ-2A control task runs on a Cortex-M7 board. The team measures it over 10 million runs with interrupts disabled and the instruction cache pre-warmed, recording a mean of 96 µs and a maximum of 412 µs, and sets the deadline at 500 µs. In the field the task occasionally misses that deadline. Which explanation fits the measurements?
MCQ-4A 10 ms periodic control task is measured over 10,000 periods. The trace shows 9,850 completions by 6 ms, 120 between 6 and 9 ms, 25 between 9 and 10 ms, and 5 between 12 and 18 ms. The team reports mean response time 3.6 ms and CPU utilization 63%. Which conclusion about the deadline is supported?
MCQ-3A team is assigning fixed priorities on a single core. The task set is independent and preemptible with bounded worst-case execution times: a 4 ms control loop, a 10 ms sensor poll, and a network handler that fires on packet arrival with no known bound on inter-arrival time. Which statement about applying rate-monotonic priority assignment is correct?
MCQ-5A single-core preemptive system with no scheduling overhead runs three jobs under earliest-deadline-first. J1 is released at t = 0 with execution time 2 ms and deadline 20 ms. J2 is released at t = 1 with execution time 3 ms and deadline 10 ms. J3 is released at t = 2 with execution time 2 ms and deadline 6 ms. When does J2 complete?
MCQ-6A preemptive fixed-priority RTOS runs H (priority 5), M (priority 3), and L (priority 1). L holds a plain mutex (no priority inheritance) for a sensor read. H becomes ready and blocks on that mutex. While L still holds it, M becomes ready. H then misses its deadline. Which sequence explains the missed deadline?
MCQ-7A Cortex-M4 board runs a 168 MHz control loop. A timer ISR at priority 2 takes 3 µs of handler work. A UART ISR at priority 1 (numerically lower, so it preempts) fires every 500 µs and runs for 40 µs. The timer ISR is asserted while the UART ISR is executing. Measured worst-case latency from timer assertion to the first instruction of the timer handler is about 43 µs, far above the 3 µs handler time. What explains the gap?
MCQ-10A Cortex-M0 firmware declares `volatile uint32_t g_ticks = 0;`. The SysTick handler is `g_ticks++;`. The main loop runs five iterations, each doing `g_ticks++;` followed by a delay long enough for SysTick to fire exactly once. A logic-analyser trace shows the handler running between the main loop's load and store in iterations 1, 3 and 4, and after the store in iterations 2 and 5. What does `g_ticks` read after the fifth iteration?
MCQ-9A Cortex-M4 board runs a 1 kHz timer ISR that executes `g_ts += 1000;` on a `uint64_t g_ts` counting microseconds. The main loop reads `g_ts` to timestamp log lines, and the device must stay monotonic for days. Every few minutes a log line is stamped about 71 minutes in the future. Which change removes the bad timestamps?
MCQ-16A 16-bit hardware timer free-runs upward at 1 µs per tick and wraps at 65,536. A C task records start = 0xFFF0 and then polls until (uint16_t)(now - start) >= 0x0020, where now is the live counter value. The counter wraps while the task waits. What does the code do?
MCQ-18A 32-bit status register at offset 0x10 has these fields: bits 0-3 are an interrupt-flag field where writing a 1 clears the flag and writing a 0 leaves it unchanged; bits 4-7 are reserved and read as 0; bits 8-15 are a read-only error counter; bits 16-31 are a read/write threshold. The driver wants to set the threshold to 0x0042 while leaving the interrupt flags untouched. The current register value read back is 0x0000_000F. Which write should the driver perform?
MCQ-15A 3.3 V MCU controls a 24 V motor through a gate driver. The driver's enable input is active high and has an internal 100 kΩ pull-up to 3.3 V; the board has no external pull-down on that net. The MCU's GPIOs reset to high-impedance input. The brownout detector trips at 2.7 V. A brownout at 2.9 V resets the MCU; the reset-cause register reads BOR. Startup code takes 1.2 ms before it configures the enable GPIO as output low. During that 1.2 ms, what is the motor doing?
MCQ-19An STM32L4 node sleeps in Stop 2 between samples. The RTC wakeup timer fires every 100 ms; the ISR reads a thermocouple over SPI and then starts a LoRa transmit. The datasheet gives 5 µs wakeup from Stop 2 and states that peripheral clocks are gated in that mode. After the change, average current falls from 1.2 mA to 18 µA, but about 1 sample in 20 returns the previous reading and some LoRa packets start mid-SPI-transfer. What is the correct fix?
MCQ-14A firmware team kicks the watchdog from the 10 ms hardware timer ISR that drives the control loop. Soak tests pass, but a field unit whose I2C sensor driver blocks forever on a bus that never returns never resets: the ISR keeps kicking while the control loop is dead. Which source should be allowed to kick the watchdog?
MCQ-17A Cortex-M7 system has a 32-byte D-cache line and a 1536-byte Ethernet receive buffer in cacheable SRAM. The CPU read the same buffer for the previous frame. DMA writes a new 1536-byte frame into the buffer and sets the completion flag. The CPU then reads the buffer and gets the previous frame's bytes in all 1536 positions. What should have been done before the CPU read the buffer?
MCQ-11A driver on a weakly ordered ARMv8 core writes a 16-byte DMA descriptor into a Normal Non-cacheable coherent buffer at 0x4000_1000, then writes 1 to the NIC's doorbell register at 0x4000_2000 (Device-nGnRnE); the NIC fetches the descriptor when the doorbell write arrives. Under load, roughly 1 run in 10^5 the NIC DMAs from the previous buffer address 0x7F00_0000 instead of the new 0x8000_0000, even though the two stores are in program order in the driver source. Which change fixes it?
MCQ-8A sensor node streams about 90 kB/s over a UART at 921600 baud, 8N1, on an 80 MHz Cortex-M4; the protocol fixes that rate and nothing slower is acceptable. The UART has a one-byte receive register and no FIFO. The receive ISR reads the data register, clears the error bits and pushes the byte into a lock-free ring buffer: 70 cycles. On every 128th byte it also maps the frame into a 128-byte struct (4000 cycles) and runs a bitwise CRC-16 (4000 cycles); both must run for every frame. In the field the overrun flag is set once per frame, and instrumentation shows it is always set while the frame-mapping code is executing, never in the byte-read path. Frames arrive truncated. Which change removes the overruns?
MCQ-12A motor controller samples phase current at 1 kHz in a timer ISR and pushes each sample into a statically allocated 8-entry queue. A lower-priority task drains the queue and recomputes the PWM duty from the newest sample it finds; the loop overshoots if it acts on current more than a few milliseconds old. During a 150 ms flash-sector erase the drain task is blocked, and the ISR finds the queue full. SRAM is exhausted, so the queue cannot grow. What should the ISR do?
MCQ-22A 168 MHz Cortex-M4 runs a 1 kHz control ISR that fires every 1 ms. Each firing writes one 16-byte trace record into a 4096-byte ring buffer. A low-priority task drains the buffer to a UART configured 115200 8N1, which costs 10 bits per byte on the wire. The ISR never blocks, and the task runs whenever the ISR is not executing. Roughly how long until the buffer is full?
MCQ-23An RTOS device samples a sensor in an ISR that posts one 32-byte record to a 64-entry queue every 1 ms; a worker task drains the queue. Over a 10-minute run: average CPU utilization 38%, worker service time 0.3 ms typical and 1.4 ms worst case, queue high-water mark 64 (full), and the ISR dropped 412 records. Which conclusion does the data support?
MCQ-13An embedded motor controller runs a control task every 1 ms, and the task must complete within 800 µs. Its non-allocation work takes 300 µs. Each cycle it mallocs a variable-length CAN frame buffer and frees it. Benchmarks show malloc/free at a 2 µs median and a 15 µs p99. After about 30 minutes of runtime the task starts missing deadlines; traces of the offending cycles show 700–950 µs inside malloc, and the heap's free list has grown to roughly 4,000 fragments. Live data at any instant is about 2 KB of a 64 KB heap. Which conclusion does the trace support?
MCQ-25On a port where ISRs run on the current task's stack, a motor-control task calls a filter library up to nine frames deep and can be preempted twice before it finishes. Which method bounds the stack it needs in the worst case?
MCQ-20A fleet of BLE sensors runs a two-slot updater. Slot A (0x08020000) holds the factory image; slot B (0x08060000) is the update target. The bootloader reads a 16-byte metadata record at 0x0800F000: if the first word is the magic 0x5A5A5A5A and the state field is REVERT, it boots slot A; in every other case, including an erased sector reading 0xFFFFFFFF, it boots slot B. The bootloader does not verify the image in the slot it boots, and the app does no self-check. The updater erases the metadata sector, streams the 200 KB image into slot B at about 7 KB/s, then writes the record with state = PENDING. A unit loses power 12 s into the download; the watchdog resets the MCU after 2 s without a kick. What happens on the next boot?
MCQ-21A team proposes an over-temperature trip as the safety function that prevents winding fire. Its requirements come from the hazard analysis, it has two independent sensor channels, it passes its self-test, and it meets its timing budget. It runs in the same firmware image on the same MCU as the speed loop, and both are fed by the same regulator. The assessor rejects the proposal. What decides the rejection?
MCQ-24A team's 10 kHz field-oriented-control loop passes all unit tests, where the ADC and PWM drivers are mocked. On the bench with a real motor it is stable to 4,000 rpm, but the bench motor cannot reach the 9,000 rpm where vehicle logs show an overcurrent trip. Scope traces show the ADC end-of-conversion interrupt arriving up to 1.5 µs late relative to the PWM carrier, a phase relationship the mock never modeled. The dynamometer is booked for six weeks and the vehicle build is in two. What is the most useful next step?