BCA / B.Tech 17 min read

Scheduling Algorithms in Operating System

Scheduling Algorithms in Operating System: A Detailed Introduction


One of the most important jobs of any operating system is to decide how and when processes get to use the CPU. For this task, operating systems use various types of scheduling algorithms. A scheduling algorithm decides the order in which processes will be given access to the CPU, with the goal of increasing system efficiency, using resources correctly, and allowing processes to run with minimal waiting time.

Scheduling algorithms are a critical part of any OS. Different algorithms work better in different situations. For example, FCFS is simple but not suitable for long processes, while SJF reduces turnaround time but is hard to implement. Round Robin is good for quick user responses, but setting the right time quantum is important. Priority scheduling gives preference to important processes but can lead to starvation. The right algorithm is chosen based on the system's needs, the nature of the processes, and user priorities.

Two major categories of Scheduling:

Scheduling algorithms can be divided into two main categories:
  • Preemptive Scheduling: The CPU can be taken away from a process in the middle of its execution and given to another process.
  • Non-preemptive Scheduling: Once a process gets the CPU, it cannot be taken away until the process is complete.

Different types of scheduling algorithms:

In this article, we will understand various types of scheduling algorithms in detail, their benefits, limitations, and in which situation each algorithm is suitable.

1. First Come, First Served (FCFS):

Introduction: FCFS is the simplest scheduling algorithm. Processes are executed in the same order they arrive in the system. This means the process that comes first gets the CPU first.
Main Features:
  • It is a non-preemptive scheduling algorithm: once a process gets the CPU, it runs until it is finished.
  • It works like a queue, where the first one in is the first one served.
Benefits: Simple and easy to understand. No complexity and its implementation is straightforward.
Drawbacks: Short processes might have to wait a long time because of long processes, which is known as the Convoy Effect. The average waiting time can be high.
Suitability: It is useful when the execution time of processes is similar, but less effective when there is a big difference in execution times.

2. Shortest Job First (SJF):

Introduction: The SJF algorithm allocates the CPU to the process that has the shortest execution time. This means the smallest process runs first.
Main Features:
  • Can be implemented as either non-preemptive or preemptive.
  • Its goal is to reduce the turnaround time.
Benefits: Reduces average waiting time and turnaround time.
Drawbacks: It is difficult to implement because it has to estimate the correct execution time of a process. Long processes might wait for a very long time, leading to starvation.
Suitability: It is more effective when the execution times of all processes are known and there isn't much difference in their times.

3. Round Robin (RR):

Introduction: The Round Robin algorithm is especially used in time-sharing systems. In this, each process is allocated the CPU for a fixed amount of time (called a time quantum). If the process is not finished by the end of that time, it is sent to the back of the queue, and the CPU is given to the next process.
Main Features:
  • It is a preemptive algorithm: a process can be removed from the CPU and another can be given the CPU.
  • The smaller the time quantum, the more preemptive the algorithm.
Benefits: All processes get a fair share of the CPU time. The average response time is low, so the user gets a quick response.
Drawbacks: If the time quantum is too small, the frequency of context switching increases, which can increase overhead. If the time quantum is too large, it starts to work like FCFS.
Suitability: In multi-user systems where it is necessary to give equal time to all processes.

4. Priority Scheduling:

Introduction: In this algorithm, each process is given a priority, and the CPU is allocated to the process with the highest priority. Priority scheduling can be implemented as both preemptive and non-preemptive.
Main Features:
  • The process with the highest priority gets the CPU first.
  • The priority number can be low or high, but the one with the highest priority is given the CPU first.
Benefits: Important processes are executed quickly.
Drawbacks: Low-priority processes might suffer from starvation, causing them to wait for a very long time. This problem can be solved through aging, where the priority of low-priority processes is increased over time.
Suitability: It is suitable when some processes need to be executed quickly to perform more important tasks.

5. Multi-Level Queue Scheduling:

Introduction: In this algorithm, processes are divided into different queues based on their type, and a separate scheduling algorithm is used for each queue. For example, there can be separate queues for interactive and batch processes.
Main Features:
  • Each queue has a different priority and scheduling algorithm.
Benefits: Can handle different types of processes better.
Drawbacks: It can be complex and might put more load on the system.
Suitability: It is used when there are different types of processes in the system with different scheduling requirements.

In this Chapter

Scheduling Algorithms in Operating System
Distributed System in Operating System
Real-Time System in Operating System
System Calls in Operating System
System Programs in Operating System
Structure of an Operating System
Layered Design of an Operating System Structure
UNIX in Operating System
Virtual Machine in Operating System
Kernel-Based Operating System
Process Concept in Operating System
Interacting Processes in Operating System
Threads in Operating System
Fundamentals of Scheduling in Operating System
Scheduling Criteria in Operating System
Long, Medium, and Short-Term Scheduling
Structure of a Concurrent System
Critical Region in Operating System
Critical Section in Operating System
Inter-process Communication (IPC) in Operating System
Monitors in Operating System
Semaphores in Operating System
Semaphore Implementation & Uses in Operating System
Logical and Physical Address in Operating System
Swapping in Operating System
Contiguous Allocation in Operating System
Segmentation in Operating System
Paging in Operating System
Virtual Memory using Segmentation in Operating System
Interprocess Communication Protocol in Operating System
Network Operating System
Design Issues in Distributed File System
Network Structure in Operating System
Structure of a Distributed System
File System and Coordination in Operating System
History of Linux in Operating System
Linux Commands
Programmer Interface & File Manipulation in Linux
Process Control in Linux
Kernel & Signals in Linux
File System in Linux
Blocks and Inodes in Linux
System Editors in Linux
Character Transliteration in Linux
The `ed` Line Editor in Linux
The `vi` Editor and Its Commands
Shell Scripting in Linux
Looping & Decision Making in Linux Shell Scripting
Variables & File Name Expansion in Linux
Arrays in Linux Shell Scripting
Subprograms (Functions) in Linux Shell Scripting
C Interface with Linux
Simple Shell Programs in Linux
BCA Part-1 | Operating Systems | Semester-I | MDSU Exam Paper 2023 (Held in 2024)
What is an Operating System (OS)
Operating System (OS) All Important Questions and Answers in English (MDSU)
BCA || Operating System 2025 Paper || MDSU Exam Paper
BCA | OS(Operating System) 2023 Paper | MDSU Exam Paper
Types of Operating Systems
Goals of an Operating System
Operations of an Operating System
Resource Allocation & Functions in an Operating System
Classes of Operating System
Batch Processing in Operating System
Multiprocessing in Operating System
Time-Sharing in Operating System