Open In App

Difference between dispatcher and scheduler

Improve
Improve
Like Article
Like
Save
Share
Report

to determine Schedulers are special system software that handles process scheduling in various ways. Their main task is to select the jobs to be submitted into the system and to decide which process to run. 

There are three types of Scheduler:

  1. Long-term (job) scheduler – Due to the smaller size of main memory initially all programs are stored in secondary memory. When they are stored or loaded in the main memory they are called processes. This is the decision of the long-term scheduler to determine how many processes will stay in the ready queue. Hence, in simple words, the long-term scheduler decides the degree of multi-programming of the system.
  2. Medium-term scheduler – Most often, a running process needs I/O operation which doesn’t require a CPU. Hence during the execution of a process when an I/O operation is required then the operating system sends that process from the running queue to the blocked queue. When a process completes its I/O operation then it should again be shifted to the ready queue. ALL these decisions are taken by the medium-term scheduler. Medium-term scheduling is a part of swapping.
  3. Short-term (CPU) scheduler – When there are lots of processes in main memory initially all are present in the ready queue. Among all of the processes, a single process is to be selected for execution. This decision is handled by a short-term scheduler. Let’s have a look at the figure given below. It may make a more clear view for you. 

Dispatcher – A dispatcher is a special program which comes into play after the scheduler. When the scheduler completes its job of selecting a process, it is the dispatcher which takes that process to the desired state/queue. The dispatcher is the module that gives a process control over the CPU after it has been selected by the short-term scheduler. This function involves the following:

  • Switching context
  • Switching to user mode
  • Jumping to the proper location in the user program to restart that program

Role of the dispatcher:

  1. The dispatcher gives control of the CPU to the process selected by the short- term schedular.
  2. A dispatcher is a communications worker who receives and transmits information to co-ordinate operations of other personnel and vehicles carrying out a service.
  3. A dispatcher is a special program which comes into play after the scheduler.
  4. When the schedular completes its job of selecting a process, it is the dispatcher which takes that process to the desired state/ queue.

The Difference between the Scheduler and Dispatcher – Consider a situation, where various processes are residing in the ready queue waiting to be executed. The CPU cannot execute all of these processes simultaneously, so the operating system has to choose a particular process on the basis of the scheduling algorithm used. So, this procedure of selecting a process among various processes is done by the scheduler. Once the scheduler has selected a process from the queue, the dispatcher comes into the picture, and it is the dispatcher who takes that process from the ready queue and moves it into the running state. Therefore, the scheduler gives the dispatcher an ordered list of processes which the dispatcher moves to the CPU over time. Example – There are 4 processes in the ready queue, P1, P2, P3, P4; Their arrival times are t0, t1, t2, t3 respectively. A First in First out (FIFO) scheduling algorithm is used. Because P1 arrived first, the scheduler will decide it is the first process that should be executed, and the dispatcher will remove P1 from the ready queue and give it to the CPU. The scheduler will then determine P2 to be the next process that should be executed, so when the dispatcher returns to the queue for a new process, it will take P2 and give it to the CPU. This continues in the same way for P3, and then P4.

Properties DISPATCHER SCHEDULER
Definition Dispatcher is a module that gives control of CPU to the process selected by short term scheduler Scheduler is something which selects a process among various processes
Types There are no different types in dispatcher.It is just a code segment. There are 3 types of scheduler i.e. Long-term, Short-term, Medium-term
Dependency Working of dispatcher is dependent on scheduler.Means dispatcher have to wait until scheduler selects a process. Scheduler works independently. It works immediately when needed
Algorithm Dispatcher has no specific algorithm for its implementation Scheduler works on various algorithm such as FCFS, SJF, RR etc.
Time Taken The time taken by dispatcher is called dispatch latency. Time taken by scheduler is usually negligible.Hence we neglect it.
Functions Dispatcher is also responsible for:Context Switching, Switch to user mode, Jumping to proper location when process again restarted The only work of scheduler is selection of processes.
Tasks Dispatcher allocates  the CPU to the process selected by the short-time scheduler. Scheduler performs three task. Job scheduling (Long-term scheduler), CPU scheduling (Short-term scheduler) and swapping (Medium-term scheduler).
Purpose  To move the process from the ready queue to the CPU  To select the process and decide which process to run
 
Execution time  It takes a very short execution time  It takes longer execution time than dispatcher
 
Interaction  The dispatcher works with the CPU and the selected process  The scheduler works with the ready queue and the dispatcher
 

Last Updated : 26 Sep, 2023
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads