Day 01 Part 17(B)- Concept of schedulers short term, long term and medium term schedulers
Day 01 Part 17(B)- Concept of schedulers short term, long term and medium term schedulers
In operating systems, schedulers are responsible for managing the execution of processes by determining which process runs at a given time. There are three primary types of schedulers: Long-Term, Medium-Term, and Short-Term. Each plays a distinct role in process management and system performance.
Contents [hide]
Long-Term Scheduler (Job Scheduler)
Role: Determines which processes are admitted into the system for processing.
Functions:
-
Controls Multiprogramming: Regulates the number of processes in memory to maintain an optimal level of multiprogramming.
-
Process Selection: Chooses processes from the job pool and loads them into the ready queue.
-
Process Mix: Ensures a balanced mix of I/O-bound and CPU-bound processes to optimize resource utilization.
Characteristics:
-
Frequency: Invoked less frequently compared to other schedulers.
-
Speed: Slower decision-making process.
-
Presence: Not present in all systems; for instance, time-sharing systems like UNIX often lack a long-term scheduler.
Medium-Term Scheduler (Swapper)
Role: Manages the swapping of processes in and out of main memory to optimize CPU and memory utilization.
Functions:
-
Swapping: Temporarily removes (swaps out) processes from main memory to reduce the degree of multiprogramming and later swaps them back in when appropriate.
-
Resource Management: Balances memory usage among processes, ensuring efficient utilization.
-
Process Prioritization: May adjust process priorities based on their current state or resource requirements.
Characteristics:
-
Frequency: Operates at a medium frequency, depending on system load and memory availability.
-
Presence: Common in systems that support swapping; not all operating systems implement a medium-term scheduler.
Short-Term Scheduler (CPU Scheduler)
Role: Selects which process in the ready queue should be executed next by the CPU.
Functions:
-
Process Dispatching: Allocates CPU to one of the ready processes.
-
Context Switching: Handles the switching of the CPU from one process to another.
-
Scheduling Algorithms: Implements algorithms like First-Come-First-Serve (FCFS), Shortest Job Next (SJN), Round Robin (RR), etc., to determine process execution order.
Characteristics:
-
Frequency: Invoked very frequently (milliseconds), making rapid decisions.
-
Speed: Fastest among all schedulers due to the need for quick decision-making.
-
Presence: Essential component in all operating systems.
Comparative Overview
Scheduler Type | Also Known As | Frequency of Execution | Speed | Main Function |
---|---|---|---|---|
Long-Term | Job Scheduler | Low | Slow | Controls degree of multiprogramming |
Medium-Term | Swapper | Medium | Moderate | Manages swapping of processes |
Short-Term | CPU Scheduler | High | Fast | Allocates CPU to ready processes |
For a visual explanation, you might find this video helpful:
Feel free to ask if you need further clarification or examples on any of these schedulers!