# Scheduler vs Dispatcher

> The scheduler is the policy that decides which ready process should run next, while the dispatcher is the mechanism that carries out that decision by performing the context switch. The dispatcher saves the current process's state to its PCB and loads the selected process's state onto the CPU, and the time this takes is called dispatch latency.

Canonical: https://devsunite.com/resources/core-subjects/operating-systems/scheduler-vs-dispatcher
Last updated: 2026-11-22

Subject: Operating Systems · Category: Process Scheduling · 3 min read

These two terms are frequently confused, but they describe genuinely different responsibilities in the CPU scheduling pipeline: deciding what to do, versus actually doing it.

## The scheduler: deciding

The scheduler is the policy: it looks at the ready queue and, according to whatever algorithm is in effect (FCFS, SJF, Round Robin, Priority, and so on), decides which process should run next. This is a decision-making step, it doesn't itself touch the CPU's registers or move any actual process state around.

## The dispatcher: doing

The dispatcher is the mechanism that carries out the scheduler's decision. It performs the actual context switch: saving the currently-running process's CPU state (registers, program counter, and so on) into that process's PCB, loading the newly-selected process's saved state from its own PCB into the CPU, switching to the correct memory mapping for the new process, and then jumping to the right location to resume that process's execution.

## Why this distinction matters: dispatch latency

The time it takes the dispatcher to actually perform this switch, from stopping the old process to starting the new one, is called dispatch latency. This is real, measurable overhead: every single context switch costs CPU cycles that aren't spent doing either process's actual work, they're spent purely on the mechanics of switching. A scheduler that switches processes extremely frequently (say, Round Robin with a very short time slice) can end up spending a meaningful fraction of total CPU time on dispatch overhead rather than real computation, which is exactly why time slice length is a real, carefully-tuned design tradeoff, not an arbitrary number.

## A worked illustration

Suppose dispatch latency is 1 millisecond per context switch, and a Round Robin scheduler uses a 4 millisecond time slice. Roughly 1 out of every 5 milliseconds (1 dispatch + 4 execution) is pure overhead, about 20% of total CPU time. If the time slice were instead cut to 1 millisecond to feel more "instantly responsive," dispatch overhead would now be 1 out of every 2 milliseconds, 50% of total CPU time wasted purely on switching, a genuinely bad tradeoff. This concrete cost is exactly why time slice values are chosen carefully rather than made as small as theoretically possible.

## Where this matters in real systems

Every real operating system kernel has dispatcher code, usually written in a mix of C and architecture-specific assembly, since saving and restoring CPU registers is inherently hardware-specific. Kernel developers measure and optimize dispatch latency directly, because it's pure overhead sitting on the critical path of every single context switch a running system performs, potentially thousands of times per second.

## What interviewers actually ask about scheduler vs dispatcher

- **"What is the difference between the scheduler and the dispatcher?"** The scheduler decides which process should run next based on some policy; the dispatcher is the mechanism that actually performs the context switch to make that decision real.
- **"What is dispatch latency?"** The time taken to switch the CPU from one process to another, pure overhead not spent doing either process's actual work.
- **"Why does time slice length matter for a preemptive scheduler like Round Robin?"** Because a shorter time slice means more frequent context switches, and each switch has a fixed dispatch-latency cost, so an overly short time slice can waste a large fraction of total CPU time purely on switching overhead.
- **"Is the dispatcher part of the scheduling policy, or separate from it?"** Separate: the dispatcher's job is purely mechanical execution of whatever decision the scheduler (the policy) already made.

## Key takeaways

- The scheduler decides which process runs next; the dispatcher actually performs the switch.
- Dispatch latency is the real, measurable overhead cost of performing a context switch.
- Very frequent switching (a very short time slice) can waste a large share of CPU time purely on dispatch overhead.
- This is exactly why time slice length in algorithms like Round Robin is a deliberate, measured tradeoff.

## Related

- [Previous: Preemptive vs Non-Preemptive Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/preemptive-vs-non-preemptive-scheduling)
- [Next: Scheduling Criteria](https://devsunite.com/resources/core-subjects/operating-systems/scheduling-criterias)
- [More in Process Scheduling: Process Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/process-scheduling)
- [More in Process Scheduling: Scheduling Queues](https://devsunite.com/resources/core-subjects/operating-systems/scheduling-queues)
- [More in Process Scheduling: FCFS (First Come First Served) Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/fcfs-scheduling)
- [More in Process Scheduling: Shortest Job First (SJF) Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/sjf-scheduling)
- [More in Process Scheduling: SRTF (Shortest Remaining Time First) Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/srtf-scheduling)
- [More in Process Scheduling: Priority Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/priority-scheduling)
- [More in Process Scheduling: Round Robin Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/round-robin-scheduling)
- [More in Process Scheduling: Multilevel Queue Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/multilevel-queue-scheduling)
- [More in Process Scheduling: Multilevel Feedback Queue Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/multilevel-feedback-queue-scheduling)
- [More in Process Scheduling: Starvation and Aging in Scheduling](https://devsunite.com/resources/core-subjects/operating-systems/starvation-and-aging)
- [All 205 OS interview questions](https://devsunite.com/resources/core-subjects/operating-systems)
