What is scheduler?
To execute many processes together on the CPU.
The scheduler selects the process form the ready queue and allocates the CPU to that process…
Ready queue is maintained by any of the scheduling algorithms like First come first served, shortest job first or priority scheduling algorithm etc.
Long-term scheduler
The long-term scheduler selects a job from the job queue and allows a process to load it into the main memory. It means that this is the schedule that handles that how much maximum jobs/processes can be loaded on the main memory.
Sometimes the number of processes submitted to the system are more than it can be executed immediately. Then in such cases, the processes are spooled on the mass storage, where they reside to get executed later.
The Long-Term Scheduler then select the process from this spool which is also called as Job Pool and load them in the Ready Queue for their further execution.
Job Scheduler
Short term scheduler
Short term scheduler selects a process from ready queue and allocates CPU to that process. After this state of a process is change from ready state to running state.
CPU Scheduler
The frequency of Long-Term Scheduler to pick up the processes from Job pool is less as compared to the Short-Term Scheduler.
Differences between Long-term Scheduler & Short-term Scheduler
BASIS FOR COMPARISON | BASIS FOR COMPARISON | SHORT-TERM SCHEDULER |
---|---|---|
Basic | It picks up the process from Job Pool/Job Queue. | It picks up the process from Ready Queue. |
Frequency | Long-Term Scheduler selects the process less frequently. | Short-Term Scheduler select the process more frequently. |
Control | It controls the Degree of Multiprogramming. | It has less control over the Degree of Multiprogramming. |
Alternative | Alternatively, it is called Job Scheduler. | Alternatively, it is called CPU Scheduler. |
Important | Long-Term Scheduler is there in Batch Systems but it may or may not be present in Time Sharing System. | Short-Term Scheduler is there in Batch System and is minimally present in the Time Sharing System also. |
Key Differences Between Long-Term Scheduler and Short-Term Scheduler
- The Long -Term Scheduler select the processes from the Job pool. On the other hand, the Short-Term Scheduler selects the processes from the Ready queue.
- The Short Term Scheduler executes more frequently as compared to the Long-Term Scheduler.
- Long-Term scheduler controls the degree of multiprogramming whereas, the Short-Term Scheduling has less control over the degree of Multiprogramming.
- Long-Term Scheduling is also called Job Scheduler. On the other hand, the Short-Term Scheduling is also called CPU Scheduler.
- The Long-Term Scheduler is necessarily there in Batch System and may or may not be minimally present in the Time sharing system. On the other hand, the Short-Term Scheduler is there in Batch System and also minimally present in the Time Sharing System.
Medium-term scheduler
Most often, a running process needs I/O operation which doesn’t requires CPU. Hence during the execution of a process when a I/O operation is required then the operating system sends that process from running queue to blocked queue. When a process completes its I/O operation then it should again be shifted to ready queue. ALL these decisions are taken by the medium-term scheduler. Medium-term scheduling is a part of swapping.
The medium-term scheduler can be added if the degree of multiple programming needs to decrease
The degree of multiprogramming describes the maximum number of processes that a single-processor system can accommodate efficiently.
A medium-term scheduler is responsible for swapping. Some jobs are swapped from hard disk to the main memory and some jobs can be swapped out from the main memory to the hard disk.
Dispatcher
The dispatcher is the module that gives a process control over the CPU after it has been selected by the short-term scheduler.
Function as Following Steps:
- Context Switching
- Switch to user mode
- Jumping to proper location when process again restarted
The time taken by dispatcher is called dispatch latency.
Reference
https://techdifferences.com/difference-between-long-term-and-short-term-scheduler.html
https://www.geeksforgeeks.org/difference-between-dispatcher-and-scheduler/