NetBurner 3.5.6
PDF Version |
This example demonstrates how to use the Priority Promotion optional behavior to implement a round robin scheduler for a set of worker tasks. This ends up using N+1 tasks to implement a set of N tasks.
The scheduler implemented is not 100% efficient at time allocation, but will guarantee a minimum time slice based on system Ticks, until the running task completes its iteration. In the event that the task being given the timeslice blocks, the tasks will end up falling through and being scheduled as normal, based on their relative priorities.
In the event that no task is ready, the 'next' task will be promoted to the scheduler's priority, at which point it will be blocked, then execution will fall through to whatever tasks may exist at lower priorities, all the way to System Idle.