I suppose this question could apply to any virtualization technology, but I am trying to understand some of the details specific to Microsoft Hyper-V Server and how virtual CPU resources are scheduled across physical CPU resources.
It appears that Hyper-V Server schedules virtual CPUs from every VM in a round-robin fashion across all available physical CPU resources using time slicing. By default all VMs are scheduled equally, but a VM's CPU priorities and thresholds can be adjusted to effectively change how frequently they are scheduled.
There are some missing details here that I cannot seem to find anywhere online. This is more for just personal curiosity, but it might affect how I balance VMs across physical hosts in the future.
(1) Does the CPU load on a VM change its effective priority as compared to idle VMs? Suppose I have two VMs, each with one virtual CPU, contending for a single physical core. If VM 1 has a high CPU load and VM 2 is idle, of the N slices available in a given time period for the single resource, do both VMs receive ~N/2 slices? It seems like it would be better that VM 1 receives closer to N slices.
(2) Does Hyper-V automatically maintain any kind of physical CPU affinity? Suppose I have a single VM, two physical processors and non-uniform memory access (where each physical processor has its own local memory which is faster to access). Does Hyper-V schedule the VM's virtual CPU(s) across both physical processors? It seems like if the VM's allocated memory fit entirely in one memory location, then it would be optimal to schedule the VM on that physical CPU instead of across both CPUs.