Kernel/RTOS Architecture

Internal Architecture of a Real-Time OS/Kernel

Basic services:

  • Task management (create, delete, initial activation, state).

  • Time management (activation, policing, measurement of time intervals).

  • Task scheduling (decide what jobs to execute in every instant).

  • Task dispatching (putting jobs in execution).

  • Resource management (mutexes, semaphores, etc.).

Management structures

The TCB (task control block)

This is a fundamental structure of a kernel. It stores all the relevant information about tasks, which is then used by the kernel to manage their execution.

Common data (not exhaustive):

  • Task identifier.

  • Pointer to the code to be executed.

  • Pointer to the private stack (for context saving, local variables, ...).

  • Periodic activation attributes (task type (periodic/sporadic), period, initial phase, etc).

  • Criticality (hard, soft, non real-time).

  • Other attributes (deadline, priority).

  • Dynamic execution state and other variables for activation control, e.g. SW timers, absolute deadline, ...

TCB structure

TCBs are often defined in a static array, but are normally structured as linked lists to facilitate operations and searches over the task set.

E.g., the ready queue (list of ready tasks sorted by a given criteria) is maintained as a linked list. These linked lists may be implemented e.g. through indexes. Multiple lists may (and usually do) coexist!

SCB structure

Similarly, the information concerning a semaphore is stored in a Semaphore Control Block (SCB), which contains at least the following three fields:

  • A counter, which represents the value of the semaphore.

  • A queue, for enqueueing the tasks blocked on the semaphore.

  • A pointer to the next SCB, to form a list.

Last updated