Module 7 of 10

RTOS & Concurrency

Lessons

About This Module

Simple firmware runs in one big loop, doing one thing after another. That works until you need to read a sensor, update a display, and talk to the network all at the same time. A real-time operating system (RTOS) solves this by splitting the work into independent tasks and letting a scheduler decide which one runs, and when.

You'll start with what an RTOS is and why embedded projects use one, then see how the FreeRTOS scheduler shares the processor between tasks. Running several tasks brings a new kind of bug, so the rest of the module covers mutexes and semaphores, the tools that stop tasks from corrupting shared data and let them signal each other safely.

Once you've finished, move on to Wireless & Networking to connect your devices without wires.

Lessons

4 videos
01

What Is a Real-Time Operating System (RTOS)?

Why a single super loop, as in a typical Arduino sketch, runs out of steam, and how an RTOS lets several tasks run concurrently instead.

02

Task Scheduling in FreeRTOS

An overview of multi-threaded programming and how the FreeRTOS scheduler decides which task gets the processor, using priorities and time slices.

03

Mutex: Protecting Shared Data

What race conditions are and how a mutex, a lock on shared data such as a global variable, stops one task from overwriting what another is using.

04

Semaphores: Signaling Between Tasks

How a semaphore works as a signaling mechanism to synchronise tasks, how it differs from a mutex, and how counting semaphores are used in practice.