CPU Schedulers And Its Types
CPU Schedulers are also known as CPU Dispatcher. It is a module or program that provides control of the CPU to the process. The Dispatcher execute on each context switching. Dispatch latency is a time, which is needed by CPU scheduler to stop one process and start another.
Operating system uses various CPU schedulers. Let’s explain with diagram,
1. Long term scheduler
Long term scheduler is also known as job scheduler. It chooses the processes from secondary memory and puts them in the ready queue in main memory.
It handles the degree of Multi-programming. Main purpose of long term scheduler is to select a perfect mix of CPU bound and IO bound processes, among the various processes present in the secondary memory.
If the job scheduler selects more IO bound processes then all of the jobs may reside in the block state (due to I/O request). So, all that time CPU will sit idle. This will decrease the degree of Multi programming. Therefore, the Job of long term scheduler is very important.
2. Short term scheduler
Short term scheduler is also known as CPU scheduler. OS use short term scheduler to selects one of the process from the ready queue and dispatch it to the CPU for the execution.
Short term scheduler use scheduling algorithm to select a process from ready queue.
Starvation problem may occur if the short term scheduler makes some mistakes while choosing the process. As, selecting of that process which having very high burst time.
3. Medium term scheduler
It involves in swapping-out and swapping-in in-between the main memory and secondary memory.
It suspended the process and transfers it toward secondary memory from main memory and resumes the suspended process from secondary memory to primary memory.
So, in short medium term scheduler is responsible for suspending the process from main memory to secondary memory and resuming the processes from secondary to main memory.