what is dispatcher in os

1 year ago 52
Nature

In an operating system, a dispatcher is a special program that comes into play after the scheduler. The scheduler selects a process from the ready queue and the dispatcher performs the task of allocating the selected process to the CPU. The dispatcher is responsible for switching context, switching to user mode, and jumping to the proper location in the user program to restart that program. The dispatcher is a module that provides a process with total control over the CPU after the short-term scheduler finally selects it. The dispatcher needs to be as fast as possible, as it is run on every context switch. The time consumed by the dispatcher is known as dispatch latency.

The dispatcher performs various tasks, including context switching, setting up user registers, and memory mapping. These are necessary for the process to execute and transfer CPU control to that process. When dispatching, the process changes from the ready state to the running state. Sometimes, the dispatcher is considered part of the short-term scheduler, so the whole unit is called the short-term scheduler.

In summary, the dispatcher is a module that provides control of the CPU to the process selected by the short-term scheduler. It performs various tasks, including context switching, setting up user registers, and memory mapping, and is responsible for allocating the selected process to the CPU.