ChronOS Scheduler: Weigthed Round-Robin
The Round-Robin scheduler is the most simplest scheduling algorithm. The scheduler is called periodically and circles through a list of running tasks, switching from one to the next task each call. The algorithm can be enhanced by using different weights for each task, the scheduler waits for the next switch the periods given by the weight.
The task queue is organized as a FIFO-list, tasks are taken from the head and are inserted at the tail of the list.
When a software interrupt occurs, if needed, the scheduler resumes (puts on the running list) the corresponding event task, remembers the currently executed task and switches the context from the currently executed task to the event task. After the event task has finished (gets suspended) or its time slot is over, the scheduler switches back to the previously interrupted task and continues to schedule normally.
Configure to use round-robin scheduling (system default):
Const Os_scheduling_policy = Os_s