What are Schedulers in OS?
Schedulers are components of the operating system that decide which processes should be executed and when. They manage process states: new, ready, running, waiting, and terminated.
There are three types of schedulers:
1. Long-Term Scheduler (Job Scheduler)
Purpose:
-
Decides which processes are admitted into the system (from job pool to ready queue).
-
Controls the degree of multiprogramming (i.e., how many processes are in memory).
-
Low frequency of execution.
-
Selects few processes at a time.
-
Runs when a process terminates or exits.
Example:
2. Medium-Term Scheduler (Swapper)
Purpose:
-
Temporarily removes (swaps out) processes from memory to reduce load or free space.
-
Later, swaps in the processes to continue execution.
Key Features:
-
Manages suspended processes.
-
Helps in load balancing and memory optimization.
-
Not always present in all systems.
Example:
3. Short-Term Scheduler (CPU Scheduler)
Purpose:
-
Highest frequency of execution.
-
Directly affects system responsiveness and performance.
-
Must be fast and efficient.
Example:
Comparison Table
| Feature |
Long-Term Scheduler |
Medium-Term Scheduler |
Short-Term Scheduler |
| Also Called |
Job Scheduler |
Swapper |
CPU Scheduler |
| Main Function |
Selects processes to admit |
Swaps processes in/out of memory |
Selects next ready process for CPU |
| Execution Frequency |
Low |
Medium |
High |
| Speed |
Slow |
Moderate |
Fast |
| Controls |
Degree of multiprogramming |
Memory and load balancing |
CPU allocation |
| Presence |
Present in batch systems |
Optional (depends on OS) |
Always present |
| Example Action |
Choose 5 of 100 jobs to run |
Move a suspended process to disk |
Pick the next ready process |