Tuesday, 15 September 2020

3 types of schedulers in OS: Long, short and medium term

 

 3 Types of Schedulers in OS:

 

An operating system has many schedulers. There are three main scheduler viz. long term scheduler, short term scheduler, and medium term scheduler.

 

1. Long Term Scheduler:

 

It is also termed as job scheduler. Its function is to select the jobs from the pool of jobs (job pool) and load these jobs into main memory (ready queue) of the computer.

 

The main objective of job scheduler is to provide balanced mix of jobs consisting of IO bound and CPU bound processes. It also controls the degree of multiprogramming. If degree of multiprogramming is stable, then average rate of process creation must be equal to average departure rate of processes leaving the system.

 A ready queue is a nothing but a queue. It is one type of data structure consisting of two ends. One end is called as front and another end is termed as rear. The jobs are loaded into the ready queue through the front; and these jobs are deleted through the rear.


Insertion and deletion in ready queue


A long term scheduler may be absent or minimal in some systems. It is absent in time sharing systems. When a process changes its state from new to ready, long term scheduler comes in play.


2. Short Term Scheduler:

 

It is also called as CPU scheduler. Function of the short term scheduler is to select a job from the ready queue and gives the control of the CPU to that process with the help of a Dispatcher. The main objective is to increase system performance with respect to the chosen set of criteria. The method of selecting a process from the ready queue depends on the CPU scheduling algorithm. It executes most frequently and is faster compared to long term scheduler.

 

Dispatcher:

 

A dispatcher is a module that connects the CPU to the process selected by the short-term scheduler. The main functions of the dispatcher are:

·         switching the CPU from one process to another process (context switch)

·         switching to user mode

·         jumping to the proper location in the user program and ready to start execution

 

The dispatcher should be fast because it is invoked during each and every process switch. The time taken by dispatcher to stop one process and start another running is known as dispatch latency. The degree of multiprogramming depends greatly on the dispatch latency. It is also sometimes called short term scheduler. If the dispatch latency increases, then degree of multiprogramming decreases.

 

3. Medium Term Scheduler:

 

It is a part of swapping function. If a process requests an IO in the middle of the execution, then that process is removed from main memory and loaded into waiting queue. When the IO operation completes, then the job is moved from waiting queue to ready queue. These two operations are commonly termed as swapping and are performed by the medium term scheduler. It reduces the degree of multi programming.

 



No comments:

Post a Comment