BCA / B.Tech 15 min read

Long, Medium, and Short-Term Scheduling

Long, Medium, and Short-Term Scheduling in Operating System:


In any operating system, scheduling plays a vital role. Scheduling is the process through which the operating system decides which process gets to use the CPU, when, and for how long. This ensures that all processes in the system are handled efficiently and the system's performance remains optimal.

Long-term, medium-term, and short-term scheduling play important roles at different stages of process management. Long-term scheduling decides which processes enter the system, medium-term scheduling controls which processes are kept in memory and which are swapped out, while short-term scheduling determines which process will use the CPU next. The proper coordination of these three types of scheduling helps an operating system run efficiently and ensures that all resources are used correctly.

Scheduling can be divided into three major categories:

  • Long-Term Scheduling
  • Medium-Term Scheduling
  • Short-Term Scheduling
These three types of scheduling are used at different stages of a process's life and their main purpose is to increase system efficiency and maximize CPU usage. Let's understand these three types in detail.

1. Long-Term Scheduling (or Job Scheduling):

Introduction: Long-term scheduling is also known as Job Scheduling. Its main job is to decide how many processes should be allowed into memory to wait in the queue for the CPU. This scheduler primarily brings jobs from the disk into the main memory.
  • Main Task: It determines which processes from secondary storage (disk) should be brought into main memory (RAM) to be ready for execution. It controls the degree of multiprogramming, which means how many processes are present in memory at one time.
  • Goal: The long-term scheduler aims to ensure there is a reasonable number of processes in the system so that the CPU can be used effectively. It maintains a balance so that the system is not overloaded, nor is the CPU left idle.
  • Frequency: The long-term scheduling process is often slow because it involves bringing jobs into memory and is not executed very frequently.
  • Process: The decision of the long-term scheduler depends on whether processes are CPU-bound (use the CPU a lot) or I/O-bound (use input/output devices a lot). Maintaining this balance leads to better utilization of all system resources.
  • Benefits: Helps maintain system performance. Ensures a good mix of I/O and CPU-bound processes.
  • Drawbacks: Since it runs less frequently, it does not provide an immediate response.

2. Medium-Term Scheduling (or Swapping Scheduling):

  • Introduction: Medium-term scheduling is also known as Swapping Scheduling. Its main function is to temporarily move processes to secondary storage whose execution is not immediately required. This is called swapping.
  • Main Task: It controls the number of processes present in the system. When there are too many processes, some are swapped out to secondary storage (disk). When a swapped-out process is needed again for execution, it is brought back into memory. This is called swapping in.
  • Goal: Its main goal is to balance system resources and ensure that important processes get more CPU time for execution. It optimizes memory usage by swapping out inactive processes from memory.
  • Frequency: It runs more frequently than long-term scheduling but is not as fast as short-term scheduling.
  • Process: It is helpful when there are many processes in the system and a shortage of memory. It ensures that only necessary processes remain in memory.
  • Benefits: Ensures proper use of memory. Swaps out non-essential processes without affecting execution.
  • Drawbacks: The swapping process can be expensive as it involves disk I/O.

3. Short-Term Scheduling (or CPU Scheduling/Dispatching):

  • Introduction: Short-term scheduling is also known as CPU Scheduling or Dispatching. Its main job is to decide which process gets the CPU and for how long. It is the most critical scheduler for the CPU as it allocates CPU time to all processes.
  • Main Task: Its job is to select one process from the queue of ready processes and give it control of the CPU. This process happens repeatedly and directly affects system performance.
  • Goal: The main objective of the short-term scheduler is to maximize CPU utilization and execute processes quickly. It ensures that processes receive CPU time based on priority, turnaround time, and waiting time.
  • Frequency: It happens very quickly because it needs to be executed after every process finishes or gets blocked.
  • Process: The short-term scheduler can use various algorithms, such as: FCFS, SJF, Round Robin (RR), and Priority Scheduling.
  • Benefits: Maximizes CPU usage. Ensures important processes are executed quickly.
  • Drawbacks: Since it has to run very frequently, it can increase system overhead.

In this Chapter

Long, Medium, and Short-Term Scheduling
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
Scheduling Algorithms in Operating System
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