operating-systems scheduling

Definition

Scheduling Levels

Operating systems typically perform scheduling at three distinct levels, differing in frequency and scope: long-term, medium-term, and short-term scheduling.

1. Long-term Scheduling

The long-term scheduler (or admission scheduler) determines which programs are admitted to the system for execution.

  • Task: It controls the degree of multiprogramming (the number of processes in the system).
  • Goal: To maintain a balanced mix of CPU-intensive and I/O-intensive processes to maximise resource utilisation.
  • Frequency: Relatively infrequent (seconds to minutes).

2. Medium-term Scheduling

The medium-term scheduler manages the residence of processes in main memory.

  • Task: It implements swapping by moving processes between main memory and secondary storage.
  • Goal: To manage memory pressure and improve the process mix by temporarily removing processes from the ready/blocked states (moving them to the Suspend states).

3. Short-term Scheduling

The short-term scheduler (or CPU scheduler / dispatcher) selects the next process to be executed from the Ready Queue.

  • Task: It performs the actual process switch.
  • Goal: To optimise the specific performance criteria of the system (e.g., response time or throughput).
  • Frequency: Extremely frequent (milliseconds).