VM Scheduler Basics

This is a collection of basic concepts of the VM scheduling and dispatching, that may not be covered elsewhere in the documentation. For a more thorough presentation on the scheduler, please see the VM Scheduler Made Simple.

Virtual Multiprocessor Support

We are often asked how many virtual processors to define for a virtual machine. The answer is 'it depends'. The dispatchable units from a VM scheduler and dispatcher point of view is the virtual processor (with some exceptions). In general, you want to define as many virtual processors as needed (maximum processor resources required), but no more than that. Further, do not define more virtual processors than the number of logical processors. Extra virtual processors just add to the overhead and potentially increase the software MP factors.

An example may help. A VM system is running in an LPAR with 4 dedicated logical processors. Guest1 is a virtual 2-way and Guest2 is a virtual 4-way. Guest2 could have all 4 virtual processors dispatched across the 4 logical processors available to VM. Meanwhile, Guest1 (virtual 2-way) can only be dispatched across 2 logical processors at a time. So the maximum amount of processor time Guest2 could get is 400% of a real processor, while the maximum amount for Guest1 is 200%. Now, introduce some contention. Lets assume both virtual machines have the default share setting of Relative 100. The share setting is assigned to a virtual machine, but distributed across the virtual processors. Guest1 would have 2 virtual processors with effective shares of Relative 50 each and Guest2 would have 4 virtual processors with effective shares of 25 each. So each Guest1 virtual processor would have a priority twice as high as each Guest2 virtual processor. So, all things being equal, the scheduler would attempt to give the virtual machines as a whole about equal access to the processor resources.

A few other considerations

  • There is an extra hit in terms of VM overhead in going from a virtual 1-way to virtual n-way, but after that it is fairly flat.
  • Even though processors are virtual, software MP factors still apply in the guest.
  • Realize the contention environments could increase the MP factors. One virtual processor of a machine may be waiting and spinning on a lock held by another virtual processor. If the virtual processor holding the lock can't get access to run (and therefore release the lock), there is added overhead. Some systems do exploit special diagnoses in these cases to minimize the impact.
  • Not all virtual processors in a virtual machine have to be dispatched at the same time. The Scheduler and Dispatcher treat them separately for the most part.

Back to the Performance Tips Page