Process Scheduling in Operating Systems
Process scheduling in an operating system refers to the technique used to decide which process gets access to the CPU and when. Since multiple processes may compete for CPU time, the OS must manage them efficiently.
Types of Process Schedulers
Operating systems mainly use three types of schedulers to manage process execution and memory efficiently.
Long Term Scheduler (Job Scheduler)

Picks processes from the job pool and loads them into memory
The long term scheduler is responsible for selecting processes from the job pool (stored on disk) and loading them into the main memory (RAM). Once loaded, these processes move into the ready state.
- Multiprogramming: Controls how many processes are present in memory at a time (degree of multiprogramming).
- Selection Criteria: Selects processes based on factors like priority, resource needs, or execution time.
- Frequency: Invoked less frequently (every few seconds or minutes).
- Speed: Slowest scheduler because it involves heavy disk operations.
Short Term Scheduler (CPU Scheduler)

Selects a process from the ready queue for CPU execution
The short term scheduler chooses a process from the ready queue and assigns it to the CPU for execution.
- Algorithms: Works with scheduling algorithms like FCFS, SJF, and Round Robin.
- Frequency: Runs very frequently (every few milliseconds).
- Speed: Fastest scheduler because decisions must be made extremely quickly.
- Dispatcher: Uses a dispatcher to physically switch the CPU between processes (saving state, loading state, transferring control). The time taken for this switch is called dispatch latency.
Medium Term Scheduler (Swapper)

Manages memory by swapping processes in and out of RAM
The medium term scheduler manages memory by temporarily removing processes from RAM and storing them on disk. This process is called swapping.
- Memory Load: Reduces memory load by suspending some processes.
- Performance: Helps improve overall system performance during heavy load.
- Frequency: Invoked occasionally when memory is limited.
- Speed: Speed is between long term and short term schedulers.
Comparison of Schedulers
| Feature | Long Term | Short Term | Medium Term |
|---|---|---|---|
| Also Called | Job Scheduler | CPU Scheduler | Swapper |
| Main Role | Loads processes into memory | Assigns CPU to processes | Swaps processes in/out |
| Frequency | Rare | Very frequent | Occasional |
| Speed | Slowest | Fastest | Moderate |
| Purpose | Controls multiprogramming | Manages ready queue | Reduces memory usage |
