Fixed-priority pre-emptive scheduling
Fixed-priority pre-emptive scheduling is a scheduling system commonly used in real-time systems. With fixed priority pre-emptive scheduling, the scheduler ensures that at any given time, the processor executes the highest priority task of all those tasks that are currently ready to execute.
tive scheduler]] has a clock interrupt task that can provide the scheduler with options to switch after the task has had a given period—the time slice. This scheduler system has the advantage of making sure no task hogs the processor for any time longer than the time slice. However this scheduling scheme also has the downfall of process or thread lockout, as priority is given to higher priority tasks the lower priority tasks could wait an indefinite amount of time. One common method of arbitrating this situation is the use of aging. Aging will slowly increment a process/thread(s) priority which is in the wait queue to ensure some degree of fairness. Most Real-time operating systems (RTOSs) have pre-emptive schedulers. Also turning off time slicing effectively gives you the non-pre-emptive RTOS.
Pre-emptive scheduling is often differentiated with cooperative scheduling, in which a task can run continuously from start to end without being preempted by other tasks. To have a task switch, the task must explicitly call the scheduler. Cooperative scheduling is used in a few RTOS such as Salvo or TinyOS.