Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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.

Anchor
Table - Ready List access functions
Table - Ready List access functions

Panel
borderWidth0
titleTable - Ready List access functions


FunctionDescription
OS_RdyListInit()Initialize the ready list to “empty” (see the figure below)
OS_RdyListInsert()Insert a TCB into the ready list
OS_RdyListInsertHead()Insert a TCB at the head of the list
OS_RdyListInsertTail()Insert a TCB at the tail of the list
OS_RdyListMoveHeadToTail()Move a TCB from the head to the tail of the list
OS_RdyListRemove()Remove a TCB from the ready list



Anchor
Figure - Empty Ready List
Figure - Empty Ready List

Panel
borderWidth0
titleFigure - Empty Ready List

Image Added


Panel
bgColor#f0f0f0

Assuming all internal µC/OS-III’s tasks are enabled, the figure below shows the state of the ready list after calling OSInit() (i.e., µC/OS-III’s initialization). It is assumed that each µC/OS-III task had a unique priority. With µC/OS-III, this does not have to be the case.

(1) There is only one entry in OSRdyList[OS_CFG_PRIO_MAX-1], the idle task.

(2) The list points to OS_TCBs. Only relevant fields of the TCB are shown. The .PrevPtr and .NextPtr are used to form a doubly linked list of OS_TCBs associated to tasks at the same priority. For the idle task, these fields always point to NULL.

(3) The tick task and the other three optional tasks have their own priority level, as shown. Typically, you would set the priority of the tick task higher than the timer task and, the timer task higher in priority than the statistic task.

(4) Both the tail and head pointers point to the same TCB when there is only one TCB at a given priority level.


Anchor
Figure - Ready List after calling OSInit()
Figure - Ready List after calling OSInit()

Panel
borderWidth0
titleFigure - Ready List after calling OSInit()

Image Added


Panel
bgColor#f0f0f0

(1) The tick task and the other three optional tasks have their own priority level, as shown. Typically, you would set the priority of the tick task higher than the timer task and, the timer task higher in priority than the statistic task.

(2) Both the tail and head pointers point to the same TCB when there is only one TCB at a given priority level.