FOR FREE YEAR SOLVED

Long Term, Short-term and Mid-term Scheduler

 

Scheduler:

Scheduler is responsible for selecting a process for scheduling/operating with the resources from the queue, serving the resources.

 

Different Type of Scheduler 

 

(i) Long term scheduler (or Job scheduler:

In Long Term Scheduler, processes are scheduled from secondary memory to main memory (Ready State). The long term scheduler executes much less frequently; minutes may separate the creation of one new process and the next. Long Term Scheduler controls the degree of multiprogramming (The number of processes in main memory).

 

If the degree of multiprogramming is stable, then the average rate of process creation must be equal to the average departure rate of processes leaving the system. Thus, the long-term scheduler may need to be invoked only when a process leaves the system. Because of the long interval between executions, the long-term scheduler can afford to take more time to decide which process should be selected for execution.

 

It is important that the long-term scheduler make a careful selection. In general, a long term scheduler mix the processes of I/O bounded or CPU bounded because if all selected processes are I/O bounded then CPU will be ideal and If all processes are CPU bound, the I/O waiting queue will almost always be empty, devices will go unused, CPU will be a busy long time and again the system will be unbalanced. The system with the best performance will thus have a combination of CPU-bound and I/O-bound processes.

 

The long-term scheduler may be absent or minimal. For example, time-sharing systems such as -

 

Microsoft Windows and UNIX systems often have no long-term scheduler but simply put every new process in memory for the short-term scheduler. The stability of these systems depends either on a physical limitation (such as the number of available terminals)or on the self-adjusting nature of human users. If performance declines to unacceptable levels on a multiuser system, some users will simply quit. 

 

 (ii) Short term scheduling (or process scheduling):

After a job (program) has been placed on the ready queue (main memory) by long term scheduler, the short term scheduler takes over. It simply determines which process will get the CPU, and for how long. The short-term scheduler must select a new process for the CPU frequently.

 

A process may execute for only a few milliseconds before waiting for an I/O request. Often, the short-term scheduler executes at least once every100 milliseconds. Because of the short time between executions, the short-term scheduler must be fast. If it takes 10 milliseconds to decide to execute a process for 100 milliseconds, then 10/ (100 + 10) = 9 percent of the CPU is being used (wasted) simply for scheduling the work.

 

The Process Scheduler takes advantage of a common feature among most computer programs: they alternate between CPU cycles and I/O cycles. Notice that the following job has one relatively long CPU cycle and two very brief I/O cycles.

 

 

(iii) Midterm Scheduling:

Some operating systems, such as time-sharing systems, may introduce an additional, intermediate level of scheduling (mid-term scheduler). The key idea behind a medium-term scheduler is that sometimes when the system is overloaded, it can be advantageous to remove a process from memory(and from active contention for the CPU) and thus reduce the degree of multiprogramming. Later, the process can be reintroduced into memory, and its execution can be continued where it left off. This scheme is called swapping. The process that is swapped out and eventually swapped back in is managed by the middle-level scheduler.

 

Fig: 15