Home >>Operating System Tutorial >Operating System Process Scheduling

Operating System Process Scheduling

Operating System Process Scheduling


Process scheduling is the process manager's operation which handles removing the running process from the CPU and selecting another process on the basis of a specific strategy.

Process scheduling is an integral part of an operating system for multiprogramming. Such operating systems allow loading of more than one process into the executable memory at a time and sharing the CPU with the loaded system using multiplexing time.

Process Scheduling Queues

In Process Scheduling Queues the OS maintains all PCBs. The OS maintains a separate queue for each process state, and PCBs are put in the same queue of all processes in the same execution state. When a process changes its status, its PCB is unlinked from its current queue and transferred to its new state queue.

The OS maintains the following essential process scheduling queues-

  • Job queue − This queue manages all processes inside the system.
  • Ready queue − This queue contains a collection of all processes residing in the main memory, ready to execute and waiting. Often placed a new process in the queue.
  • Device queues − This queue is formed by the processes that are interrupted due to unavailability of an I / O device.

Operating System

To control each queue the OS can use different policies (FIFO, Round Robin, Priority, etc.). The OS scheduler decides how to transfer processes between ready-to-run queues which can only have one entry per processor core on the system; merged with the CPU in the diagram above.

Two-State Process Model

The Two-state process model refers to running and non-running states listed below.

Sr No State & Description
1. Running
When a new process is developed, it enters the system just as it is in the running state.
2. Not Running
Processes that don't run are kept in queue, waiting for their turn to be executed. -- Queue entry is a reference to a specific method. Queue is implemented by the use of linked list. The use of dispatcher shall be as follows. The process is transferred in the waiting queue when a process is interrupted. After completion or termination of the process, the process is discarded.


Schedulers are special system software which handles the scheduling of processes in different ways. Their main role is to pick the jobs that are to be submitted into the system and determine which process to run. Schedulers come in three types-

  • Long-term Schedule
  • Short-term Schedule
  • Medium-Term Schedule

Long Term Scheduler

It is also regarded as a work scheduler. A long-term scheduler specifies which programmes are being admitted to the processing system. It selects processes from the queue, and loads them for execution into memory. For CPU scheduling process loads to the memory.

The work scheduler's primary objective is to provide a balanced mix of jobs, including I / O bound and processor bound. It also regulates multiprogramming degree. If the degree of multiprogramming is constant, then the average process creation rate must be equal to the average process departure rate that leaves the system.

The long-term scheduler may not be available on some systems, or limited. Operating systems that share time do not have a long-term scheduler. If a process changes the state from new to ready, then the long-term scheduler is used.

Short Term Scheduler

It is often referred to as a CPU scheduler. Its main goal is to improve system efficiency according to the specified set of criteria. It's the transition from ready-to-run to process state. CPU scheduler selects a process from among the processes that are ready to run and assigns one of them to the CPU.

Short-term schedulers, which are also known as dispatchers, determine which procedure to execute next. Short term schedulers are quicker than schedulers in the long term.

Medium Term Scheduler

A part of swapping is medium term scheduling. It deletes the memory processes. It lowers multiprogramming degree. The medium term scheduler is responsible for managing the swapped out-processes.

If it makes an I / O request, a running process can become suspended. A process which has been suspended can not make further progress towards completion. In this state the suspended process is transferred to the secondary storage to remove the process from memory and give space for other processes. This method is called swapping, and is said to have been swapped or rolled out.

Comparison among Scheduler

S.N. Long-Term Scheduler Short-Term Scheduler Medium-Term Scheduler
1. It is a job scheduler It is a CPU scheduler It is a process swapping scheduler.
2. Speed is lesser than short term scheduler Speed is fastest among other two Speed is scheduler for both the short and the long term.
3. It regulates multiprogramming degree It offers a lesser degree of control over multiprogramming It lowers multiprogramming degree.
4. It is nearly absent or minimal in system of time sharing It is also minimal in time sharing system It is a part of Time sharing systems.
5. It selects processes from the pool and loads them to running memory It selects certain processes ready to be executed It can re-introduce the process into memory, and it can begin execution.

Context Switch

A context switch is the mechanism to store and restore a CPU's state or context in the Process Control block so that a process execution can be resumed at a later date from the same point. Using this method, a context switcher allows the sharing of a single CPU by many processes. Context switching is an integral part of the functionalities of a multitasking operating system.

When the scheduler moves the CPU from executing one process to executing another, the state is stored in the process control block from the current process running. After that, the state for next running process is loaded from its own PCB and used to configure the PC, registers, etc. The second process can then start executing at that point.

Operating System

Context switches are computationally intensive because they need to save and restore the register and memory state. Some hardware systems employ two or more sets of processor registers to reduce the sum of context processing time. The following information is processed for later use when the process is moved to.

  • Program Counter
  • Scheduling information
  • Base and limit register value
  • Currently used register
  • Changed State
  • I/O State information
  • Accounting information