What are a scheduler and a dispatcher in OS?


Let us begin by understanding what a scheduler is.

Scheduler

It is used for handling the process and makes scheduling for the process. The main task of the scheduler is to select the process and make order of process, and to decide which process runs first.

Types of Schedulers

There are three different types of schedulers, which are as follows −

Long term scheduler

Long term scheduling is performed when a new process is created, if the number of ready processes in the ready queue becomes very high, and then there is an overhead on the operating system, for maintaining long lists, containing switching and dispatching increases. Therefore, allowing only a limited number of processes into the ready queue, the long term scheduler manages this.

The long term scheduler is given below −

Medium term scheduler

After execution then enters into input/ output operation state, then again comes back into a ready state. So, at that time a medium-term scheduler is used.

The medium-term scheduler is given below −

Short term scheduler

All the processes are in a ready state, which process should run first, it has to be decided by the short-term scheduler.

The short term scheduler is given below −

Dispatcher

The dispatcher is done after the scheduler. It gives control of the CPU to the process selected by the short-term scheduler. After selecting the process, the dispatcher gives CPU to it.

Functions

The functions of the dispatcher are as follows −

  • Switching context.

  • Switching to user mode.

The dispatcher is given below −

Differences

The major differences between scheduler and dispatcher are as follows −

  • All the processes are in a ready state with no schedule.

  • At that time the scheduler used some algorithm.

  • Scheduling all the processes in the ready queue.

  • After completing scheduling, the dispatcher enters.

  • The dispatcher moves the selected process from the ready queue into the running state.

  • The same process continues simultaneously.

  • Scheduler scheduling the process, at the same time dispatcher dispatches selected processes to the running state.

Updated on: 01-Dec-2021

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements