What is the difference between a scheduler and a dispatcher?

Let's say there are 'n' process in the ready queue.
Now whenever CPU is idle, any one of the processes is to be scheduled according to which scheduling algorithm is under consideration. now the scheduler(short-term scheduler) will pick or select any one among the processes from the ready queue (based on the algorithm in use) and will inform the dispatcher that this is the process which is to be scheduled.
Now dispatcher will do context switching (i.e all information about that process from its PCB is loaded or put into CPU, in case if there is another process inside the CPU then the dispatcher will first save the context of the residing process and then it will load the context of the new process).
In simple term, Scheduler will select the process from ready queue and dispatcher will do the labor work of saving and loading of new process into the CPU.

DISPATCHER?
 
  The dispatcher is the module that gives control of the CPU to the process selected by the short-time scheduler(selects from among the processes that are ready to execute).
  The function involves :
  Switching context
  Switching to user mode
  Jumping to the proper location in the user program to restart that program.

  SCHEDULER?
 
  It is an intermediate level of scheduling.The medium-term scheduling removes processes from memory and from active contention for the CPU.Swapping of the process takes place, which is required to improve the process mix.


Comments