Intuition The one core idea
A computer's processor (CPU) can only ever do one thing at a time, yet a robot, a drone, or a smartwatch must seem to juggle many jobs at once. An RTOS pulls off this illusion by making the single CPU jump between jobs so fast — and in such a carefully chosen order — that every urgent job still finishes on time.
Before you can read the parent note RTOS Concepts fluently, you need every word and symbol it assumes you already own. This page builds them all, from the ground, in an order where each idea leans only on the ones before it.
Intuition Start with the machine itself
Imagine a single office worker at a single desk. On the desk are a few slips of paper the worker is actively holding right now — the number they're adding, the page they're on, where in the instruction manual they are. The worker can only follow one manual at a time. That worker is the CPU (Central Processing Unit); the slips of paper are its registers .
Definition CPU and instruction stream
A CPU is the part of a chip that reads instructions one after another and carries them out. The ordered list of instructions it is currently walking through is called an instruction stream . Key fact the whole topic rests on: one CPU core runs exactly one instruction stream at any instant.
Everything an RTOS does is a clever way of sharing this one worker between many manuals.
A register is a tiny, ultra-fast storage slot inside the CPU that holds a value the CPU is using right now. There are only a few dozen of them. The picture: the handful of slips the worker is physically holding — not the filing cabinet across the room (that's RAM).
The parent note names specific registers. Here is each, in plain words:
Definition The registers the topic cares about
PC — Program Counter : "which instruction am I on?" → the worker's finger pointing at a line in the manual.
SP — Stack Pointer : "where is the top of my private scratch-pad?" → a bookmark in the worker's personal notepad.
r0–r12 — general registers : the numbers currently being added, compared, moved → the slips with working numbers on them.
Status flags (xPSR) : tiny yes/no results, e.g. "was the last result zero?" → a sticky note saying "carry: yes".
Intuition Why the topic needs registers at all
To pause one job and run another and later come back perfectly , you must copy down every slip the worker is holding — otherwise, on return, the worker has forgotten their number, their line, everything. This single fact is the reason a "context switch" (Section 6) exists.
Definition RAM and the stack
RAM (Random-Access Memory) is the big filing cabinet: slower than registers but far larger, holding all the program's data. A stack is a special region of RAM used like a spring-loaded stack of plates: you push a plate on top, and later pop the top plate off — always last-in, first-out.
Intuition Why "push" and "pop"
When the CPU must temporarily set aside a slip of paper, it pushes it onto the stack (adds a plate). To get it back it pops it (takes the top plate). Because you always take the most recent one first, nothing gets mixed up. The stack pointer (SP) always marks the top plate — that's why saving SP saves the whole pile.
Each RTOS task gets its own stack — its own private pile of plates — which is why the parent says a task "has its own stack." Read more in Stack memory and TCB .
Intuition The starting point the parent contrasts against
while(1) means "repeat forever". A super-loop is a program that does job A, then job B, then job C, then back to A, forever, in that fixed order. It is the simplest way to run several jobs — and its weakness is exactly what motivates the RTOS.
Definition Super-loop (bare-metal)
A single endless loop that runs each job in source-code order, one after another. Picture a to-do list the worker walks top-to-bottom, again and again. If job B waits (say, 50 ms for a sensor), jobs C and A behind it are simply stuck until B finishes. Compare with Bare-metal super-loop vs RTOS .
This "one slow job freezes everyone" problem is the villain the whole RTOS topic defeats.
Definition Interrupt and ISR
An interrupt is a hardware signal that instantly taps the CPU on the shoulder: "drop what you're doing, handle this now." The short function that handles it is the ISR (Interrupt Service Routine). Picture the office phone ringing: the worker bookmarks their manual, answers the call, then returns.
A tick is a regular interrupt fired by a hardware timer — say 1000 times per second. It is the RTOS's heartbeat: every tick, the scheduler wakes up and asks "is there now a more urgent job to run?" Picture a metronome clicking; on each click the manager checks the priority board.
Intuition Why we need interrupts before we can understand scheduling
Without interrupts, the CPU would never stop a running job to check anything — it would run job A to the bitter end. Interrupts are the mechanism that lets an outside event (a button, a timer) seize the CPU. The parent's "trigger" for a context switch is always an interrupt. See Interrupts and ISR latency .
The parent's formulas use these; here they are from zero.
Definition Frequency and period
Frequency f = "how many times per second something happens", measured in hertz (Hz) . Period T = "how many seconds between one event and the next". They are opposites:
f = T 1 T = f 1
Picture a ticking clock: 1000 ticks per second (f = 1000 Hz ) means the gap between ticks is T = 1/1000 = 0.001 s = one millisecond.
Definition Time-unit symbols
ms = millisecond = 1 0 − 3 s (a thousandth of a second).
μ s = microsecond = 1 0 − 6 s (a millionth). The symbol μ (Greek "mu") means "one millionth of".
Intuition Why the topic measures in µs and ms
A context switch takes a few millionths of a second; a deadline might be a few thousandths . To compare "cost of switching" against "time budget", we need these tiny units. This directly feeds the overhead formula η = T cs f t i c k in the parent — a time (µs) times a rate (Hz) gives a pure fraction, because seconds cancel per-second.
Worked example Units cancelling in
η = T cs f t i c k
T cs = 2 μ s = 2 × 1 0 − 6 s , f t i c k = 1000 Hz = 1000 s 1 .
η = ( 2 × 1 0 − 6 s ) × ( 1000 s 1 ) = 2 × 1 0 − 3 = 0.2%
The seconds (s ) on top cancel the per-second (1/ s ) on the bottom, leaving a plain number — a fraction of the CPU. That's why the formula is dimensionless.
A priority is a number telling how urgent a task is; higher number = more urgent (in FreeRTOS convention). Picture a colour-coded board: red jobs jump the queue, grey jobs wait. The scheduler's whole rule is "always run the highest-priority job that can run."
Intuition Why "Blocked" is the hero state
A job that waits politely by going Blocked hands the CPU to someone else. A job that busy-waits (while(!ready);) stays Running and hogs the worker. This one distinction — Blocked vs Running — is the source of an RTOS's power, and the parent's Example 3 turns entirely on it. See Semaphores and Queues for the tools that block cleanly.
Definition Task Control Block (TCB)
A TCB is a small record the RTOS keeps for each task: its priority, its state, and — crucially — its saved stack pointer . Picture one index card per worker, filed in a box; the card says "priority 3, Blocked, notepad-bookmark = address 0x2000A0". When the RTOS resumes a task, it reads that card to find the task's saved pile of plates. Detailed in Stack memory and TCB .
Intuition Why SP-in-the-TCB is enough to restore everything
Recall (Section 2) that all the task's saved slips of paper live on its stack, and SP marks the top of that pile. So one saved number — the SP — is the handle to the entire frozen state. That's why the parent's switch procedure only stores the SP into the TCB.
CPU one worker one stream
Scheduler picks next task
Frequency and period f and T
Read the map top-down: registers and the stack build the TCB and the context switch; interrupts and the tick drive the scheduler; frequency feeds the overhead maths — and all of it lands on why an RTOS exists .
Recall Self-test: can you answer each before opening the parent note?
A CPU core runs how many instruction streams at once? ::: Exactly one.
What is a register, in one phrase? ::: A tiny fast storage slot inside the CPU holding a value it's using right now.
What does the PC (program counter) hold? ::: The address of the current instruction — "which line am I on".
What does the SP (stack pointer) mark? ::: The top of the task's private stack (its pile of plates).
How does a stack add and remove items? ::: Push on top, pop from top — last-in, first-out.
What is an interrupt? ::: A hardware signal that makes the CPU pause and handle something now.
What is a tick? ::: A regular timer interrupt — the RTOS heartbeat that wakes the scheduler.
Convert f = 1000 Hz to a period. ::: T = 1/ f = 0.001 s = 1 ms .
How many microseconds are in one second? ::: One million (1 0 6 ).
Name the four task states. ::: Running, Ready, Blocked, Suspended.
Why does "Blocked" help the system? ::: A Blocked task releases the CPU so other tasks can run.
What single value in the TCB is the handle to a task's whole saved state? ::: Its saved stack pointer (SP).
In a super-loop, what happens if one job waits 50 ms? ::: Every job behind it is stalled for those 50 ms.