Skip to main content

Module kernel

Module kernel 

Source
Expand description

The scheduler: tasks.c and queue.c as a state machine over indices.

Every public function here is a FreeRTOS API function, and its body follows the C body statement for statement — including where the critical sections open and close, because on the sim that is where time passes (ORACLES.md, sim contract v1, rule 3), and including where the trace* macros fire, because the order of those lines is the gate.

The subtlety that costs a diff if you miss it: FreeRTOS yields from inside the critical section in vTaskResume, vTaskPrioritySet, xTaskResumeAll and the queue calls, and from outside it in vTaskSuspend and vTaskDelay. Since portYIELD() on the Posix port is itself a critical section, an inside yield nests (and counts one outermost exit) where an outside yield counts two. Each site below says which it is.

Where the C has a configASSERT, this has an Error: the C kernel stops the world on a bad handle, and the whole point of the remake is that we do not.

Structs§

Kernel
The scheduler.
StartHandles
What Kernel::start_scheduler created, so a runner can attach bodies.

Enums§

NotifyAction
eNotifyAction: what a notification does to the value already there.
NotifyState
ucNotifyState[]: what a task’s notification slot is doing.
Stall
A trace line owed by a task that was switched out before it could emit one. Only the queue failure paths can owe one: they are the only places FreeRTOS traces after leaving a critical section. Why vTaskSwitchContext could not choose a task to run.
TaskState
eTaskState: what a task is doing, derived from the list it is in exactly as eTaskGetState derives it.

Constants§

MAX_NOTIFICATION_ENTRIES
How many notification slots a task has room for.