Tasks that are ready-to-run are placed in the Ready List. As shown in the figure below, the ready list is an array (OSRdyList[]
) containing OS_CFG_PRIO_MAX
entries, with each entry defined by the data type OS_RDY_LIST
(see os.h
). An OS_RDY_LIST
entry consists of three fields: .Entries
, .TailPtr
and .HeadPtr
.
.Entries
contains the number of ready-to-run tasks at the priority level corresponding to the entry in the ready list. .Entries
is set to zero (0) if there are no tasks ready-to-run at a given priority level.
.TailPtr
and .HeadPtr
are used to create a doubly linked list of all the tasks that are ready at a specific priority. .HeadPtr
points to the head of the list and .TailPtr
points to its tail.
The “index” into the array is the priority level associated with a task. For example, if a task is created at priority level 5 then it will be inserted in the table at OSRdyList[5]
if that task is ready-to-run.
The table below shows the functions that µC/OS-III uses to manipulate entries in the ready list. These functions are found in os_core.c
and are internal to µC/OS-III so, the application code must never call them.