Process Scheduling

Ideally every process should require the same length of time-slices in which to use the processor, but in reality different processes have different needs and some are more urgent or important than others. Also, some processes may eligible to run but be unable to do anything because they are waiting on another process completing or on a device becoming available. It would inefficient to let them waste their time-slices doing nothing.

These problems can be minimised by having the user or the system assign a priority to each process.  The overall amount of time allocated to a process, or how often it is given a time-slice, is determined by the priority – the higher the priority, the faster the process will execute.

The Kernel groups processes into one of three states:

  • Running: the process is currently executing on the processor.
  • Ready: the process is ready to be run on the processor.
  • Blocked: the process is waiting for a specific event to occur (eg: another process to finish, or a device to become available). A process may be in the blocked state if it needs to access a resource that is not currently available. It will not be given any time on the processor until the event it is waiting for occurs.

Other variations of these states are:

  • Ready Suspend: This is when a process is swapped out of a memory by Memory Management system in order to free memory for other process.
  • Blocked Suspend: This is when a process is swapped out of memory after incurring an I/O wait
  • Terminate: This is when a process has finished its run.

Next: Interrupts and Error Handling