CPU Schedulers - Schedulers in OS - Schedulers
CPU Schedulers - Schedulers in OS - Schedulers
Schedulers
Operating System
Schedulers in OS-
Schedulers in OS are special system software.
They help in scheduling the processes in various ways.
They are mainly responsible for selecting the jobs to be submitted into the
system and deciding which process to run.
Types of Schedulers-
There are 3 kinds of schedulers-
1. Long-term scheduler
2. Short-term scheduler
3. Medium-term scheduler
1. Long-term Scheduler-
Long-term scheduler is also known as Job Scheduler.
It selects a balanced mix of I/O bound and CPU bound processes from the
secondary memory (new state).
Then, it loads the selected processes into the main memory (ready state) for
execution.
2. Short-term Scheduler-
Short-term scheduler is also known as CPU Scheduler.
It decides which process to execute next from the ready queue.
After short-term scheduler decides the process, Dispatcher assigns the
decided process to the CPU for execution.
3. Medium-term Scheduler-
Medium-term scheduler swaps-out the processes from main memory to
secondary memory to free up the main memory when required.
Thus, medium-term scheduler reduces the degree of multiprogramming.
After some time when main memory becomes available, medium-term
scheduler swaps-in the swapped-out process to the main memory and its
execution is resumed from where it left off.
Swapping may also be required to improve the process mix.
Comparison Of Schedulers-
It is a process swapping
It is a job scheduler It is a CPU scheduler
scheduler.
It controls the degree of It reduces the degree of It provides lesser control over
multiprogramming. multiprogramming. degree of multiprogramming.
It selects processes from new It swaps-out processes from It selects processes from the
state and loads them into main memory to secondary ready state and assigns to the
ready state. memory and later swaps in. CPU.
Degree of Multiprogramming-
In multiprogramming systems,
Multiple processes may be present in the ready state which are all ready for
execution.
Degree of multiprogramming is the maximum number of processes that can
be present in the ready state.
Long-term scheduler controls the degree of multiprogramming.
Medium-term scheduler reduces the degree of multiprogramming.