How It Works
The Fair Scheduler provides dynamic and fair CPU allocation between multiple applications running on the same shared cloud resource. Its main goals are:- Maximum Resource Utilization - When one application is inactive, another can use the unused CPU cycles, increasing overall efficiency
- Starvation Prevention - No application will be completely deprived of CPU access, even under heavy load from others, ensuring basic responsiveness
- Predictable Performance - Maintaining stability and performance for all applications despite competition for limited resources
Example: 0.5 CPU Plan
Consider a namespace with a 0.5 CPU plan running two applications. Both apps have access to the full 0.5 CPU - here’s how the scheduler handles different scenarios:| Scenario | App A | App B | Result |
|---|---|---|---|
| Only App A needs CPU | Demands 0.5 | Idle | App A gets full 0.5 CPU |
| Only App B needs CPU | Idle | Demands 0.5 | App B gets full 0.5 CPU |
| Both need CPU | Demands 0.5 | Demands 0.5 | Each gets 0.25 CPU (fair split) |
| Burst scenario | Using 0.5 | Suddenly needs burst | App B gets 0.5 temporarily, then scheduler lowers both to 0.25 |

