CPU Scheduling

The CPU Scheduler is invoked and must make a decision in every one of the following 4 scenarios:

  1. When the running process switches to a waiting state, such as for an I/O request or a call to wait( ).
  2. When the running process switches to a ready state, for example in response to an interrupt.
  3. When a process switches from the waiting state to the ready state, such as when an I/O event completed or at a return from a call to wait( ).
  4. When a process terminates.

In case the running process starts waiting or terminates, the Scheduler must run a different process on the CPU.

A CPU Scheduler that lets a process run on the CPU until it starts waiting or terminates is called a non-preemptive (also: cooperative) scheduler. Otherwise, if the Scheduler forcefully removes a running process from the CPU (and puts it into the ready state) and instead lets a different process run on the CPU, the Scheduler is called preemptive.