Process Scheduling Concepts
Long-term, medium-term, and short-term scheduling in operating systems.
Long-Term Scheduler
Controls degree of multiprogramming. Selects processes from disk to load into memory.
Medium-Term Scheduler
Handles swapping. Moves processes between memory and disk to manage system load.
Short-Term Scheduler
Also called CPU scheduler. Selects which ready process gets the CPU next.
Scheduling Queues
| Queue | Description | Managed By |
|---|---|---|
| Job Queue | Contains all processes in the system | Long-term scheduler |
| Ready Queue | Processes ready to execute in memory | Short-term scheduler |
| Device Queue | Processes waiting for I/O devices | I/O subsystem |
Context Switching
Context switching is the mechanism where the OS saves the state of a running process (registers, program counter, memory map) and loads the saved state of another process. While necessary for multitasking, context switching has overhead — typically a few microseconds per switch.
Performance Impact
Context switch overhead includes saving/loading registers, flushing TLB, and cache misses. Too many switches can degrade performance significantly.