Two-Level Virtual CPU Scheduling for Fairness

Resolve Bottlenecks,
Find Innovative Solutions
Generate Solutions

Solution Overview

Problem

Conventional schedulers face challenges in efficiently sharing physical CPUs among virtual machines, particularly in symmetric multi-processing environments, leading to issues like vCPU pre-emption causing busy loops and inadequate consideration of idle vCPUs, which can result in performance losses and unfair resource allocation.

Innovation Solution

A two-level scheduling approach is implemented, with a local first-level scheduler electing a virtual machine to run on a physical CPU using priority-based or fair-share policies, and a global second-level scheduler selecting a virtual CPU to run based on cumulative waiting time, interrupt masking, and locality bonuses to promote vCPU migration and fairness.

Engineering Contradictions & Design Principles

VSEngineering Contradiction Analysis

1Productivity

If a vCPU is pre-empted to share physical CPU resources among multiple VMs, then resource utilization is improved, but it causes useless busy loops in other vCPUs and performance losses

Engineering Contradiction:
ImproveCPU resource utilizationVSAvoidvCPU execution stability
Core Design Contradiction:
ProductivityVSReliability

Solution Approach 1:

The scheduling system is segmented into two distinct levels: a first level that schedules VMs to physical CPUs, and a second level that schedules vCPUs within elected VMs to the physical CPU. This segmentation prevents vCPU pre-emption issues by ensuring that only one vCPU from the elected VM runs on a physical CPU at a time, eliminating spin-lock contention while maintaining resource utilization through the hierarchical structure.

Inventive Principle:
Principle #1Segmentation

Solution Approach 2:

The patent introduces a hierarchical dimension to scheduling by adding a second scheduling level within the elected VM. Instead of flat scheduling where any vCPU can be pre-empted, the system adds a nested scheduling layer that manages vCPU execution sequentially, transforming the scheduling problem from a two-dimensional (VM to CPU) to a three-dimensional (VM selection, vCPU selection, and execution timing) solution space.

Inventive Principle:
Principle #17Another dimension (Dimensionality change)

2Adaptability or versatility

If conventional schedulers share physical CPUs among multiple guests using priority policies, then resource allocation flexibility is improved, but SMP-specific requirements cannot be met and vCPU pre-emption issues occur

Engineering Contradiction:
ImproveCPU sharing policy flexibilityVSAvoidSMP scheduling complexity
Core Design Contradiction:
Adaptability or versatilityVSDevice complexity

Solution Approach 1:

The scheduling complexity is segmented into two manageable levels: the first level handles VM-to-CPU allocation using flexible priority or fair-share policies, while the second level handles vCPU scheduling within the elected VM using simple round-robin or time-slice methods. This segmentation allows the system to maintain adaptability in resource allocation while reducing the complexity of SMP-specific scheduling by separating concerns between VM management and vCPU management.

Inventive Principle:
Principle #1Segmentation

3Device complexity

If vCPUs are scheduled without considering cumulative waiting time, then scheduling simplicity is maintained, but fairness among virtual CPUs deteriorates

Engineering Contradiction:
Improvescheduling algorithm simplicityVSAvoidfairness among vCPUs
Core Design Contradiction:
Device complexityVSEase of operation

Solution Approach 1:

The second level scheduler incorporates feedback mechanisms by tracking cumulative waiting time for each vCPU. The scheduler uses this feedback information to make fair scheduling decisions, ensuring that vCPUs that have waited longer are given priority for execution. This feedback loop maintains fairness while keeping the scheduling algorithm relatively simple by only adding a waiting time counter and comparison logic.

Inventive Principle:
Principle #23Feedback

Data Source

PatentEP2323035B1Scheduling system
Publication Date: 2019.04.17 RED BEND SOFTWARE
  • EP2323035B1 patent drawingFigure 1
  • EP2323035B1 patent drawing
  • EP2323035B1 patent drawing

AI summary

The present invention provides a scheduling method for a data processing system comprising at least one physical CPU, and one or more virtual machines each assigned to one or more virtual CPUs, the method comprising: a first scheduling step in which one of said virtual machines is elected to run on said physical CPU; and a second scheduling step in which at least one of the virtual CPUs assigned to the elected virtual machine is elected to run on said physical CPU. The second scheduling step is applied to the virtual machine only. When a virtual machine instance is elected to run on a given CPU, the second level scheduling determines the virtual CPU instance to run. The second level scheduling is global and can cause a virtual CPU migration from one physical CPU to another. In order to ensure correct task scheduling at guest level, virtually equivalent (in terms of calculation power) virtual CPUs should be provided to the scheduler. This is achieved by the second level scheduler using a virtual CPU election criteria based on time statistics.