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
What are different types of CPU scheduling and the scheduling criteria?
The process scheduler is responsible for assigning processes to the CPU based on specific scheduling algorithms. It manages the order in which processes are executed to optimize system performance and resource utilization.
CPU scheduling involves selecting which process should run next when the CPU becomes available. The scheduler uses various algorithms and policies to make these decisions, balancing factors like efficiency, fairness, and response time.
Types of CPU Scheduling Algorithms
CPU scheduling algorithms can be categorized into different types based on their approach −
Preemptive vs Non-Preemptive
| Preemptive Scheduling | Non-Preemptive Scheduling |
|---|---|
| Process can be interrupted and moved back to ready queue | Process runs until completion or voluntary release |
| Examples: Round Robin, Priority (preemptive), SJF (preemptive) | Examples: FCFS, SJF (non-preemptive), Priority (non-preemptive) |
| Better response time for interactive systems | Lower overhead, simpler implementation |
Common Scheduling Algorithms
First Come First Serve (FCFS) − Processes are executed in the order they arrive
Shortest Job First (SJF) − Process with shortest burst time is selected first
Round Robin − Each process gets a fixed time slice in cyclic order
Shortest Remaining Time First (SRTF) − Preemptive version of SJF
Priority Scheduling − Processes are assigned priorities and scheduled accordingly
Multilevel Queue Scheduling − Multiple queues with different priorities and algorithms
Scheduling Criteria
Effective scheduling algorithms are evaluated based on several performance criteria. These metrics help determine which algorithm is best suited for specific system requirements.
CPU Utilization
The percentage of time the CPU is actively executing processes. An efficient scheduling algorithm should maximize CPU utilization, ideally keeping it between 40% (lightly loaded) and 90% (heavily loaded).
Throughput
The number of processes completed per unit time. Higher throughput indicates better system performance. It measures the scheduler's ability to complete tasks efficiently.
Response Time
The time from when a process is submitted until it begins execution. Critical for interactive systems where users expect quick feedback.
Response Time = Time at which process gets CPU for first time - Arrival time
Turnaround Time
The total time taken from process submission to completion, including waiting time and execution time.
Turnaround Time = Completion time - Arrival time Turnaround Time = Burst time + Waiting time
Waiting Time
The total time a process spends waiting in the ready queue before execution. Lower waiting time generally indicates better scheduling efficiency.
Waiting Time = Turnaround time - Burst time
Fairness
Ensures all processes receive a reasonable share of CPU time. Prevents process starvation where some processes never get executed due to continuous arrival of higher-priority processes.
Comparison of Scheduling Goals
| Criterion | Goal | Priority Level | System Type |
|---|---|---|---|
| CPU Utilization | Maximize | High | All systems |
| Throughput | Maximize | High | Batch systems |
| Response Time | Minimize | Critical | Interactive systems |
| Turnaround Time | Minimize | Medium | Batch systems |
| Waiting Time | Minimize | Medium | All systems |
| Fairness | Ensure | High | Multi-user systems |
Conclusion
CPU scheduling algorithms balance multiple competing objectives like maximizing throughput while minimizing response time. The choice of algorithm depends on system requirements, with interactive systems prioritizing response time and batch systems focusing on throughput and turnaround time.
