Code360 powered by Coding Ninjas X Code360 powered by Coding Ninjas X
Last Updated: Mar 27, 2024

Scheduling in Operating System

Author Yashesvinee V
0 upvote
Operating system track
Free guided path
14 chapters
83+ problems
Earn badges and level up
Operating System


An operating system runs many programs and processes in a computer system. The most important function of an OS is allocating resources to all executing processes. Since many programs run concurrently and attempt to access the same resources, it is extremely important to schedule them accordingly to avoid conflicts. Process scheduling in operating systems is a task that involves allocating CPU time and resources for all processes that need to be executed.

Also see, Types of Operating Systems, Multiprogramming vs Multitasking and FCFS Scheduling

What is Process Scheduling?

Process scheduling in operating systems is carried out by a process manager that handles the sequence of process execution in the CPU using a particular strategy. It keeps the CPU up and running at all times to maximize its utilization. The main purpose of scheduling in operating systems is to determine which process should be allotted to the CPU and which should be put on hold.  

Also see, Scheduling Algorithms in Operating Systems, Open Source Operating System.

Get the tech career you deserve, faster!
Connect with our expert counsellors to understand how to hack your way to success
User rating 4.7/5
1:1 doubt support
95% placement record
Akash Pal
Senior Software Engineer
326% Hike After Job Bootcamp
Himanshu Gusain
Programmer Analyst
32 LPA After Job Bootcamp
After Job

Categories of Scheduling

There are two categories of scheduling in the operating system. Below are the two categories of scheduling. We will discuss each of them in detail. 

  1. Preemptive
  2. Non-Preemptive

Let's understand each of them in detail: 

Preemptive: In this scheduling, the OS allocates a resource to the process for a fixed time interval. The process state changes from waiting to ready or ready to running state. The switch in the process happens because OS gives other processes a higher priority and replaces the lower priority process with the higher priority. 

Non-Preemptive: In this, once the resource is allocated to a process, it cannot be changed. It only changes when process execution is completed, or process is moving to the waiting state.  

Process Scheduling Queues

Process Control Blocks (PCB) or task control blocks store all the attributes of a given process. PCBs are maintained and arranged in Process Scheduling Queues by the Operating System. Queues help track the sequence of scheduling in operating systems. All processes of the same execution state are placed in the same queue. Hence, after every execution, a PCB changes its queue. There are three types of Process scheduling queues that aid scheduling in Operating Systems.

  1. Job queue – Any process that is created is placed in this queue. It stores the most number of the processes in the system.
  2. Ready queue – Processes ready for execution are stored in this queue. All processes stored in the memory can be found on this queue.
  3. Device queues – This queue stores the processes whose execution is temporarily suspended due to the requirement of I/O devices.

process scheduling queue

All PCBs initially present in the Job queue move into the Ready queue for execution. The CPU is assigned a process from the ready queue one by one. This is taken care of by the process of scheduling in operating systems. If a process requires an I/O device for execution, it is sent to the device queue to wait for its resource. After execution, the process is terminated.

Must Read Multiprocessing Operating System

Types of Process Schedulers

Schedulers are system software that helps handle process scheduling in operating systems. Schedulers can be of three main types.

Long Term Scheduler

Long-Term Schedulers or Job Schedulers control the total number of processes ready to be executed. This is also known as the Degree of Multi-programming. An optimal degree of Multiprogramming means that the average rate of process creation is equal to the average rate of processes leaving the execution memory. Long-Term schedulers tend to have a long-term effect on the system’s performance. It brings the process from the Job queue to the Ready queue for execution. It helps maintain the balance between I/O and CPU bound process executions.

Short Term Scheduler

A short-Term Scheduler, also known as a CPU scheduler is responsible for selecting a process from the ready queue for scheduling it in the running state. They only select the process to be scheduled and do not load the process to run. Short-term schedulers have a short-term effect on the performance of the system. Scheduling algorithms such as FCFS or Round-Robin, or SJF are used here. Short-term schedulers ensure no starvation due to high burst time processes.


It is a module that connects the CPU to the process selected by the short-term scheduler. The dispatcher’s main function is switching the CPU from one process to another process. It also helps navigate to an appropriate location in the user program and get ready to start execution. Dispatch latency is the amount of time taken by the dispatcher to suspend one process and start the execution of another. 

Medium Term Scheduler

Medium-term schedulers are responsible for suspending and resuming a process. They help swap a process from the Main Memory to the Secondary Memory and vice-versa. A running process is suspended when it makes an I/O request. In this condition, the process must be removed from the memory to make way for the following processes. The suspended process is moved to the secondary storage. This is called swapping and is carried out by the Medium-term scheduler. The long-term scheduler helps maintain a perfect balance between the I/O bound and the CPU bound. 

Also see, Process Scheduler

Read about Batch Operating System here.

Comparison among Scheduler

S.No Long-Term Scheduler Short-Term Scheduler Medium-Term Scheduler
1 It is a job scheduler process.  This uses CPU scheduling.  This process uses a swapping scheduler. 
2.  Selects the process from the pool based on performance and resource availability.  Select a process from the ready queue for execution on the basis of multiple factors. Finds the process to be swapped in and out. 
3.  Executes less frequently.  Executes very frequently every time the process transitions to the running state.  Executes more frequently than the long term scheduler. 
4.  Spess is lesser than short-term scheduler. Fastest amongst the two. Speed is in between the long-term and short-term scheduler. 
5.  It controls the degree of multiprogramming. It gives less control over how much multiprogramming is done.  It reduces the degree of multiprogramming. 
6 It is almost absent or barely in the sharing process.  It is also minimal in the sharing process. It is a part of the time-sharing process. 

Two-State Process Model Short-Term

A process in a short-term two-state process model is either in the running or non-running state(waiting or blocked).

Running state: When the process is in a running state, that means it is currently getting executed. CPU is in use and executes the instructions of the process. The CPU resources are being utilized, and it executes until certain conditions are met. 

Non-running state: The processes that are not running are in the non-running state, which means either they are in the waiting queue or being blocked. These processes are waiting for the completion of the running process or for a resource to become available. LinkedList is used to maintain this queue operation. 

Context Switching

Context switching is an important process in operating systems. Context switching is a mechanism mainly used to restore the state of a process or the context of the CPU in the process control block. For the process to run from the state, it left, context switching plays a vital role. A context switcher in context switching helps in utilizing the single CPU to run multiple processes.  When the scheduler switches the state of the process from the running state to waiting, the current state of the process is stored in the process control block and the context switcher helps in switching one process execution to another. A multiprogramming operating system must include context switching among its processes. When the process is switched, it stores the following details of the running process:

  • Program Counter 
  • Information on scheduling
  • Base and limit register values
  • Register currently used 
  • Changed state
  • I/O state operation 
  • Accounting information

Frequently Asked Questions

What is scheduling and its types?

Scheduling in the operating system determines the order of the processes in which it gets executed by the CPU. It helps in better utilization of the CPU to perform multiple tasks. There are different types of scheduling: long-term, short-term, and medium-term. 

What is scheduling criteria in OS?

CPU scheduling depends on different criteria such as CPU utilization time, priority state of the process, Throughput, Turnaround time, waiting time, completion time, response time, and many other factors that help decide the criteria in the operating system. 

What are the criteria that affect a scheduler's performance?

Effective utilization of the CPU, Throughput (number of jobs completed in unit time), Response time (time taken to respond to a request), Turnaround time(time taken to execute a process), waiting time(time taken for resource allocation when multiple processes compete for the same resource), and fairness (ensure that every process gets a fair share of the CPU) are the factors that determine the performance of a scheduler.

What is the need for process scheduling?

A typical process involves I/O time and CPU time. For processes requiring I/O devices for execution, the time spent waiting for I/O is wasted, and the CPU is free. In multiprogramming systems, one process can use the CPU while another waits for its I/O resource. Such an arrangement can be made only using process scheduling in operating systems.


In this article, we have extensively discussed Scheduling in Operating Systems. We started with a brief introduction to the process of scheduling and then moved on the see the types of queues used in scheduling. We also explored the different kinds of process schedulers and their use.

Recommended Readings:

If you liked our article, do upvote our article and help other ninjas grow.  You can refer to our Guided Path on Coding Ninjas Studio to upskill yourself in Data Structures and AlgorithmsCompetitive ProgrammingSystem Design, and many more!

Previous article
Introduction of Process Management
Next article
First In First Out (FIFO) Algorithm in OS
Guided path
Operating system track
14 chapters
83+ Problems
Earn badges and level up
Live masterclass