/**/ Types of Schedulers in Operating System - Dextutor

Types of Schedulers in Operating System

The goal of a multiprogramming system tries to keep the CPU busy at all times. For a Time-sharing system, the goal is to switch between user processes so that each user can interact with the process. So, to meet these goals a scheduler selects one out of many available processes for execution by the CPU. There are different types of schedulers in operating system – long term scheduler, short term scheduler and medium-term scheduler.

Scheduling Queues

  1. Job queue – comprise of all processes in the system
  2. Ready queue – comprise of all processes residing in the main memory that are ready to run
  3. Device queue – processes waiting for a particular device

A queuing diagram as shown in the figure below represents the scheduling process. There are Two queues – ready queue and device queue. A new process is first admitted into the ready queue. It waits until it is dispatched (allocated to the CPU for execution).
Once the process starts executing by the CPU, five possibilities arise:

types of queues in os
  1. The process terminates normally and it exits the system
  2. The process issues a I/O request and moves into the device queue. Once it gets the I/O device, it is back into the ready queue
  3. The time quantum of the process expires (remember in a time-sharing system, every process gets a fixed amount of CPU time). Then, the process is added back into the ready queue
  4. The process creates a child process and waits for the child process to terminate. Hence, it itself is added to the ready queue)
  5. A higher priority process interrupts the currently running process. Thus, forcing the current process to change its state to ready state.

Types of Schedulers in Operating System

  1. Long Term Scheduler (LTS)
  2. Short Term Scheduler (STS)
  3. Medium Term Scheduler (MTS)
types of schedulers in os

The job queue consists of all process generated in the system. These reside in the secondary storage. Since, the size of secondary storage device is more than the RAM, all the processes in the job queue can not be accomodated in the RAM. Hence, to select a few out of all the processes in the Job queue is the task of the Long Term Scheduler.

All the processes in the RAM reside in the ready queue. Since there is one CPU, so the OS selects only one process from the ready queue to allocate to the CPU. This selection is made by the OS module known as Short Term Scheduler.

A process is of two types –
CPU bound process – if it spends most of its time with CPU) process
I/O bound process – if it spends most of its time with I/O devices).
It is important to have a mix of CPU bound and I/O bound process in the RAM (to use all the resources). Since the system can not determine whether a process is CPU or I/O until it is run atleast once the selection done by long-term scheduler might consist of mostly CPU or mostly I/O processes. Hence, if the mix is not good then the OS swaps some of the processes with those in the job queue. This swapping is the task of the Medium-term scheduler. Finally, the swapping may also be required to lower the degree of multi-programming or to incorporate a higher priority process in the RAM if sufficient space is not there in RAM.

Note: Refer the video lecture for more details on types of Schedulers


Which Process controls the degree of multi-programming?

Context Switch

Whenever the CPU shifts from one process to another it need to save the context of the running process so that it can be loaded again when it gets the CPU next time. Therefore, this context is represented in the PCB of the process. Switching the CPU from one process to another process requires performing a state save of the current process and a state restore of a different process. This task is known as context switch

PPT on Types of Schedulers in Operating Systems

Note: Clicking on the “next” slide button will not display any animation. Hence, Click within the slide area for animations.

Video on Types of Schedulers in Operating Systems

types of schedulers in Operating system

Previous                                            Next

Process and Process states               Operations on Process

Leave a Comment