Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Process Scheduling Fundamentals
Process Scheduling handles the selection of a process for the processor based on a scheduling algorithm and the removal of a process from the processor. It is an important part of multiprogramming in operating systems, enabling efficient CPU utilization and fair resource distribution among competing processes.
Process Scheduling Algorithms
Process scheduling algorithms determine which process gets CPU access next and how resources are distributed among processes. Each algorithm has different characteristics regarding fairness, throughput, and response time.
Major Scheduling Algorithms
First Come First Served (FCFS) − Handles processes in the order they arrive in the ready queue. FCFS is the simplest scheduling algorithm with no preemption, ensuring no starvation occurs. However, its throughput is low because large processes may hold the CPU for extended periods, causing the convoy effect.
Shortest Job First (SJF) − Executes processes in order of their execution times, selecting the process with the smallest burst time first. SJF can be preemptive or non-preemptive and provides optimal average waiting time, though it may cause starvation for longer processes.
Priority Scheduling − Executes processes based on their assigned priority levels. Higher priority processes can preempt lower priority ones, which may lead to starvation for low-priority processes. This can be solved using priority aging.
Round Robin (RR) − Provides a fixed time slice (quantum) for each process and cycles through all processes until completion. Prevents starvation since each process gets CPU time. The time quantum size affects performance − too large behaves like FCFS, too small increases context-switching overhead.
Comparison of Scheduling Algorithms
| Algorithm | Preemption | Starvation | Throughput | Response Time |
|---|---|---|---|---|
| FCFS | No | No | Low | Poor |
| SJF | Optional | Possible | High | Good |
| Priority | Yes | Possible | Medium | Variable |
| Round Robin | Yes | No | Medium | Good |
Process Schedulers
Process scheduling involves three types of schedulers that operate at different time scales and manage different aspects of process execution.
Types of Schedulers
Long-Term Scheduler (Job Scheduler) − Selects processes from the job pool in secondary memory and loads them into the ready queue in main memory. It controls the degree of multiprogramming and must balance CPU-bound and I/O-bound processes for optimal system throughput.
Short-Term Scheduler (CPU Scheduler) − Selects one process from the ready queue and allocates the CPU to it. This scheduler runs frequently (every few milliseconds) and uses scheduling algorithms like FCFS, SJF, or Round Robin to make decisions.
Medium-Term Scheduler (Swapper) − Manages swapping of processes between main memory and secondary storage. It can suspend (swap out) processes to reduce the degree of multiprogramming and later resume (swap in) them from where they left off. This helps improve the process mix and memory utilization.
Key Points
Scheduling algorithms trade off between fairness, throughput, and response time
Preemptive algorithms provide better response times but increase context-switching overhead
The three scheduler types work together to manage processes at different stages of their lifecycle
Proper scheduler design prevents starvation and ensures efficient resource utilization
Conclusion
Process scheduling is fundamental to operating system performance, involving multiple algorithms and scheduler types. The choice of scheduling algorithm depends on system requirements, while the three-level scheduling architecture ensures efficient process management from creation to termination.
