Page tree

Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Published by Scroll Versions from this space and version 3.05


CaptionTextRound Robin Scheduling
Image Modified

(1) Task #3 is executing. During that time, a tick interrupt occurs but the time quanta have not expired yet for Task #3.

(2) On the 4th tick interrupt, the time quanta for Task #3 expire.

(3) µC/OS-III resumes Task #1 since it was the next task in the list of tasks at priority “X” that was ready-to-run.

(4) Task #1 executes until its time quanta expires (i.e., after four ticks).

(5, 6, )


(7) Here Task #3 executes but decides to give up its time quanta by calling the µC/OS-III function  OSSchedRoundRobinYield() , which causes the next task in the list of tasks ready at priority “X” to execute. An interesting thing occurred when µC/OS-III scheduled Task #1. It reset the time quanta for that task to four ticks so that the next time quanta will expire four ticks from this point.

(8) Task #1 executes for its full time quanta.

µC/OS-III allows the user to change the default time quanta at run time through the OSSchedRoundRobinCfg() function (see Appendix A, “µC/OS-III API Reference”). This function also allows round robin scheduling to be enabled/disabled, and the ability to change the default time quanta.

µC/OS-III also enables the user to specify the time quanta on a per-task basis. One task could have a time quanta of 1 tick, another 12, another 3, and yet another 7, etc. The time quanta of a task is specified when the task is created. The time quanta of a task may also be changed at run time through the function OSTaskTimeQuantaSet().