What is Long-Term, Short-Term, and Medium-Term Scheduler?

In the Operating System, CPU schedulers are used to handle the scheduling of various processes that are coming for its execution by the CPU. Schedulers are responsible for transferring a process from one state to the other. Basically, we have three types of schedulers i.e.

  1. Long-Term Scheduler
  2. Short-Term Scheduler
  3. Medium-Term Scheduler

In this blog, we will learn about these schedulers and we will see the difference between them. Also, at the end of the blog, we will look where these schedulers are placed in the Process State Diagram. So, let's get started.

Long-Term Scheduler

Long-Term schedulers are those schedulers whose decision will have a long-term effect on the performance. The duty of the long-term scheduler is to bring the process from the JOB pool to the Ready state for its execution.

Long-Term Scheduler is also called Job Scheduler and is responsible for controlling the Degree of Multiprogramming i.e. the total number of processes that are present in the ready state.

So, the long-term scheduler decides which process is to be created to put into the ready state.

Effect on performance

  • The long term scheduler is responsible for creating a balance between the I/O bound(a process is said to be I/O bound if the majority of the time is spent on the I/O operation) and CPU bound(a process is said to be CPU bound if the majority of the time is spent on the CPU). So, if we create processes which are all I/O bound then the CPU might not be used and it will remain idle for most of the time. This is because the majority of the time will be spent on the I/O operation.
  • So, if we create processes that are having high a CPU bound or a perfect balance between the I/O and CPU bound, then the overall performance of the system will be increased.

Short-Term Scheduler

Short-term schedulers are those schedulers whose decision will have a short-term effect on the performance of the system. The duty of the short-term scheduler is to schedule the process from the ready state to the running state. This is the place where all the scheduling algorithms are used i.e. it can be FCFS or Round-Robin or SJF or any other scheduling algorithm.

Short-Term Scheduler is also known as CPU scheduler and is responsible for selecting one process from the ready state for scheduling it on the running state.

Effect on performance

  • The choice of the short-term scheduler is very important for the performance of the system. If the short-term scheduler only selects a process that is having very high burst time(learn more about burst time from here ) then the other process may go into the condition of starvation(learn more about starvation from here ). So, be specific when you are choosing short-term scheduler because the performance of the system is our highest priority.

The following image shows the scheduling of processes using the long-term and short-term schedulers.

Medium-Term Schedulers

Sometimes, you need to send the running process to the ready state or to the wait/block state. For example, in the round-robin process, after a fixed time quantum, the process is again sent to the ready state from the running state. So, these things are done with the help of Medium-Term schedulers.

Medium-term schedulers are those schedulers whose decision will have a mid-term effect on the performance of the system. It is responsible for swapping of a process from the Main Memory to Secondary Memory and vice-versa.

It is helpful in maintaining a perfect balance between the I/O bound and the CPU bound. It reduces the degree of multiprogramming.

The following diagram will give a brief about the working of the medium-term schedulers.

Long-term vs Short-term vs Medium-term Schedulers

Following is the difference between the long-term, short-term, and medium-term schedulers:

Place of schedulers in the Process State Diagram

The Process State Diagram is used to display the flow of processes from one state to other. In this portion of the blog, we will see the position of long-term, short-term, and medium-term schedulers in the Process State Diagram. Following is the image of the same:

That's it for this blog. Hope you enjoyed this blog.

Do share this blog with your friends to spread the knowledge. Visit our YouTube channel for more contents.

Keep Learning :)

Team AfterAcademy!