Introduction to Scheduler

In this topic, you will learn about, What is Scheduler?

A process migrates between the various scheduling queues throughout its lifetime. The O.S. must select, for scheduling purpose, processes from these queues in some fashion. The selection process is carried out by the appropriate schedulers.

Different types of a scheduler:

Mainly there are three types of schedulers:

  1. Long term schedulers or job scheduler.
  2. Short term scheduler or CPU scheduler.
  3. Medium-term scheduler.

Long Term scheduler: The process is speeded to a mass storage device, where they are kept for later execution. The long-term scheduler selects processes from this spool and loads them into the memory for execution. It executes much risk frequently. There may be minutes between the creation of new processes in the system. The long-term scheduler controls the degree of multi-program (the number of processes in memory). If the degree of multi-programming is stable than the average rate of process creation must be equal to the average departure rate of the process leaving the system.

It is important that the long-term scheduler makes a careful selection. In general, most processes can be described as either an input-output bond or CPU bound.

Short Term scheduler: the short-term scheduler selects from among the processes that are ready to execute and allocates the CPU to one of them. The short-term scheduler must select a new process for the CPU quite frequently. A process may execute for only a few milliseconds before waiting for an input-output request. Often, the short-term scheduler executes at least once every hundred milliseconds. Because of the short duration of the time between execution, the short-term scheduler must be very fast. If it takes ten milliseconds to decide to execute a process for 100 milliseconds then 10/ (10+10) = 9 percent of CPU is being used (wasted) simply for scheduling the work.

Medium Term scheduler: The key idea behind a medium-term scheduler is that sometimes it can be advantageous to remove processes from the memory and thus to reduce the degree of multiprogramming. At some later times, the process can be reintroduced into memory and its execution can be continued, where it left off this scheme is called swapping. The process is swapped out and swapped in later by the medium-term scheduler.