CPU Scheduling

Most modern operating systems use preemptive CPU Schedulers.

The dispatcher is another operating system software; its responsibility is to give control of the CPU to the process that the CPU Scheduler chose to run.

The dispatcher performs context switches between processes and threads, switches to user mode from kernel mode, and tells the CPU at which instruction the process or thread need to start executing.

It must work as fast as possible since it will be invoked at every context switch. The time it takes for the dispatcher to execute is called the dispatch latency.