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-
- Long-term scheduler
- Short-term scheduler
- Medium-term scheduler
1. Long-term Scheduler-
The primary objective of long-term scheduler is to maintain a good degree of multiprogramming. |
- 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-
The primary objective of short-term scheduler is to increase the system performance. |
- 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-
The primary objective of medium-term scheduler is to perform swapping. |
- 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-
Long-term scheduler | Medium-term scheduler | Short-term scheduler |
It is a job scheduler | It is a process swapping scheduler. | It is a CPU scheduler |
It controls the degree of multiprogramming. | It reduces the degree of multiprogramming. | It provides lesser control over degree of multiprogramming. |
Speed is lesser than short-term scheduler | Speed is in between the long-term and short-term schedulers. | Speed is fastest among the other two. |
It is minimal or almost absent in time sharing system. | It is a part of time sharing system. | It is also minimal in time sharing system. |
It selects processes from new state and loads them into ready state. | It swaps-out processes from main memory to secondary memory and later swaps in. | It selects processes from the ready state and assigns to the CPU. |
Operates less frequently since processes are not rapidly created. | Operates more frequently than long-term scheduler but less frequently than short-term scheduler. | Operates very frequently to match the speed of CPU since CPU rapidly switches from one process to another |
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.
Optimal Degree of Multiprogramming-
- An optimal degree of multiprogramming means average rate of process creation is equal to the average departure rate of processes from main memory.
- It is the responsibility of long-term scheduler to maintain a good degree of multiprogramming.
To gain better understanding about Schedulers in OS,
Next Article- Various Times Of Process
Get more notes and other study material of Operating System.
Watch video lectures by visiting our YouTube channel LearnVidFun.