Skip to content

Types of Schedulers

1. Introduction to Schedulers

In a multiprogramming system, the CPU must efficiently manage multiple processes.
Schedulers in an Operating System (OS) decide which process to execute and when.

πŸ’‘ Why Schedulers?

  • Ensure efficient CPU utilization.
  • Manage process execution through scheduling queues.
  • Reduce waiting time and increase throughput.

2. Types of Schedulers

There are three main types of schedulers in an OS:

SchedulerFunction
Long-Term Scheduler (Job Scheduler)Controls the number of processes entering the system.
Short-Term Scheduler (CPU Scheduler)Selects which process gets CPU time.
Medium-Term Scheduler (Swapper)Temporarily removes processes from memory to free up space.

Let’s discuss them in detail.


πŸ“Œ 1. Long-Term Scheduler (Job Scheduler)

βœ… Manages process admission – decides which jobs (processes) enter the Ready Queue.
βœ… Controls the degree of multiprogramming (number of processes in memory).
βœ… Used in Batch Operating Systems (jobs are submitted in bulk).

βœ” Example:

  • If 100 users submit jobs, the Long-Term Scheduler selects only 20 to enter memory to prevent overloading.

πŸ’‘ Slow but critical! This scheduler runs infrequently but plays a key role in system performance.


πŸ“Œ 2. Short-Term Scheduler (CPU Scheduler)

βœ… Decides which process gets CPU next from the Ready Queue.
βœ… Runs very frequently (every few milliseconds).
βœ… Uses scheduling algorithms like FCFS, Round Robin, Priority Scheduling.

βœ” Example:

  • If five processes are waiting in the Ready Queue, the CPU Scheduler picks one for execution.

πŸ’‘ Fastest scheduler! Runs hundreds of times per second to manage process execution.


πŸ“Œ 3. Medium-Term Scheduler (Swapper)

βœ… Temporarily removes processes from RAM (Swapping).
βœ… Helps in memory management by reducing CPU load.
βœ… Suspended processes are moved to disk and resumed later.

βœ” Example:

  • If RAM is full, a background music player may be swapped out while a video editing app runs.

πŸ’‘ Used in modern OS to balance CPU and memory usage.


3. Comparison of Schedulers

FeatureLong-Term SchedulerShort-Term SchedulerMedium-Term Scheduler
FunctionSelects jobs for executionSelects process for CPUSwaps processes in/out of RAM
SpeedSlow (minutes)Fast (milliseconds)Medium (seconds)
RunsInfrequentlyVery frequentlyOccasionally
ControlsMultiprogrammingCPU schedulingMemory management
ExampleJob selection in batch OSProcess execution in CPUSwapping in Virtual Memory

4. How These Schedulers Work Together?

1️⃣ User submits jobs β†’ Long-Term Scheduler selects jobs for execution
2️⃣ Ready Queue fills β†’ Short-Term Scheduler picks processes for CPU execution
3️⃣ RAM gets full β†’ Medium-Term Scheduler swaps out processes
4️⃣ Swapped processes return β†’ Short-Term Scheduler resumes execution

βœ… This cycle repeats, ensuring efficient CPU and memory management!


5. Conclusion

βœ” Schedulers manage process execution at different levels (Job, CPU, Memory).
βœ” Long-Term Scheduler controls how many processes enter the system.
βœ” Short-Term Scheduler decides which process runs on the CPU.
βœ” Medium-Term Scheduler swaps processes to optimize memory usage.