Schedulers play a crucial role in managing the allocation of resources and executing processes efficiently. Among the various types of schedulers Long term short term and medium term schedular stand out, each serving distinct functions within the system.
In a computer system, an important function of the operating system (OS) is to manage the processes. There are three main types of schedulers: Long term short term and medium term schedular. Let us understand these three schedulers in simple terms.
In this article, we are going to tell you the difference between schedulers and their importance, along with its specific role, features and what impact it has on system performance.
What is Long Term scheduler in OS ?
The long term scheduler is also called the job scheduler. This scheduler decides which processes (jobs) enter the system and when to produce output. It loads jobs into the computer's memory (RAM) so that they can run on the CPU.
Functions of Long Term Scheduler :
1. Job Selection:
- The long term scheduler decides which new processes are to enter the system.
- It selects the jobs keeping in mind the facts of the system.
- Loads the selected jobs into the memory (RAM).
- It ensures that the jobs come into the ready state so that the short term scheduler can run them on the CPU.
3. Managing the Baseline:
- The long term scheduler ensures the proper utilization of the system's baseline.
- It makes sure that there are not too many jobs on the system, which does not affect the system aspects.
Benefits of Long Term Scheduler :
- The long term scheduler ensures that only as many processes run on the system as the resources can handle.
- This improves the speed and effectiveness of the system.
- This scheduler maintains a balance between CPU and memory.
- This increases the stability of the system and makes better use of resources.
- The long term scheduler can decide to run important jobs first.
- This ensures that important jobs are completed quickly and increases user satisfaction.
Examples of Long Term Scheduler :
- Old batch processing systems used long term schedulers.
- In this, jobs were loaded in a batch and then they were run one by one.
- Modern operating systems, such as Windows and Linux, also use long term schedulers.
- These systems use this scheduler to manage their jobs effectively.
What is Short Term Scheduler in OS ?
Functions of Short Term Scheduler :
- The short term scheduler selects one of the processes present in the ready state to run on the CPU.
- This selection takes place at an interval of a few milliseconds, so that the CPU can be utilized optimally.
- This scheduler decides to run processes on the CPU based on their priority.
- Processes with high priority are run first, while processes with low priority are run later.
- The short term scheduler also performs context switching.
- This involves removing one process from the CPU and running another process.
- This happens very fast, so that the user does not feel any delay.
Benefits of Short Term Scheduler :
- Short term scheduler helps the system to respond faster.
- This gives a better experience to the users as they do not feel any delay in their tasks.
- This scheduler ensures that the CPU is used to the maximum.
- This increases the performance of the system and tasks are completed faster.
- Short term scheduler manages the processes on the basis of priority.
- This allows the important processes to complete first, thereby increasing the efficiency of the system.
Examples of Short Term Scheduler :
- In this technique, all the processes are given equal time slots one by one.
- This technique is simple and ensures that all the processes run fairly.
- In this, processes are run on the CPU based on their priority.
- Processes with higher priority are run first.
- In this, the process which comes first is run first.
- This is the simplest scheduling technique.
What is medium Term Scheduler in OS ?
Functions of Medium Term Scheduler :
- The main function of medium term scheduler is swapping.
- This scheduler takes out the processes from memory that are not required to run immediately.
- These processes can be brought back later when space is available in the memory.
- Medium term scheduler manages the memory so that the functionality of the system is maintained.
- It ensures that the memory is used effectively and no process is occupying space in the memory unnecessarily.
- This scheduler improves the performance of the system.
- By swapping processes as needed, this scheduler ensures that only the necessary processes remain in the memory.
Benefits of Medium Term Scheduler :
Better Memory Utilization:
- The medium term scheduler ensures better memory utilization.
- By swapping out unnecessary processes, it makes space in the memory.
Improving Performance:
- This scheduler improves the speed and performance of the system.
- Only the necessary processes remain in the memory, making the system work faster.
Balancing of Processes:
- The medium term scheduler maintains a balance between the processes.
- It ensures that the processes in the system run at the proper time and enough space is maintained in the memory.
Examples of Medium Term Scheduler :
- In virtual memory systems, the medium term scheduler is used for swapping processes.
- This leads to effective use of memory and increases the efficiency of the system.
- In multi-programming systems, the medium term scheduler performs swapping between different processes.
- It ensures that all the processes run at the proper time.
Comparison of Long-Term, Short-Term, and Medium-Term Schedulers
Feature | Long-Term Scheduler | Short-Term Scheduler | Medium-Term Scheduler |
---|---|---|---|
Function | Determines which processes are admitted to the system for processing. | Decides which of the ready, in-memory processes are executed by the CPU. | Handles swapping processes in and out of memory to manage the degree of multiprogramming. |
Frequency | Runs less frequently, e.g., when a new process is created. | Runs very frequently, often every few milliseconds. | Runs moderately frequently, depending on the need to swap processes. |
Speed | Relatively slow, as it involves selecting which processes to admit. | Very fast, as it involves selecting from the ready queue. | Moderate speed, as it involves swapping processes between memory and disk. |
Goal | To provide a balanced mix of CPU-bound and I/O-bound processes. | To maximize CPU utilization and provide responsive time-sharing. | To manage memory and ensure that there is enough space for new processes. |
Also Known As | Job Scheduler | CPU Scheduler | Swapping Scheduler |
Example Usage | Selecting which jobs (processes) to load into the system from a job queue. | Choosing which ready process will execute next on the CPU. | Swapping out a process to disk to make space for a new process in memory. |