Home / Learn Embedded C / Task States Explained
Task States Explained
The lifecycle a task moves through: ready, running, blocked and suspended.
How to think about this
The basic idea
An RTOS task moves between a small set of states: Ready (able to run, waiting for the scheduler to pick it), Running (actively executing on the CPU), Blocked (waiting on something, like a semaphore or a delay), and Suspended (not eligible to run at all until explicitly resumed).
Why this comes up
Understanding these states is essential for debugging an RTOS-based system — a task that never runs again might be permanently Blocked waiting on something that is never satisfied, a very common real bug class.
The mechanics
Only one task can be in the Running state per CPU core at any instant; every other ready task waits its turn, and a Blocked task is automatically moved back to Ready once whatever it was waiting for becomes available.
Where it is used
- RTOS debugging
- Task lifecycle understanding
- Diagnosing a task that "never runs"
Try it
A real RTOS tracks exactly this kind of state per task internally; this is a simplified, single-task walk through the transitions.
Try it: one task's action unblocking another task
Task B only leaves Blocked once the condition it was waiting on (set by a different task) actually becomes true.
Quick check
1. What does it mean for a task to be in the "Blocked" state?
Blocked specifically means waiting on a condition; once that condition is met (data arrives, a delay expires, a semaphore is given), the task returns to Ready automatically.