Chapter 8 - Resource Management & VM CPU Schedulers

Chapter 8 - Resource Management & VM CPU Schedulers

Updated 5 Oct 2026

Chapter 8 — Resource Management & VM CPU Schedulers

CSS451 Cloud Computing · Cheat Sheet


🧭 Big Picture First

Think of a hypervisor like a hotel manager:

  • The hotel has limited rooms (physical CPUs)
  • Many guests (VMs) want to check in
  • The manager must decide who gets a room, for how long, and how fairly
  • That decision process = Resource Management & Scheduling

1. Cloud Resource Management Policies

Five policies that govern how cloud resources are managed:

#PolicyWhat It DoesReal Example
1Admission ControlPrevents the system from accepting more work than it can handleAPI server caps at 10,000 req/sec → extra requests get HTTP 503 or queued
2Capacity AllocationAssigns specific resources to each serviceService A → 2 vCPU + 4 GB RAM; Service B → 1 vCPU + 2 GB RAM
3Load BalancingDistributes workload evenly across serversRound-robin across 3 web servers
4Energy OptimisationMinimises energy consumptionConsolidate VMs onto fewer servers at night, power down the rest
5QoS GuaranteesEnsures SLA conditions are metUptime ≥ 99.9%, Response ≤ 200ms, Latency ≤ 50ms

Policy vs Mechanism

  • Policy = the rule (what to do) → "Premium customers get priority"
  • Mechanism = the enforcement tool (how to do it) → the actual queue/software that enforces the rule

2. Server Load Balancing

  • Distributes client traffic to servers for consistent, high-performance delivery
  • Ensures: application delivery · scalability · reliability · high availability

Two Types

TypeHow It Works
Transport-levelDNS-based; acts independently of application payload
Application-levelUses actual traffic load to make smarter balancing decisions (e.g., Windows Server Load Balancing)

Analogy: A load balancer is like a restaurant host — they seat customers (requests) across different tables (servers) so no single table gets overwhelmed.


3. Scheduling Fundamentals

Scheduling = deciding how to allocate resources (CPU, memory, storage, I/O, network) between users and tasks.

A scheduler is the program that implements a particular scheduling algorithm.

Three Evaluation Criteria for Any System

  1. Functionality — Does it work correctly?
  2. Performance — Does it perform well?
  3. Cost — How much does it cost?
    • Processing Cost (computation time)
    • Communication Cost
    • Storage Cost

Why Is Cloud Scheduling Hard?

  • Requires complex multi-objective decisions simultaneously
  • Impossible to have accurate global state at all times
  • Large, fluctuating loads challenge cloud elasticity
  • Unpredictable interactions (failures, attacks, spikes)

Scheduling Algorithm Goals

A good scheduling algorithm must be:

  • Efficient — fast and performant
  • Fair — no single VM hogs all resources
  • Starvation-free — every process eventually gets CPU time

Starvation = a process is perpetually denied the resources it needs. Can be caused by scheduling errors, resource leaks, or attacks (e.g., fork bomb).

Objectives by Application Type

Application TypeScheduling Objective
Batch systemMaximise throughput
Real-time systemMeet deadlines (e.g., K-Plus payment)

Common Scheduling Algorithms

  • Round-Robin — Each process gets equal time slices in rotation
  • First-Come-First-Serve (FCFS) — Process that arrives first runs first
  • Shortest-Job-First (SJF) — Shortest estimated burst time runs first

Deadline Types

TypeDescription
Hard DeadlinesStrict — penalties apply if missed. Expressed in ms/sec
Soft DeadlinesGuidelines — no penalty if missed by a small margin

4. Key Scheduling Concepts

4.1 Proportional Share (PS) Scheduling

Each VM gets CPU proportional to its weight (shares).

Each process gets=wi∑w\text{Each process gets} = \frac{w_i}{\sum w}

Equal priority case: each of nn processes gets 1n\frac{1}{n}

Example

ProcessSharesCPU %
P1100100/600 = 16.7%
P2200200/600 = 33.3%
P3300300/600 = 50.0%

Analogy: Like splitting a pizza — if you paid for 3 slices and your friend paid for 1, you get 3/4 of the pizza.

PS Pros & Cons

✅ Pros❌ Cons
Works well under CPU overcommitNot suitable for hard real-time systems
Prevents starvationCannot guarantee strict deadlines
Allows VM-level guaranteesNo deterministic latency
Scales to many processes
Simple to implement

CPU Overcommit = allocating more vCPUs than physical cores exist. Example: 8 physical cores, 6 VMs × 4 vCPUs = 24 vCPUs → Overcommit ratio = 24:8 = 3:1 Like a hotel overbooking rooms — works fine until everyone shows up at once.


4.2 Work-Conserving vs Non-Work-Conserving

ModeBehaviourCPU Shares Are...
Work-Conserving (WC)If CPU is free and there's work to do, use itGuarantees (minimum)
Non-Work-Conserving (NWC)Clients get exactly their share, nothing more, even if CPU is freeCaps (maximum)

WC = "If someone's done, let others use the leftover time." NWC = "You get exactly your slot — nothing more, nothing less."


4.3 Preemptive vs Non-Preemptive Schedulers

FeaturePreemptiveNon-Preemptive
Resource allocationFor a limited time (time slice)Held until process terminates
InterruptionCan be interrupted mid-executionNot interrupted until done
Starvation riskDue to priority insertionDue to large burst time monopoly
OverheadRequires queue + remaining time trackingNo such overhead

⭐ Exam Q: Why is preemption good for I/O-intensive workloads? I/O-bound processes frequently wait for disk/network. Preemption lets the CPU serve other processes during those waits, rather than sitting idle.


4.4 Completely Fair Scheduler (Linux CFS)

  • Default CPU scheduler in Linux (since kernel 2.6.23)
  • Goal: fair CPU time distribution among all runnable processes

Key Concept: vruntime

  • Each process tracks virtual runtime (vruntime) — increases as the process runs
  • Scheduler always picks the process with the smallest vruntime next
  • Processes that ran less recently get priority → fairness over time

Schedule: process with smallest vruntime\text{Schedule: process with smallest } vruntime

Two Key Properties

  1. Long-term Fairness — All equal-priority processes receive approximately equal CPU over time
  2. Immediate Decision — At each scheduling point, run the process with smallest vruntime

Analogy: vruntime is like a debt counter. Whoever used the CPU least recently has the lowest "debt" and gets to go first. Over time, everything levels out.


4.5 Workload Management

Workload Management = ability to precisely assign (CPU, memory, I/O) resources to applications.

ApproachHow It WorksProblem
StaticResources estimated once and assigned permanentlyOver-provisioning (wasted resources)
DynamicResources allocated and adjusted to match actual demandMore complex to implement

Dynamic workload managers typically use PS schedulers in NWC mode for performance isolation.


5. Resource Management in Virtualized Servers

Key challenges:

  1. Many different, mixed workloads
  2. Finite workloads per server
  3. Workload requirements change over time
  4. Need performance and resource isolation between VMs

6. Xen CPU Schedulers — Case Study

Three schedulers introduced in Xen VMM (Virtual Machine Monitor), in order:

SchedulerEraCore Idea
BVTOldestVirtual time + fair-share
SEDFMiddleDeadline-based
CreditCurrentWeight + credits + load balancing

6.1 Borrowed Virtual Time (BVT)

Core Idea: Fair-share scheduler based on virtual time. Runs the VM with the lowest virtual time first.

How It Works

  1. Each thread has a virtual time counter
  2. Scheduler always picks the thread with the smallest virtual time
  3. Latency-sensitive apps can "borrow" from their future CPU time to jump the queue
  4. After borrowing, the thread's virtual time is penalized to compensate
  5. Long-term fairness is maintained — borrowing only creates a temporary priority boost

BVT Example

Scheduler compares Effective Virtual Time (EVT) = Raw VT − Borrowed

ThreadRaw VTBorrowedEVTRuns...
Thread-2100101st (tied)
Thread-3155101st (tied)
Thread-120020Last

After Thread-3 runs, its VT increases, so it drops down the queue → fairness restored.

BVT Characteristics

✅❌
PreemptiveWC-mode only (no NWC)
Optimally fairLimits performance isolation
Low-overhead on uni- and multiprocessors

⭐ Exam Q: What's the problem with BVT? If a process keeps borrowing and borrowing → unfairness accumulates. Long-term fairness breaks down under repeated borrowing.


6.2 Simple Earliest Deadline First (SEDF)

Core Idea: Deadline-based scheduler — the VM with the earliest deadline runs next.

Parameters Per Domain

(si, pi, xi)\boxed{(s_i,\ p_i,\ x_i)}

ParameterMeaning
sis_iSlice — how much CPU time the domain gets
pip_iPeriod — how often it receives that slice
xix_iExtra — can it receive extra CPU in WC-mode? (1 = yes)

Domain ii receives sis_i time units every period of length pip_i.

Assigning 30% CPU

sipi=0.3\frac{s_i}{p_i} = 0.3

Two valid configurations:

  • (3ms, 10ms, 0) → gets 3ms every 10ms
  • (30ms, 100ms, 0) → gets 30ms every 100ms

Both give 30% — but the period size affects behavior:

FactorSmall Period (3ms, 10ms)Large Period (30ms, 100ms)
GranularityMore frequent CPU slicesLess frequent
LatencyLower (better for interactive)Higher
Burst LengthShort (3ms at a time)Long (30ms uninterrupted)
Context SwitchesMore (higher overhead)Fewer (lower overhead)
Best ForReal-time, interactive tasksBatch / compute-heavy workloads

Burst Time = time needed to execute the process (processing time)

⭐ Exam Q: What determines the proper choice of ss and pp? Answer: C. Throughput

SEDF Example

  • P1: (3ms, 10ms, 0) → runs 3ms every 10ms, deadline = 10ms
  • P2: (5ms, 15ms, 0) → runs 5ms every 15ms, deadline = 15ms

Execution (Earliest Deadline First):

  1. Time 0: P1 runs for 3ms (deadline 10 < 15 → P1 first)
  2. Time 3: P2 runs for 5ms (P1 done, P2 deadline 15)
  3. Time 8: P1 runs again (new deadline 20)
  4. Time 11: P2 runs again (new deadline 30)
  5. Pattern continues...

SEDF Characteristics

✅❌
Preemptive, supports WC and NWCFairness depends on period value
Precise timing guaranteesPer-CPU queue — no global load balancing
Good for real-time workloadsNot ideal for large-scale VM deployments

When to Use SEDF

✅ Use For❌ Avoid For
Hard real-time guaranteesLarge numbers of VMs
Deterministic latency requirementsNon-real-time workloads
Safety-critical VMsHeavy overcommit environments
Automotive hypervisors, industrial controlGeneral-purpose cloud

6.3 Credit Scheduler (Current Xen Default)

Core Idea: Proportional-share scheduler with automatic global load balancing across all physical CPUs on SMP hosts.

Parameters Per VM

ParameterMeaning
WeightDetermines proportional CPU share
Cap = 0VM can receive extra idle time → WC-mode
Cap ≠ 0VM is limited to cap value → NWC-mode

How It Works

  1. Each VM gets an initial credit allocation proportional to its weight
  2. When a VM runs → it spends credits
  3. Scheduler picks the VM with the highest remaining credits next
  4. If credits go negative → VM is deprioritized (let others run)
  5. Idle VMs accumulate credits (but don't consume them)
  6. Before any CPU goes idle → scheduler checks other CPUs for runnable vCPUs (global load balancing)

Credit Allocation Example

VM allocation=wi∑w×100%\text{VM allocation} = \frac{w_i}{\sum w} \times 100\%

VMWeightCPU Allocation
VM1200200/600 = 33.3%
VM2100100/600 = 16.7%
VM3300300/600 = 50.0%

If VM2 becomes idle → its share is redistributed to active VMs.

Timing

  • Works in 30ms slices — a vCPU runs for 30ms before being preempted
  • Credits of all runnable VMs recalculated every 30ms
  • CPU usage monitored every 10ms

Credit Scheduler Characteristics

✅Notes
PreemptiveSupports both WC and NWC modes
Automatic global load balancingKey advantage over BVT and SEDF
No CPU goes idle with runnable workEfficient multiprocessor utilization

Analogy: Credit Scheduler = a taxi dispatcher that automatically reassigns idle drivers to busy pickup zones. Fair, efficient, and globally aware.


7. Evolution: BVT → SEDF → Credit

TransitionWhat Was Added
BVT → SEDFAdded NWC mode (performance isolation via caps)
BVT/SEDF → CreditAdded automatic global load balancing on SMP systems

Full Comparison

FeatureBVTSEDFCredit
Scheduling BasisVirtual time (fair-share)Earliest deadlineCredit/weight
ModeWC onlyWC + NWCWC + NWC
Load Balancing❌ No❌ No (per-CPU queue)✅ Yes (global SMP)
Real-time Support❌ No✅ Yes❌ No
Starvation Prevention✅ YesDepends on config✅ Yes
Best ForFair sharing, simple casesPeriodic real-time tasksGeneral-purpose cloud VMs

8. Challenges in VMM Scheduling

Three main challenges compared to OS scheduling:

ChallengeCauseDescription
Semantic GapOS independenceTwo independent scheduling layers. VMM sees each VM as a black box — cannot see inside
Scarce InformationSmall TCBHard to extract workload characteristics. Only I/O and privileged instructions visible to VMM
Inter-VM FairnessPerformance isolationFavoring one VM must not compromise others

Two competing goals for VMM design:

  • Lightweightness — No cross-layer optimization
  • Efficiency — Intelligent, informed VMM decisions

9. I/O Model in Xen

  • Dom0 performs I/O on behalf of all guest VMs
  • Dom0 itself requires CPU allocation to process I/O for other VMs
  • Key question: How much CPU should Dom0 get?

Findings from experiments:

  • As Dom0 weight increases relative to Dom1 → web server throughput decreases (Dom1 gets less CPU)
  • As SEDF period PP increases → throughput decreases (longer gaps between CPU slices → higher latency)

10. Experimental Comparison (Paper Summary)

Benchmarks: Web server (req/sec), Iperf (network Mbits/s), Disk read (MB/s) Setup: Dual CPU HP workstations, 1-GHz PIII, 2GB RAM, Xen 3.0.3

Key Findings

ScenarioFinding
Single nodeAll three schedulers perform similarly
SMP (multi-CPU)Credit scheduler increases throughput with more VMs due to global load balancing
I/O workloadsHighly sensitive to Dom0 CPU allocation across all schedulers
Credit vs SEDF/BVT on SMPCredit throughput sometimes lower in single-node case due to higher allocation error

11. Summary Table

ConceptKey Point
PS SchedulingCPU share ∝ weight. Prevents starvation. No deadline guarantees.
WC ModeCPU shares = guarantees (minimums). Idle CPU is redistributed.
NWC ModeCPU shares = caps (maximums). Strict isolation.
PreemptiveProcess can be interrupted. Good for I/O workloads.
CFS (Linux)Picks process with smallest vruntime. Fair over time.
BVTFair-share via virtual time. WC only. Borrowing can cause unfairness.
SEDFDeadline-based. WC + NWC. No global load balancing.
CreditWeight + credits + global SMP balancing. Current Xen default.
CPU OvercommitMore vCPUs than physical cores. Scheduler time-shares.
StarvationProcess perpetually denied resources. Good schedulers prevent this.

Overall Analogy for the Whole Chapter: Imagine a theme park (cloud) with limited rides (CPUs).

  • Admission control = how many people enter the park
  • Capacity allocation = which rides each group gets
  • Load balancing = distributing people across rides so no single ride queues for 3 hours
  • Scheduler = the park staff deciding who boards next, for how long, and whether someone can "borrow" a spot
  • BVT = fair queuing with an express-pass you repay later
  • SEDF = reserved time slots (you pre-book your 3-minute ride window)
  • Credit = a points system where popular rides auto-reassign to wherever the crowd is thickest