What are Scheduling Queues?

The processes that are entering into the system are stored in the Job Queue. Suppose if the processes are in the Ready state are generally placed in the Ready Queue.

The processes waiting for a device are placed in Device Queues. There are unique device queues which are available for every I/O device.

First place a new process in the Ready queue and then it waits in the ready queue till it is selected for execution.

Once the process is assigned to the CPU and is executing, any one of the following events occur −

  • The process issue an I/O request, and then placed in the I/O queue.

  • The process may create a new sub process and wait for termination.

  • The process may be removed forcibly from the CPU, which is an interrupt, and it is put back in the ready queue.

In the first two cases, the process switches from the waiting state to the ready state, and then puts it back in the ready queue. A process continues this cycle till it terminates, at which time it is removed from all queues and has its PCB and resources deallocated.

Types of Schedulers

There are three types of schedulers available which are as follows −

Long Term Scheduler

Long term scheduling is performed when a new process is created, if the number of ready processes in the ready queue becomes very high. Then, there is an overhead on the operating system, for maintaining long lists, containing switching and dispatching increases. Therefore, allowing only a limited number of processes into the ready queue, the long term scheduler manages this.

Long term scheduler runs less frequently. It decides which program must get into the job queue. From the job queue, the job processor selects processes and loads them into the memory for execution.

The main aim of the Job Scheduler is to maintain a good degree of Multiprogramming. The degree of Multiprogramming means the average rate of process creation is equal to the average departure rate of processes from the execution memory.

The diagram of long term and short term scheduler is as follows −

Short Term Scheduler

Short term scheduler is called a CPU Scheduler and runs very frequently. The aim of the scheduler is to enhance CPU performance and increase process execution rate.

Medium Term Scheduler

This type of scheduling removes the processes from memory and thus reduces the degree of multiprogramming. Later, the process is reintroduced into memory and its execution is continued where it left off. This is called swapping. The process is swapped out, and is later swapped in, by the medium term scheduler.

The diagram of medium term scheduler is as follows −