What is real-time operating systems (RTOS)?

Why Interviewers Ask This

This is a differentiating question used for senior and lead roles. Interviewers want to see if you can explain not just what happens, but why — and what the trade-offs are in different approaches.

Answer

A Real-Time Operating System (RTOS) is an OS designed to serve real-time application requests and process data as it comes in, typically without delays (latency guarantees). The defining characteristic is deterministic timing — the system must respond to events within guaranteed time bounds. Hard real-time: missing a deadline is catastrophic failure. Examples: aircraft flight control (fail = crash), airbag deployment (100ms window), nuclear reactor control, anti-lock braking systems, pacemakers. The system MUST meet every deadline, guaranteed. Soft real-time: missing a deadline is undesirable but not catastrophic. Quality degrades but system continues. Examples: video streaming (dropped frames = quality degradation), online gaming (latency spike = gameplay stutter), audio processing. Firm real-time: missing deadline makes the result useless but not dangerous. Example: weather radar processing (stale data is useless but not dangerous). RTOS characteristics: deterministic interrupt latency (bounded, predictable); priority-based preemptive scheduling with bounded preemption delays; minimal OS jitter; small footprint (embedded systems); often fixed-priority scheduling (Rate Monotonic, Earliest Deadline First); limited or no memory swapping (paging causes unpredictable delays); priority inheritance to prevent inversion. Popular RTOS: FreeRTOS (microcontrollers — Arduino, ESP32), VxWorks (aerospace, defense), QNX (automotive, medical — Blackberry phones), RTEMS, Zephyr (IoT), RT-Linux (Linux with realtime patch). PREEMPT_RT Linux: Linux kernel patches for real-time behavior — all spinlocks converted to sleeping locks, preemptible interrupt handlers. Latency: typically 50-100μs guaranteed. Used in manufacturing, audio, robotics.

Common Mistake

Rushing to answer is a common mistake. Take two seconds to structure your response: definition → example → trade-off. This structure makes complex Operating Systems answers easy to follow.