Figure 2.10 A virtual processor from a single-processor VM assigned to a logical
processor on the host
This gets more complicated for a virtual machine with multiple virtual processors, a
symmetric multiprocessing (SMP) environment. The problem is that operating
systems believe that all of their processors are available to run at the same time,
because the operating system would exclusively own the hardware and can allow
interdependencies between different computations on different processors. This is a
problem in a virtual environment, because many virtual processors are using the same
logical processors. Therefore, the virtual processor scheduler in the hypervisor could
have a problem.
Consider Figure 2.11, where two of the virtual machines now have multiple
processors. If the processor scheduler has to schedule all of the virtual processors in a
VM to logical processors at the same time, the virtual processor scheduler suddenly
becomes inefficient. Even virtual processors not currently doing work would be
scheduled on the logical processor as a set, and none of the virtual processors in a VM
can be scheduled until there are an equal number of logical processors available to
ensure that the computations for the VM can take place simultaneously. Consider a
heavily used server and that virtual machines can have up to 64 virtual processors.
Trying to group and schedule processors in this way is highly problematic. This type of
scheduling is known as gang scheduling, because when a multiprocessor virtual
machine needs to schedule a processor, all of the virtual processors are “ganged”
together and scheduled together against the available logical processors.