What are a scheduler and a dispatcher in OS?

In operating systems, the scheduler and dispatcher work together to manage process execution. The scheduler decides which process should run next, while the dispatcher actually transfers control to the selected process. Understanding their roles is crucial for comprehending how an OS efficiently manages multiple processes.

Scheduler

A scheduler is a system component that selects processes from various queues and determines their execution order. Its primary function is to decide which process runs first based on specific scheduling algorithms and system policies.

Types of Schedulers

There are three different types of schedulers, each operating at different levels of the system −

Long-Term Scheduler (Job Scheduler)

The long-term scheduler controls the degree of multiprogramming by determining which processes are admitted to the ready queue. It manages the transition of processes from the new state to the ready state, ensuring the system doesn't become overloaded with too many processes.

Long-Term Scheduler New Processes Ready Queue Running State Admits Later Controls degree of multiprogramming

Medium-Term Scheduler (Swapper)

The medium-term scheduler handles swapping processes between main memory and secondary storage. It temporarily removes processes from memory when the system is overloaded and brings them back when resources become available.

Medium-Term Scheduler (Swapping) Ready Queue Running Waiting Suspended (Swapped Out) Swap Out Swap In Manages memory by swapping processes in and out

Short-Term Scheduler (CPU Scheduler)

The short-term scheduler selects which process from the ready queue should be executed next by the CPU. It runs frequently and must be very fast since it directly affects system performance.

Short-Term Scheduler Ready Queue P1 P2 P3 P4 CPU Running P1 Selects Process Runs frequently - must be very fast

Dispatcher

The dispatcher is the module that gives control of the CPU to the process selected by the short-term scheduler. It performs the actual context switching and mode transitions required for process execution.

Functions of Dispatcher

The dispatcher performs several critical functions −

  • Context switching − Saves the state of the currently running process and loads the state of the next process.

  • Switching to user mode − Changes the processor from kernel mode to user mode for process execution.

  • Jumping to the proper location − Transfers control to the appropriate instruction in the user program.

Comparison

Aspect Scheduler Dispatcher
Primary Function Selects which process to run next Actually gives CPU control to selected process
Operation Time Takes more time (algorithm execution) Very fast (direct context switch)
Type of Work Decision making and policy implementation Mechanism implementation
Frequency Less frequent Very frequent
Dependency Independent decision maker Depends on scheduler's selection

How They Work Together

The scheduler and dispatcher work in sequence −

  1. Scheduler analyzes all processes in the ready queue

  2. Applies scheduling algorithm (FCFS, SJF, Round Robin, etc.)

  3. Selects the most appropriate process for execution

  4. Dispatcher performs context switching

  5. Transfers CPU control to the selected process

  6. Process begins or resumes execution

Conclusion

The scheduler and dispatcher are essential components of process management in operating systems. The scheduler makes intelligent decisions about which process should run next, while the dispatcher efficiently implements those decisions through context switching. Together, they ensure optimal CPU utilization and smooth multitasking operations.

Updated on: 2026-03-17T09:01:38+05:30

7K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements