Processor topology inside of Hyper-V virtual machines

Processor topology inside of Hyper-V virtual machines

  • Comments 11

A number of people have noticed that they can create a virtual machine with four virtual processors, and then successfully run Windows XP on it and have it utilize all four virtual processors.  This strikes them as odd, because Windows XP supposedly only supports the use of one or two processors in a computer.

To understand what is happening we need to talk about processor topology.

A long time ago, the universe used to be quite simple.  When you talked about a processor you meant a physical chip that you put inside a computer that was capable of handling one stream of execution.  Then along came concepts such as hyper-threading and multi-core processors.  These technologies allow a single physical processor to handle multiple streams of execution, and effectively appear like multiple physical processors.

In this new world, in order to differentiate between the physical chip that you put in a computer and a single stream of execution on the chip, we use the terms "package", "socket" or "physical processor" to refer to the actual physical chip that you put inside the computer,  and the term "logical processor" to refer to a single stream of execution on the chip.

"Processor topology" is simply the ratio, and nature, of logical processors to physical processors in a computer.

This all gets interesting when it comes to the question of how virtual processors are represented inside of a virtual machine.

When hyper-threading and multi-core processors first came onto the scene, Microsoft made the decision to license all of its software based on the number of physical processors [and not logical processors] in a system.  This means that when you try to create a "four processor" virtual machine the way in which we represent those four processors can affect how the software that runs inside the virtual machine will need to be licensed.

Obviously, as Microsoft, we do not want you to be able to run software that utilizes more processing power than you are correctly licensed to use.  On the flip side, we understand that you do not want to have to pay more for your software than you actually need to. 

To this end, Hyper-V examines the processor topology of your physical computer and exposes that into the virtual machine.

Thus, a virtual machine with four virtual processors that is running on a physical computer with a single quad-core physical processor will appear to only have a single physical processor with four logical processors.  The same virtual machine running on a system using two dual-core physical processors would appear to have two physical processors with four logical processors [two logical processors per physical processor].

And this is what allows Windows XP to run on your "four virtual processor" virtual machine and utilize all of the virtual processors, because it is still within its licensing right of one or two physical processors, if you are running on a hyper-threaded or multi-core system.

Cheers,
Ben

UPDATE: To help visualize this, below is a table that shows you the processor topology that will be reported inside the virtual machine, given the processor topology of the physical computer and the number of virtual processors configured for the virtual machine.

# Virtual Processors / Physical Processor Topology 1 Virtual Processor 2 Virtual Processors 4 Virtual Processors
4 single-core processors 1 single-core processor 2 single-core processors 4 single-core processors
2 dual-core processors 1 single-core processor 1 dual-core processor 2 dual-core processors
1 quad-core processor 1 single-core processor 1 dual-core processor 1 quad-core processor
Leave a Comment
  • Please add 4 and 2 and type the answer here:
  • Post
  • Please improve you language. Any one can get confused reading your english.

  • So, if you assign specific cores to a virtual machine, does Hyper-V report that topology to the virtual machine? For example, if I had a system with two four-core processors, but I only assigned cores from the first processor package to the VM, would the VM see a two-package or one-package system?

    This could be important for licensing.

  • Ben, you might want to do a quick edit here...

    Thus, a virtual machine with four virtual processors that is running on a physical computer with a quad core processor will appear to only have a single physical processor with four logical processors.  The same virtual machine running on a system using dual core processors would appear to have two physical processors with four logical processors [two logical processors per physical processor]....

    So basically it depends on the number of SOCKETS in your system.  

    Each core or hyperthreading instance is seen as a logical processor, NOT a physical processor.

    The underlying host processor socket count is what matters for how your guest will compute its licensing.  If you have quad physical processors and try to expose all 4 of them to the system, XP will not allow it because there are physically 4 processors in the system and Hyper-V lets the guest know that.

    On the other hand, if there are 2 physical socketed processors in the system, and each of those has two cores, even though there are really 4 cores availible, Hyper-V tells the guest VM that there are only two physical sockets in the system and its ok to use all 4 cores.

  • Mike Dimmick -

    We do not allow you to assign specific cores / processors to a virtual machine.  Just the number of logical processors you want the virtual machine have.  

    Wayne Aderson -

    Not quite - it is not just the number of sockets, but the number of cores per socket that is important.

    Cheers,

    Ben

  • Meaning two physical quad-cores are also ok as per the licensing?

  • The thing I am curious about is - how the resources are being mapped if we have more CPUs/ cores? Let’s say 4 x quad core processor hardware under control of windows 2008 datacenter? How would the “horsepower” distribution look like if I have i.e. 8 x dual-cpu virtual machines running inside that box? Will every virtual machine share a pool of all 16 cores, or is it more like 1-to-1 mapping between hardware cores to virtual ones?

  • Thank you for the explanation.

  • Page 19 of the MS virtualization whitepaper (http://download.microsoft.com/download/6/8/9/68964284-864d-4a6d-aed9-f2c1f8f23e14/virtualization_whitepaper.doc)says this:

    "If you run the [Per-Processor] software in virtual OS environments, you need a license for each virtual processor used by those OS environments on a particular server, rather than all the physical processors in the server." On page 18 and 19 of this document, licensing by physical processor seems to be the "previous licensing". They point out an example in which there are 4 physical processors, but a 4-licenses SQL Server is not necessary. I'm confused: which way is old, and which way is new?? Help! Thanks.

  • In other words, if I am not mistaken, the paper above (pages 18-19) suggests that for per-processor software, MS used to license by physical processor, but now goes by virtual processor. It's dated 2006, but it's still linked on the MS site. In your post you suggest that they go by physical processor. I'm curious which it is??? Thanks.

  • In general, it is not a good idea to expose each VM with 2 or more VCPUs. If the application will use it, and performance wise, it is needed, that's another issue. But think about your host and how many VMs per host you want to have running. If you are able to only use one VCPU per VM, you would be able to run that many more VMs on the host.

    It's really a return to the days when you had to think clearly about whether or not the OS and application even could spell SMP.

    As a side note, the thing I find really comical regarding the whole SMP discussion in respects to XP is that, although XP has always been SMP capable, whenever forums and technology folks would be asked the question about whether they should buy a 2 CPU PC (before HT and multi core) the answer was always the same: well, will your application use them, is it even SMP aware? If not, don't waste your money.

    Enter Intel Core Duo, and all of a sudden, 'you can get more done' and games 'will run faster' with more cores. XP hasn't changed. I really wonder if the average user is really gaining anything by having multiple cores...

  • We have two  Physical AMD CPUs for a HP Server with total of 32 cores for 2008 R2 64bit Hyper-V host. SQL Server is one of the VM and assigned 4 logical processesor. All 4 logical CPUS on Guest SQL VM show almost 100% CPU utilization on SQL Server while all other VMs and Host shows almost no usage. How can we make SQL server VM use all available CPU cores?

    Thank you. LasPalm@live.com

Page 1 of 1 (11 items)