RTOS fundamentals for firmware engineers
A real-time operating system coordinates work with timing requirements. A higher priority does not guarantee a deadline: a task can block on a resource, wait for input or be delayed by interrupt execution. Learn the scheduling model and ownership rules before memorizing any particular kernel API.
1. Think in tasks, events and deadlines
A ready task can be selected by the scheduler; a blocked task must wait. Avoid an unbounded polling loop when work can be expressed as a bounded event-driven transition. Measure response time separately from throughput.
Free reading
2. Pass work out of an interrupt
Keep the interrupt path bounded. Use a documented ISR-safe notification or queue and defer longer processing. A ring buffer requires clear producer/consumer ownership and appropriate target-specific synchronization.
Free reading
3. Protect shared resources
A mutex protects an invariant spanning shared state. Priority inheritance can reduce blocking caused by a medium-priority task preempting a lock holder; it does not prevent deadlock or guarantee every deadline.
Free reading
4. Publish data correctly
C11 acquire/release ordering can publish ordinary data under the right ownership protocol. Volatile alone cannot synchronize threads. DMA and noncoherent memory require additional target-specific rules.
Free reading
5. Verify timing and recovery
Use unit tests for deterministic state transitions and target measurements for interrupt latency, stack usage and worst-case execution. Treat timeouts, queue overflow and missed deadlines as explicit outcomes.
Free reading
Check your understanding
Explain what happens when a high-priority task waits on a mutex held by a low-priority task and a medium-priority task becomes ready. Then describe why a binary semaphore and an inheriting mutex are not interchangeable.
Other learning paths
All linked articles, public practice and lesson overviews are free. The full interactive course is optional and paid.