Versions Compared

Key

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

Tasks are added to the ready list by a number of µC/OS-III services. The most obvious service is OSTaskCreate(), which always creates a task in the ready-to-run state and adds the task to the ready list. As shown in Figure 6-6, we created a task, and specified a priority level where tasks already existed (two in this example) in the ready list at the desired priority level. OSTaskCreate() will then insert the new task at the end of the list of tasks at that priority level.F6-6

(1)Before calling OSTaskCreate() (in this example), two tasks were in the ready list at priority “prio”.

F6-6(2)A new TCB is passed to OSTaskCreate() and, µC/OS-III initialized the contents of that TCB.F6-6

(3)OSTaskCreate() calls OS_RdyListInsertTail(), which links the new TCB to the ready list by setting up four pointers and also incrementing the .Entries field of OSRdyList[prio]. Not shown in Figure 6-6 is that OSTaskCreate() also calls OS_PrioInsert() to set the bit in the bitmap table. Of course, this operation is not necessary as there are already entries in the list at this priority. However, OS_PrioInsert() is a very fast call and thus it should not affect performance.

...