IT lexicon › Programming › Task control block (TCB)

Task control block (TCB)

Programming På svenska → Updated: 2026-11-03

The data structure in which an RTOS keeps everything it needs to know about a task while that task isn't running.

Every task in a real-time operating system has its own TCB: saved stack pointer, priority, state (ready, blocked, suspended), whatever it may be waiting on, and usually a name to make debugging bearable. In practice the scheduler does little more than shuffle TCBs between lists.

On a context switch the CPU registers are pushed onto the outgoing task's stack, the stack pointer is stored in its TCB, and the next task's stack pointer is loaded from its own. That is why pxTopOfStack is the very first field of the FreeRTOS TCB — the assembly code can find it at offset zero without knowing anything else about the layout. The general-purpose OS equivalent is the process control block, which is considerably fatter.

← Back to the lexicon