Difference between Scheduler and Dispatcher
As we all know that the CPU schedulers are used to schedule various processes that are coming for its execution by the CPU. If you have no idea about the schedulers, then you should first read the schedulers blog from here and then come to this blog.
In this blog, we will learn the difference between a scheduler and a dispatcher. But before that, let's have a quick overview of the dispatcher.
Dispatcher
When the processes are in the ready state, then the CPU applies some process scheduling algorithm and choose one process from a list of processes that will be executed at a particular instant of time. This is done by a scheduler i.e. selecting one process from a number of processes is done by a scheduler.
Now, the selected process has to be transferred from the current state to the desired or scheduled state. So, it is the duty of the dispatcher to dispatch or transfer a process from one state to another. A dispatcher is responsible for context switching and switching to user mode(learn more about context switching from here ).
For example, if we have three processes P1, P2, and P3 in the ready state. The arrival time of all these processes is T0, T1, and T2 respectively(learn more about arrival time from here ). If we are using the First Come First Serve approach, then the scheduler will first select the process P1 and the dispatcher will transfer the process P1 from the ready state to the running state. After completion of the execution of the process P1, the scheduler will then select the process P2 and the dispatcher will transfer the process P2 from ready to running state and so on.
Difference between Dispatcher and Scheduler
Till now, we are familiar with the concept of dispatcher and scheduler. Now in this section of the blog, we will see the difference between a dispatcher and a scheduler.
- The scheduler selects a process from a list of processes by applying some process scheduling algorithm. On the other hand, the dispatcher transfers the process selected by the short-term scheduler from one state to another.
- The scheduler works independently, while the dispatcher has to be dependent on the scheduler i.e. the dispatcher transfers only those processes that are selected by the scheduler.
- For selecting a process, the scheduler uses some process scheduling algorithm like FCFS, Round-Robin, SJF, etc. But the dispatcher doesn't use any kind of scheduling algorithms.
- The only duty of a scheduler is to select a process from a list of processes. But apart from transferring a process from one state to another, the dispatcher can also be used for switching to user mode. Also, the dispatcher can be used to jump to a proper location when the process is restarted.
These are some of the differences between a dispatcher and a scheduler. That's it for this blog. Hope you learned something new today.
Do share this blog with your friends to spread the knowledge. Visit our YouTube channel for more content. You can read more blogs from here .
Keep Learning :)
Team AfterAcademy!