Task Management API Changes
The table below shows the difference in API for task-management services.
µC/OS-II ( | µC/OS-III ( | Note |
|---|---|---|
|
| (1) |
|
| (2) |
|
| (2) |
|
|
|
|
|
|
|
|
|
|
| (3) |
|
| (4) |
|
| (4) |
|
| (4) |
|
| (4) |
|
|
|
|
|
|
|
|
|
|
| (5) |
|
| (5) |
|
| (5) |
|
| (5) |
|
| (5) |
|
|
|
|
| (6) |
|
| (7) |
|
| (8) |
(1) In µC/OS-II, each task must have a unique priority. The priority of a task can be changed at run-time, however it can only be changed to an unused priority. This is generally not a problem since µC/OS-II supports up to 255 different priority levels and is rare for an application to require all levels. Since µC/OS-III supports an unlimited number of tasks at each priority, the user can change the priority of a task to any available level.
(2) µC/OS-II provides two functions to create a task: OSTaskCreate() and OSTaskCreateExt(). OSTaskCreateExt() is recommended since it offers more flexibility. In µC/OS-III, only one API is used to create a task, OSTaskCreate(), which offers similar features to OSTaskCreateExt() and provides additional ones.
(3) µC/OS-III does not need an OSTaskNameSet() since an ASCII name for the task is passed as an argument to OSTaskCreate().
(4) µC/OS-III allows tasks or ISRs to send messages directly to a task instead of having to pass through a mailbox or a message queue as does µC/OS-II.
(5) µC/OS-III allows tasks or ISRs to directly signal a task instead of having to pass through a semaphore as does µC/OS-II.
(6) In µC/OS-II, the user must allocate storage for a special data structure called OS_STK_DATA, which is used to place the result of a stack check of a task. This data structure contains only two fields: .OSFree and .OSUsed. In µC/OS-III, it is required that the caller pass pointers to destination variables where those values will be placed.
(7) µC/OS-III allows users to specify the time quanta of each task on a per-task basis. This is available since µC/OS-III supports multiple tasks at the same priority, and allows for round robin scheduling. The time quanta for a task is specified when the task is created, but it can be changed by the API at run time.
(8) µC/OS-III does not provide query services as they were rarely used.