CampusFlow
OSProcess Scheduling

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

QueueDescriptionManaged By
Job QueueContains all processes in the systemLong-term scheduler
Ready QueueProcesses ready to execute in memoryShort-term scheduler
Device QueueProcesses waiting for I/O devicesI/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.