Long-term scheduler
- The long term scheduler works with batch queue and selects the next batch job executed. Thus it plans the CPU scheduling for batch jobs. Processes, which are resource intensive and have a low priority are called batch These jobs are executed in a group or bunch. For example, a user request for prate bunch of files.
- We can also say that a long term scheduler selects the processes or job from secondary storage device e.g. a disk and loads them into the memory for execution. t is also know as job scheduler.
- The frequency of execution of a long-term scheduler is usually low, as there may be minutes between the creation of new processes in the system.
- The long term scheduler is called “long-term” because the time for which the scheduling is valid is long.
Short-term scheduler
- The short-term scheduler selects from among the ready processes that are residing in the main memory and allocates CPU to one of them.
- Thus, it plans the scheduling of the processes that are in ready state.
- Short term scheduler is also known as CPU scheduler.
- As compared to long term schedulers, a short term scheduler has to work very often i.e. the frequency of execution of short-term scheduler is high.
Difference between Short term scheduler and Long term scheduler
S. No. | Short term scheduler | Long term scheduler |
1. | Short term scheduler plans the scheduling of the process that are in ready state. | Long term scheduler plans the CPU scheduling for batch jobs. |
2. | It selects a process from among the ready processes that are residing in the main memory. | It works with batch queue and selects the process from secondary storage devices and loads them into memory for execution. |
3. | It is also known as CPU scheduler. | It is also known as job scheduler. |
4. | The frequency of execution of short term scheduler is high as it has to work very often. | The frequency of execution of long term scheduler is usually low as there may be minutes between the creation of new process in the system. |
5. | The short term scheduler is invoked whenever an event occurs such as clock ticks, operating system calls. | The long term scheduler needs to be invoked only when the process leaves the system. |
6. | The presence of short term scheduler is must in a system as it has to select a process for CPU from the ready queue. | The long term scheduler may be absent or minimal in some systems. For e.g., timesharing system such as UNIX often has no long term scheduler. |