Siksha Sarovar

Siksha Sarovar (sikshasarovar.com) is a free educational web application that helps students in India learn programming and prepare for academic and competitive exams. The platform offers structured coding courses (C, C++, Python, Java, HTML, CSS, PHP, Power BI, AI, Machine Learning, Data Science), complete university curriculum notes for BCA/MCA students with previous year question papers, Class 10 and Class 12 CBSE/HBSE school notes, and dedicated preparation material for SSC, UPSC, Banking, Railway and other government exams. Browsing the site is completely free and requires no account. Users may optionally sign in with Google solely to save their learning progress, quiz scores and personal preferences across devices.

Privacy Policy | Terms of Service | Contact Siksha Sarovar | About Siksha Sarovar

v4.0.9 · PWA
Siksha Sarovar logo
Siksha Sarovar
Your Learning Universe

Siksha Sarovar is a free e-learning platform for coding courses, BCA university notes and competitive exam preparation. Optional Google sign-in saves your learning progress across devices.

Initializing knowledge base…
Compiling modules 0%

Fair Share Scheduler

Lesson 26 of 32 in the free Design of Unix Operating System notes on Siksha Sarovar, written by Rohit Jangra.

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

AspectStandard SchedulerFair Share Scheduler
Unit of fairnessIndividual processGroup of processes
CPU allocationEqual per processEqual per group (proportional to share)
ManipulationRun more processes = more CPURunning more processes doesn't help
Use caseSingle-user / equal accessMulti-tenant / shared systems
Priority calculationBased on individual CPU usageBased on individual + group CPU usage

Advantages of FSS

  1. Prevents monopolization — no user can gain unfair advantage by running many processes.
  2. Guarantees resource allocation — each group gets its promised share.
  3. Flexible — shares can be adjusted based on organizational needs.
  4. Accountable — usage can be tracked and billed per group.

Disadvantages of FSS

  1. More overhead — tracking group usage adds computational cost.
  2. Complexity — more complex to configure and manage.
  3. 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.