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
Selfish Round Robin CPU Scheduling
Selfish Round Robin (SRR) is a CPU scheduling algorithm that modifies traditional round robin by introducing dynamic priority adjustments. Unlike standard round robin where all processes get equal treatment, SRR allows processes to "selfishly" increase their priority based on execution time, creating a more adaptive scheduling approach.
The traditional round-robin scheduling algorithm is preemptive, giving each process a fixed time slice. After the quantum expires, the process moves to the end of the ready queue. SRR enhances this by maintaining two separate queues and allowing priority manipulation to favor longer-running processes.
How Selfish Round Robin Works
SRR maintains two distinct process lists:
New Queue Contains newly arrived processes that must wait
Accepted Queue Contains processes eligible for CPU execution using round robin
New processes cannot immediately join the Accepted queue. They must wait until accepted processes complete their service or meet certain criteria. Within the Accepted queue, processes receive CPU time using traditional round robin with equal time slices.
Dynamic Priority Adjustment
Processes can dynamically alter their priority levels during execution. When a process requests higher priority, the operating system redistributes priority levels among all processes. This creates a competitive environment where:
Longer-running processes can maintain CPU access by increasing priority
Other processes must compete by adjusting their own priorities
Priority changes affect the order of CPU allocation within the Accepted queue
Example Execution
Consider three processes P1 (high priority), P2 (medium priority), and P3 (low priority):
| Step | Action | Result |
|---|---|---|
| 1 | P1 requests priority increase | P1 gets more CPU time in next cycles |
| 2 | P2 requests higher priority than P1 | OS adjusts: P2 > P1 > P3 |
| 3 | P2 receives maximum CPU allocation | P1 and P3 wait longer |
Advantages
Improved throughput Processes utilize CPU time more efficiently
Adaptive scheduling Priority adjustments based on actual CPU usage
Reduced starvation for long-running processes compared to strict priority schemes
Disadvantages
Potential for abuse Processes can monopolize CPU by constantly increasing priority
Increased waiting time New processes must wait for Accepted queue entry
Not suitable for real-time systems Unpredictable scheduling due to dynamic priorities
Higher response time Short processes may wait behind long-running high-priority ones
Conclusion
Selfish Round Robin scheduling balances fairness with efficiency by allowing dynamic priority adjustments while maintaining round robin principles. It works well for systems where longer processes need sustained CPU access, but the potential for priority manipulation makes it unsuitable for time-critical applications.
