Other Scheduling Considerations

The hypervisor might handle the scheduling considerations that are described in the following sections:

Hyperthreading

Multiple virtual processors can optionally be grouped together and scheduled onto hyperthreads within a single physical processor core. In effect, these virtual processors then act like virtual hyperthreads. When virtual processors are grouped as such, the hypervisor attempts to schedule them concurrently on the same physical processor core. This scheduling behavior potentially improves performance and reduces information leakage across partition boundaries.

NUMA and Affinity

When a virtual processor is runnable, the hypervisor's scheduler assigns the virtual processor to a logical processor. The placement is determined based on a variety of factors including workload, reservations, and NUMA topology. In general, the scheduler will attempt to keep a virtual processor scheduled on a logical processor that is topologically closest to the memory being accessed by the virtual processor, in effect minimizing memory access times.

The scheduler also attempts to create as much temporal affinity as possible. That is, the scheduler will prefer to run a virtual processor on the same logical processor each time it is scheduled. If the logical processor is oversubscribed, the scheduler might move the virtual processor to another logical processor.

Guest Spinlocks

A typical multiprocessor-capable operating system uses locks to enforce atomicity of certain operations. When running such an operating system inside a virtual machine that the hypervisor controls, critical sections that are protected by locks can be extended by intercepts that are generated by the critical section code. The critical section code can also be preempted by the hypervisor scheduler. Although the hypervisor attempts to prevent such preemptions, they can occur. Consequently, other lock contenders could end up spinning until the lock holder is re-scheduled again; therefore, the spinlock acquisitions could be extended significantly. The hypervisor provides an approximate count of iterations that a spinlock failure path can perform before the spinlock failure path should indicate an excessive spin situation to the hypervisor. This count is returned in CPUID leaf 0x40000004. For more information about the CPUID leaf 0x40000004, see Microsoft Hypervisor CPUID Leaves.

Enlightened guests can use the HvNotifyLongSpinWait hypercall function to improve the statistical fairness property of a lock for multiprocessor virtual machines. That is, a guest can use HvNotifyLongSpinWait to notify the hypervisor of a long spinlock acquisition. The hypervisor can then make better scheduling decisions for the invoking virtual processor.

 

 

Send comments about this topic to Microsoft

Build date: 11/16/2013

Show:
© 2014 Microsoft. All rights reserved.