
11 In-Demand Backend Developer Skills You Should Master
Discover the essential backend developer skills: mastering programming languages, database management, API integration, security practices, DevOps, and more!

CPU Scheduling is a process in which the operating system determines which process will get allocated the CPU next. It is an essential element in the design and operation of an operating system (OS). It selects which of the processes in the ready queue will be assigned the CPU, hence maximising system performance. It is essential to make sure that resources are used as efficiently as possible and that the system functions properly even when there is a high demand for it.
In this article, we will learn about CPU scheduling in the operating system. We will learn about the types of CPU scheduling, including preemptive and non-preemptive algorithms. We will also understand the criteria for CPU scheduling and the different algorithms like Priority Scheduling, Round Robin (RR), First-Come, First-Served (FCFS), and many others.
Before we learn what CPU scheduling is, we need to understand what a process is. A process is an instance of a program that is being executed in the CPU to perform a set of tasks. A process includes the code for the program, its ongoing operations, and the resources it uses. OS launches a process to carry out the program when you run one, like opening an MS Office application or a web browser.
To understand a bit more about processes, let’s say you have a process running on a uni-programming system (uses a single thread) that needs input/output. In a single-threaded system, the CPU gets idle when not working and waits for the I/O operations to finish. In multiprogramming systems (uses multiple threads at a time), when a running process pauses for input/output, the CPU does not stop working. It begins additional processes to run to use as much CPU as possible.
Now, to maximise the CPU use, how does the CPU choose which process in the ready queue should be carried out next? The CPU scheduling method comes into this picture, which is the process of “scheduling” the processes.
CPU Scheduling is used to schedule the different processes of the CPU according to different aspects. To maximise system performance, CPU scheduling is a crucial method that decides which process in the ready queue will receive the CPU. CPU scheduling is known as process scheduling with the primary goal to create a quick and efficient system. It is essential to make sure that resources are used as efficiently as possible, do not remain idle when not in use, and that the system functions properly even when there is a high demand for it.

POSTGRADUATE PROGRAM IN
Multi Cloud Architecture & DevOps
Master cloud architecture, DevOps practices, and automation to build scalable, resilient systems.
One essential component of the operating system is CPU scheduling, which determines which process in the ready queue gets CPU time. In an operating system, there are mainly two types of CPU scheduling: preemptive and non-preemptive scheduling.
In preemptive scheduling, there may be an interruption in process allocation by the operating system. In this scheduling, the process of having a higher priority is executed before the lower priority processes. For example, an OS can interrupt a running process to allocate the CPU to a new process and execute the respective task.
Particularly in real-time and time-sharing systems, preemptive scheduling enables the OS to react to shifting system conditions faster.
Let’s understand an example of preemptive scheduling. Assume four processes P1, P2, P3, and P4 with the burst time values as 6, 8, 7, and 3 respectively. The time quantum given is 4 units.
Time 0-4: P1 executes for 4 units; the remaining burst time is 2.
Time 4-8: P2 executes for 4 units; the remaining burst time is 4.
Time 8-12: P3 executes for 4 units; the remaining burst time is 3.
Time 12-15: P4 executes for 3 units and moves to the next process.
Time 15-17: P1 executes for 2 units and moves to the next process.
Time 17-21: P2 executes for 4 units and moves to the next process.
Time 21-24: P3 executes for 3 units and moves to the next process.
Gantt Chart:
| P1 | P2 | P3 | P4 | P1 | P2 | P3 |
|—-|—-|—-|—-|—-|—-|—-|
0 4 8 12 15 17 21 24
Non-preemptive scheduling requires new processes to wait until the running process finishes its CPU cycle. In this scheduling, the new processes are executed only after the running process has completed its task of execution. Until it is moved to the process waiting state or changed to terminated, the process retains the CPU’s resources, like CPU time. If the CPU is working on a process currently, it won’t stop until it’s finished.
Once the process has completed its execution, the CPU picks up the next process from the ready queue (a queue in which all the processes waiting for their execution are stored). The non-preemptive scheduling is easy to implement but comes with less efficient CPU utilisation and may increase the wait time for processes waiting in the ready queue.
Let’s understand an example of non-preemptive scheduling using the Shortest Job Next Algorithm. Assume four processes, P1, P2, P3, and P4, with the burst time values as 3, 12, 23, and 5 respectively.
When we execute these processes using the Shortest Job Next Algorithm, we do as follows:
Time 0-3: P1 executes for 3 units and moves to the next process.
Time 3-9: P4 executes for 5 units and moves to the next process.
Time 9-16: P2 executes for 12 units and moves to the next process.
Time 16-24: P3 executes for 23 units and moves to the next process.
Gantt Chart:
| P1 | P4 | P2 | P3 |
|—-|—-|—-|—-|
0 3 9 16 24
In CPU Scheduling there are various types of processes used to perform various tasks. It includes:
In an operating system, various important terms need to be understood before moving on to CPU Scheduling and learning about their algorithms. Here are some of the key terms used in CPU Scheduling:

82.9%
of professionals don't believe their degree can help them get ahead at work.
In the operating system, when we talk about CPU Scheduling criteria, the main goal here is to do two things. First, maximise the CPU Utilisation and Throughput. Second, try to minimise the response time, waiting time, and turnaround time (TAT). But what are the other criteria for CPU Scheduling? Below are the ones:
It measures the amount of percentage time that the CPU is actively working on rather than being idle. If the scheduling was carried out in a way that maximises CPU use, it would make sense. A system’s overall performance depends on the efficient use of CPU resources, which is indicated by a high CPU usage rate.
It refers to the number of processes completed per unit of time or simply the work done by the CPU in a time. So, every processor must be able to provide the maximum throughput for efficient utilisation.
It is the time a process waits in the ready queue for its allocation by the CPU. A scheduling algorithm cannot alter the amount of time a process needs to finish its execution, but it can reduce the process’s waiting time for better optimisation.
When you have an interactive system, response time is used. It is the amount of time between the process’s submission and the production of its first “response”—that becomes another CPU scheduling criterion. The CPU would want to reduce this time as much as possible.
It is the amount of time needed for a process to start, finish, and get into the ready queue. This time could be reduced with the help of an effective CPU scheduling criterion.
Also Read: What is the Process in OS
To effectively allocate the CPU’s available processing time among several computing processes for its resources, a CPU scheduling technique is required. They choose the sequence in which processes run and the amount of CPU time allotted to each task. Every algorithm has advantages and disadvantages, and the ones used depend on the goals and needs of the system. The CPU Scheduling algorithms are categorised mainly into two parts: preemptive and non-preemptive.
In preemptive scheduling, we have algorithms like Priority Scheduling, Longest remaining Job First Scheduling, Shortest remaining Job First Scheduling, and Round Robin.
In non-preemptive scheduling, we have algorithms like First Come First Serve (FCFS), Shortest Job First (SJF), Longest Job First (LJF), and Highest Response Ratio Next (HRRN).
The priority scheduling algorithm is preemptive. It allows the operating system to interrupt and switch between the highest-priority processes to allocate the CPU. And if there are multiple processes with equal value, the FCFS (First Come First Serve) algorithm serves as the foundation for the most significant CPU allocation algorithm to allocate the CPU.
Features:
Advantages:
Disadvantages:
The round-robin scheduling algorithm is the preemptive algorithm. In this algorithm, each process is assigned a fixed time quantum or a fixed time slot. Processes are carried out cyclically; if a procedure is not completed in the allotted time, it is preempted and pushed to the back of the ready queue.
Features:
Advantages:
Disadvantages:
The longest remaining job first algorithm takes those processes that have the longest burst time (processing time remaining for completion) in the operating system. It is used by the operating system to systematically allocate the CPU to processes. It is a preemptive scheduling algorithm.
Features:
Advantages:
Disadvantages:
The shortest remaining job first algorithm takes those processes that have the shortest burst time (processing time remaining for completion) in the operating system. It is used by the operating system to systematically allocate the CPU to processes. It is also a preemptive scheduling algorithm.
Features:
Advantages:
Disadvantages:
The FCFS algorithm is the most basic operating system scheduling algorithm. According to the first-come, first-serve scheduling technique, which uses a FIFO(first in, first out) technique, the process that demands the CPU first gets it first. The sequence in which processes appear in the ready queue determines their scheduling.
Features:
Advantages:
Disadvantages:
A scheduling technique called “shortest job first” (SJF) chooses the waiting process with the quickest execution time to go on to the next step. The next process chosen is the one with the least burst time. This scheduling technique might be preemptive or not but we consider this in the non-preemptive category.
Features:
Advantages:
Disadvantages:
This is the opposite of the shortest job first. It is also a non-preemptive algorithm. The process with the longest burst time is selected next. It may result in long wait times for short processes.
Features:
Advantages:
Disadvantages:
The purpose of CPU scheduling is to ensure that the operating system has at least chosen a process from the ready-to-use line whenever the CPU is idle. This process is needed to efficiently utilise the maximum performance of the CPU and get the best output from it. Here are some of the important aspects of CPU scheduling:
Having the benefits of CPU scheduling also comes with numerous challenges that need to be addressed. Here are some of the common challenges in CPU scheduling:
Also Read: Types of Operating Systems
CPU scheduling is the process by which the CPU decides which process in the ready queue will be picked up next to be allocated for the CPU. Operating systems can efficiently control the execution of processes, guaranteeing the best possible resource usage, the least amount of waiting time, and an equitable distribution of CPU time through the careful selection and tuning of scheduling algorithms.
In this article, we have learned in depth about CPU scheduling with its types, including preemptive and non-preemptive. We have also seen in detail the criteria for CPU scheduling along with the scheduling algorithms. Various scheduling methods, including Priority Scheduling, Round Robin (RR), Longest Remaining Job First, Shortest Job First (SJF), First-Come First-Served (FCFS), and others, each have advantages and disadvantages depending on the workload and system requirements.
Updated on September 6, 2024

Discover the essential backend developer skills: mastering programming languages, database management, API integration, security practices, DevOps, and more!

Explore top front end developer skills, including key technical and soft skills to become a front end developer. Know the salary insights and future opportunities.

Explore the best full stack project ideas for beginners and advanced levels. Build real-world projects to showcase your expertise. Learn project ideas for full stack development in 2025.

Understand the differences between Procedural and Object-Oriented Programming. Learn which to choose for your projects and why.

Discover the difference between Internet and WWW, their roles, and how they work together in the digital world.

Explore the difference between algorithm and flowchart, their advantages, practical uses, and how they simplify problem-solving in programming and beyond.

Stay future-ready with insights on the best technology to learn in 2025. Discover the latest trends and skills that will propel your career in the dynamic tech landscape.