Introduction
The Fair Share Scheduler (FSS) is an extension of the standard UNIX scheduler that allocates CPU time not just to individual processes, but to groups of users (called fair share groups). This prevents a single user or group from monopolizing system resources.
Problem with Standard Scheduling
In standard UNIX scheduling:
- If User A has 10 processes and User B has 1 process, the scheduler treats all 11 processes equally.
- User A gets ~91% of CPU time (10/11), while User B gets only ~9% (1/11).
- This is unfair — User A gains an advantage simply by running more processes.
Fair Share Scheduling — The Solution
The Fair Share Scheduler divides CPU time based on groups, not individual processes.
Concept:
- Users are organized into groups (fair share groups).
- Each group is assigned a CPU share (percentage of total CPU time).
- The scheduler ensures each group receives its allocated share regardless of how many processes are in the group.
How FSS Works
Step 1: Define Groups and Shares
Group A (Faculty): 50% CPU share
Group B (Students): 30% CPU share
Group C (System tasks): 20% CPU share
Total: 100%
Step 2: Track Group CPU Usage
- The scheduler tracks the actual CPU usage of each group.
- It compares actual usage against the allocated share.
Step 3: Priority Adjustment
- If a group has used less than its share → its processes get higher priority (promoted).
- If a group has used more than its share → its processes get lower priority (demoted).
- This feedback mechanism ensures convergence toward the target shares.
FSS Priority Formula
FSS Priority = base priority + (p_cpu / 2) + (group_cpu_usage / (2 * group_weight)) + p_nice
Where:
- p_cpu — individual process CPU usage (as in standard scheduler).
- group_cpu_usage — aggregate CPU usage of the process's group.
- group_weight — the group's allocated share (weight).
- The group term ensures that processes in over-consuming groups get penalized.
Example Scenario
System with 2 groups, each allocated 50%:
Group A: 9 processes
Group B: 1 process
Standard Scheduler:
Group A processes each get 1/10 of CPU ≈ 10% each → Group A total = 90%!
Group B process gets 1/10 of CPU = 10% → Group B total = 10%
Fair Share Scheduler:
Group A: 50% total CPU ÷ 9 processes ≈ 5.6% each → Group A total = 50%
Group B: 50% total CPU ÷ 1 process = 50% → Group B total = 50%
Comparison: Standard vs Fair Share
| Aspect | Standard Scheduler | Fair Share Scheduler |
|---|---|---|
| Unit of fairness | Individual process | Group of processes |
| CPU allocation | Equal per process | Equal per group (proportional to share) |
| Manipulation | Run more processes = more CPU | Running more processes doesn't help |
| Use case | Single-user / equal access | Multi-tenant / shared systems |
| Priority calculation | Based on individual CPU usage | Based on individual + group CPU usage |
Advantages of FSS
- Prevents monopolization — no user can gain unfair advantage by running many processes.
- Guarantees resource allocation — each group gets its promised share.
- Flexible — shares can be adjusted based on organizational needs.
- Accountable — usage can be tracked and billed per group.
Disadvantages of FSS
- More overhead — tracking group usage adds computational cost.
- Complexity — more complex to configure and manage.
- Underutilization — if a group doesn't use its share, CPU cycles may be wasted (some implementations redistribute idle shares).
Real-World Application
- FSS is used in multi-user environments like universities, data centers, and cloud computing.
- Modern systems implement similar concepts through cgroups (Linux Control Groups), Solaris FSS scheduling class, and cloud resource quotas.
Summary
- Fair Share Scheduling allocates CPU time to groups, not individual processes.
- It prevents users from gaming the system by running more processes.
- Priority is adjusted based on both individual and group CPU usage.
- It ensures each group receives its allocated share of CPU time.
- Modern equivalents include Linux cgroups and cloud resource management.