RTOS Fundamentals

Design, analyse and debug multitasking firmware with a real-time operating system

Learn when an RTOS is worth its cost and how to use one well. Covers scheduling and context switching, task states and stack sizing, queues, semaphores, mutexes and notifications, priority inversion and deadlock, interrupts and timing, rate monotonic analysis, memory allocation, tracing and choosing a kernel.

Intermediate · 5 modules · 17 lessons · free certificate

About this course

A real-time operating system lets firmware run several activities with different deadlines without hand-crafted state machines, but it brings new ways to fail: stacks that overflow silently, tasks that starve, priority inversion, deadlock and interrupts that corrupt the kernel. This course explains how a preemptive priority scheduler really behaves and turns that understanding into design rules you can apply and review, with the limits of each rule stated.

You will learn when a super loop or event-driven design is enough, how tasks, the tick and context switches work, how to divide a system into tasks and assign priorities, how to size stacks by measurement, and how to choose between queues, semaphores, mutexes, event flags and direct task notifications. Later modules cover deferring work from interrupts, interrupt priorities relative to the kernel, delays and software timers, rate monotonic scheduling with the Liu and Layland bound, static and dynamic allocation, tracing and run-time statistics, and a neutral overview of common kernels. FreeRTOS and Zephyr are used for concrete examples, and the ideas carry over to other kernels.

The course assumes the material in Embedded Firmware Fundamentals and Embedded C for Microcontrollers. It does not teach a specific vendor's tools or a full formal real-time analysis, and it does not cover embedded Linux, which is the subject of Embedded Linux Essentials, or security and update mechanisms, covered in Secure Boot and Firmware Updates.

Before you start: Comfortable writing C for a microcontroller, including interrupts, volatile and shared data. Embedded Firmware Fundamentals covers the background, and Embedded C for Microcontrollers is useful. No previous RTOS experience is needed.

What you will learn

  • Decide whether a product needs an RTOS, an event-driven design or a super loop, based on worst-case response time
  • Explain preemptive priority scheduling, time slicing, context switching, the tick and tickless idle
  • Design tasks, assign priorities by deadline and size stacks using static analysis and watermarking
  • Choose the right primitive for each interaction and prevent priority inversion and deadlock
  • Handle interrupts correctly with an RTOS and apply rate monotonic analysis and the Liu and Layland bound
  • Plan memory allocation, debug with trace tools and run-time statistics, and select a kernel methodically

Who it is for

  • Firmware engineers moving from bare-metal super loops to their first RTOS project
  • Embedded developers already using an RTOS who want to understand why their designs behave as they do
  • Technical leads who review task designs, priority assignments and RAM budgets
  • Hardware and test engineers who debug timing problems on multitasking devices

Syllabus

Module 1: Choosing a Structure and Understanding the Scheduler

When a super loop or event-driven design is enough, when an RTOS earns its cost, and how a preemptive priority scheduler, the tick and context switching actually work.

  1. When an RTOS Helps and When It Does Not
  2. Tasks and Preemptive Priority Scheduling
  3. Context Switching, the Tick and Tickless Idle
  4. Module quiz (5 questions)

Module 2: Task States, Task Design and Stacks

How tasks move between states, how to divide a system into tasks and assign priorities, and how to size each stack with measurement rather than guesswork.

  1. Task States and Blocking
  2. Designing Tasks and Assigning Priorities
  3. Sizing Stacks and Watermarking
  4. Module quiz (5 questions)

Module 3: Synchronisation and Communication

Queues and message passing, semaphores, mutexes, event flags and direct task notifications, how to choose between them, and how to prevent priority inversion and deadlock.

  1. Queues and Message Passing
  2. Semaphores, Mutexes, Event Flags and Task Notifications
  3. Choosing the Right Primitive
  4. Priority Inversion, Priority Inheritance and Deadlock
  5. Module quiz (5 questions)

Module 4: Interrupts and Timing

Deferring work from interrupt handlers, ISR-safe calls, interrupt priorities relative to the kernel, software timers and delays, and rate monotonic scheduling with the Liu and Layland bound.

  1. Interrupts, Deferred Work and ISR-Safe Calls
  2. Interrupt Priorities and Critical Sections
  3. Software Timers, Delays and Absolute Delays
  4. Rate Monotonic Scheduling and Schedulability
  5. Module quiz (5 questions)

Module 5: Memory, Debugging and Choosing an RTOS

Static and dynamic allocation of kernel objects and heap fragmentation, debugging with trace tools, stack overflow checks and run-time statistics, and a neutral overview of common RTOS choices.

  1. Static and Dynamic Allocation of Kernel Objects
  2. Debugging, Tracing and Run-Time Statistics
  3. Choosing an RTOS
  4. Module quiz (5 questions)

Free downloads for this course

Enrol for free

Discuss your project

Email support@aavico.com or use Get in Touch when the website finishes loading.