Supplementing the Model with Handwritten Code : Scheduler Package : Scheduling Policy

Scheduling Policy

The context switch between tasks is done only in the following synchronization points:

When a task explicitly calls the scheduler. This is done by calling the following routine:

scheduler()

If there are other ready tasks - one of them (chosen in a round-robin manner) becomes current, while the calling task becomes ready. If there is no other task ready, the calling task continues its execution.
When a task issues a delay request by calling task_delay. The calling task then becomes delayed.
When a task calls a wait_for_event service. The calling task then becomes delayed.

wait_for_event(EVENT)
event *EVENT;