What is the Difference Between Scheduler and Dispatcher?

🆚 Go to Comparative Table 🆚

The scheduler and dispatcher are both used in the process scheduling of an operating system, but they have different functions and dependencies:

Scheduler:

  • Selects a process from a list of processes using scheduling algorithms such as First Come First Serve (FCFS), Round-Robin, or Shortest Job First (SJF).
  • Works independently.
  • There are three types of schedulers: Long-term (job) scheduler, Short-term (process) scheduler, and Medium-term scheduler.

Dispatcher:

  • Allocates the CPU to the process selected by the short-term scheduler.
  • Dependent on the scheduler, as it transfers only the processes selected by the scheduler.
  • Transfers the selected process from the ready queue to the running state.
  • Can also be used for switching to user mode and jumping to a proper location when the process is restarted.

In summary, the scheduler is responsible for selecting a process from a list of processes, while the dispatcher allocates the CPU to the process selected by the scheduler and transfers it to the running state. The scheduler works independently, whereas the dispatcher depends on the scheduler for its function.

Comparative Table: Scheduler vs Dispatcher

Here is a table comparing the differences between a scheduler and a dispatcher:

Feature Scheduler Dispatcher
Purpose Selects a process from a list of processes by applying a scheduling algorithm. Allocates the CPU for the selected process by the scheduler.
Types There are three types of schedulers: Long-term (job) scheduler, Short-term (CPU) scheduler, and Medium-term (swapping) scheduler. There is only one dispatcher module in a programming language.
Dependency Works independently. Dependent on the scheduler.
Function Decides which process should be executed next. Allocates the CPU to the selected process.

In summary, the scheduler is responsible for selecting a process to be executed based on a scheduling algorithm, while the dispatcher allocates the CPU to the selected process. The scheduler works independently, whereas the dispatcher depends on the scheduler to provide an ordered list of processes to be executed.