Almost all operating system based or bare metal computing systems use schedulers to schedule processes, threads, and tasks to execute on functional units. Scheduling algorithms are used for the allocation of CPU resources to all the processes that want to execute on the CPU. Schedulers provide an efficient and time-sharing mechanism for maximum utilization of CPU resources. The two most commonly used schedulers in modern operating systems ( Windows and Linux ) are short-term scheduler and long-term scheduler.
The major difference between the short-term scheduler and the long-term scheduler is that the long-term scheduler selects processes from the job pool and places them in the ready queue and on the contrary, the short -term scheduler selects processes from the ready queue and assigned them CPU for execution. The followings are some popular scheduling algorithms:
Before we get to know the real meaning of these schedulers, first let’s define the main difference between them one by one.
Comparison table of long and Short Term Scheduler
There are some key points that distinguish a long-term scheduler from a short-term scheduler. The prominent ones are as follows:
This scheduler is known as a job scheduler. It selects the jobs from the available jobs pool.
This scheduler is known as the CPU scheduler and it allocated CPU to the processes.
A long-term scheduler access job pool and ready-queue. It selects the process from the Job pool. It then loads the process in the ready queue. The job scheduler selects jobs from the disk ( Secondary storage)
A short-term scheduler access ready-queue and CPU. It selects the process from the Ready Queue and allocates CPU to them. It selects ready processes from the main memory.
Long-term Scheduler selects the process much less frequently as compared to the short-term scheduler. The reason is that it needs to check whether the memory has space or not. It executes the process only when the memory has some free space to accommodate the new process successfully
A short-term scheduler can select the process frequently. The reason is that this scheduling takes account of CPU only. It starts executing a job when CPU is available for allocation.
A long-term scheduler can easily manage the degree of multiprogramming
A short-term scheduler cannot manage the degree of multiprogramming easily
A long-term scheduler is present in Batch System and not in Time-Sharing System
A short-term scheduler is present in both Batch Systems and Time-Sharing System
It has a slower speed
|It has a faster speed than long term scheduler
Schedulers handle process scheduling in different ways. It allows an operating system to track and schedule computer batch tasks. The scheduler picks the jobs to be submitted into the computer CPU and start executing them.
A scheduler in the operating system starts and handles jobs automatically by direct communication with a human user or by using some primed job control language algorithm. Schedulers are of three types’ i.e. short-term scheduler, long-term scheduler, and medium-term scheduler.
- In long-term scheduling, it is also known as a job scheduler. the process is selected from the job pool and loaded into the memory for CPU scheduling.
- Another name used for the long-term scheduler is the job scheduler. The main purpose of the job scheduler is to present a balanced mix of jobs, such as processor bound and I/O bound.
- This particular type of scheduling controls the measure of multiprogramming. In the case of a stable degree of multiprogramming, the average rate of process formation is equivalent to the average departure rate of processes exiting the system.
- It selects a combination of CPU bound and I/O bound processes to capitulate the most favorable system throughput.
- In short, it is responsible for creating new processes and bringing them in the system ( Read Queue)
- The main idea of short-term scheduling is to boost the performance of the system following the selected set of criteria.
- Short-term scheduling is the change of ready state to the running state of the process. Another name used for the short-term scheduler is the CPU scheduler.
- This scheduler executes much more frequently as compared to a long-term scheduler. The selection of the process must be done with proper care.
- In case a process with a long burst time is selected then all the succeeding processes will have to wait for a long time in the ready queue. This usually happens if a wrong assessment is prepared by the short-term scheduler.
Example of long-term and short term Scheduler
- This diagram shows the overall structure of modern computing systems where processes are loaded from hard disk or secondary storage into RAM ( into the ready queue) and after that processes available in ready queue are executed on the CPU.
- Longterm scheduler loads processes from job queue into the ready queue.
- Here you can see the job scheduler loads one process from the job queue into the main memory and ready queue. The functions of longterm scheduler end here.
- Now short term scheduler selects a process from the ready queue to get it executed on the CPU.
- This is a last step where the process finally starts its execution on the CPU and these steps continue.
- Ready queue always contains multiple processes that are ready to execute on the CPU.
- The allocation of CPU to a specific process available in a ready queue depends on the scheduling algorithm used by the operating system.
- Some most commonly used scheduling algorithms are Round Robin, last in first out, earliest deadline first, rate monotonic and least laxity first.
- In summary, both Long-Term and Short-Term Schedulers are important for scheduling purposes of processes ready to execute on the CPU .
- All processes should be first loaded into the ready queue. Processes in the ready queue get executed according to scheduling policy.
- The job of a long-Term Scheduler is to load the process from the job pool to the Ready Queue whereas a Short-Term Scheduler allocates CPU to the process present in the Ready Queue.