none
How CPU works in backend with Hyper-V role enabled system?

    Question

  • Hi Guys,

    Can any one will tell me exaclty how CPU works on Hyper-v roled enabled system?

    For Example : If a virual machine runs on 2 or 4 core, how many of physical CPUs it utilizes on physical host and if my physical host machine has 8 CPUs.

    If I have 5 Virtual machine and every VM has 2 core then total core used by VMs is 10 but on my physical host I have only 8 core. So it got exceed the number of VM core with physical core.

    so At the backend whats happens ? what calculation take place here to serve all the VM cpu requirement. 

     

    Thanks

    Regards

    BG

     

    Wednesday, September 28, 2011 10:15 AM

Answers

All replies

  • Hi!

    You can read this article on the Hyper-V product team blog, here:

    http://blogs.technet.com/b/virtualization/archive/2011/04/25/hyper-v-vm-density-vp-lp-ratio-cores-and-threads.aspx

     

    You don't assign physical cores to your VM, but rather present the number of simultaneous execution threads available to a VM.

    So in your example your VM is configured with 4 cores, means that the VM can perform 4 parallell CPU executions, while at the host level the actual executions are spread across all 8 cores by Hyper-V.

    If you've configured many VM's with more vCPU than physical CPU, then the executions are queued and performed when CPU time is available. This can also be set in the VM settings, so that a VM can have more CPU time than other VM's


    Wednesday, September 28, 2011 10:48 AM
  • This article also goes into details about time slicing etc.

    http://social.technet.microsoft.com/wiki/contents/articles/hyper-v-concepts-vcpu.aspx

    And then there is also this visual of what happens:

    http://itproctology.blogspot.com/2009/12/hypervisor-virtualization-basics.html

    Look at the one about CPU.


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Wednesday, September 28, 2011 2:34 PM
    Moderator
  • Hi Guys,

    Can any one will tell me exaclty how CPU works on Hyper-v roled enabled system?

    For Example : If a virual machine runs on 2 or 4 core, how many of physical CPUs it utilizes on physical host and if my physical host machine has 8 CPUs.

    If I have 5 Virtual machine and every VM has 2 core then total core used by VMs is 10 but on my physical host I have only 8 core. So it got exceed the number of VM core with physical core.

    so At the backend whats happens ? what calculation take place here to serve all the VM cpu requirement. 


    An eight core CPU without Hyper-Threading has the ability to process 8 threads simultaneously. To keep things simple we will avoid the HT conversation.

    An important point to keep in mind that the number of vCPUs assigned to a VM = the number of threads that _have_ to pass through the CPU _at the same time_.

    So, a VM with 4 vCPUs would have to have 4 threads processed simultaneously.

    Now, this is where things get a little sticky, and the reason why the linked article discusses the VP:LP ratio as being important.

    With 8 threads available to us on your CPU we can use your 5 VM with 2 vCPUs as an example. Note that each bullet represents a set of 8 possible threads that can processed by the CPU.

    Okay, so theoretically the physical CPU could process four VM's vCPUs simultaneously (NOTE: * = thread):

    • |**| |**| |**| |**|
    • VM1 VM2 VM3 VM4

    Now, this is the "sticky" part:

    • |*| |**| |**| |**|
    • OS VM5 VM1 VM2

    In the above example we have two VM's vCPU threads being processed and one OS core service thread. Now, that leaves one core empty due to the way the CPU queues and processes threads.

    Because of the way the physical CPU queues and processes threads Microsoft has come up with the VP:LP ratio. It is to help us to understand at what point the CPU's queue will become overwhelmed by all of the VM's threads waiting in the queue to be processed.

    Also note that Microsoft is explicit about defining the VP:LP for the Windows 7 desktop OS as being different than any other configuration because as soon as we introduce vCPUs running with 3, 4, and now with more threads the number of cores in a system becomes all the more important for overall system/VM performance.

    Taking that we can see the following as being possible:

    • |****| |**| |*|
    •   VM6   VM1 OS
    • |**| |****| |**|
    • VM2   VM7   VM3
    • |*| |****| |**|
    • OS   VM6   VM4

    And so on. Notice that because the 4 vCPU VMs require those four threads to be processed simultaneously the queue gets a little longer due to the CPU's need to juggle which threads get processed when.

    Today's CPUs are vastly better at working in these types of environments due to improved internal logic, data path efficiencies improved, Hyper-Threading (we don't put too much into this feature), and more. Thus: YMMV. :)

     


    Philip Elder SBS MVP Blog: http://blog.mpecsinc.ca
    • Edited by Philip ElderMVP Wednesday, September 28, 2011 4:04 PM Removed the "e" in avoid.
    Wednesday, September 28, 2011 3:56 PM
  •  

    Thanks guys for your relpy..

    And How SLAT feature works in Windows 2008 R2 ?

     

     

    Regards

    BG

     

    .

     

     

    Friday, September 30, 2011 4:30 AM
  • SLAT is a hardware offloading feature. 

    In the case of Hyper-V it is specific to RemoteFX (and supporting the graphics offload of RemoteFX). 

    It is not required to run VMs, only to support using RemoteFX.

    http://en.wikipedia.org/wiki/SLAT-enabled_processors

     


    Brian Ehlert (hopefully you have found this useful) http://ITProctology.blogspot.com
    Learn. Apply. Repeat.
    Friday, September 30, 2011 2:41 PM
    Moderator