Knowledge Base

The VMware Knowledge Base provides support solutions, error messages and troubleshooting guides
 
Search the VMware Knowledge Base (KB)   View by Article ID
 

Setting the number of cores per CPU in a virtual machine (1010184)

Purpose

This article provides information on setting number of cores per CPU in a virtual machine.

Note: This feature is experimental in vSphere 4.0. This article applies to ESX 4.1, ESXi 4.1.

For information relating to setting the Number of Virtual CPUs in the vSphere Client for ESXi 5.0, you can
reference the Virtual CPU Configuration section in the vSphere Virtual Machine Administration guide.

For information relating to setting the Number of Virtual CPUs in the vSphere Client for ESXi 5.1, you can reference the Virtual CPU Configuration section in the vSphere Virtual Machine Administration guide.


Resolution


Some operating system SKUs are hard-limited to run on a fixed number of CPUs. For example, Windows Server 2003 Standard Edition is limited to run on up to 4 CPUs. If you install this operating system on an 8-socket physical box, it runs on only 4 of the CPUs. The operating system takes advantage of multi-core CPUs so if your CPUs are dual core, Windows Server 2003 Standard Edition runs on up to 8 cores, and if you have quad-core CPUs, it runs on up to 16 cores, and so on.
 
Virtual CPUs (vCPU) in VMware virtual machines appear to the operating system as single core CPUs. So, just like in the example above, if you create a virtual machine with 8 vCPUs (which you can do with vSphere) the operating system sees 8 single core CPUs. If the operating system is Windows 2003 Standard Edition (limited to 4 CPUs) it only runs on 4 vCPUs.
Note: Remember that 1 vCPU maps onto a physical core not a physical CPU, so the virtual machine is actually getting to run on 4 cores.
 
Considering that 1 vCPU is equal to 1 CPU is an assumption for the sake of simplification, since vCPUs are scheduled on logical CPUs which are hardware execution contexts. These tasks can take a while in the case of a single core CPU, CPUs that have only 1 thread per core, or could be just a thread in the case of a CPU that has hyperthreading.
Consider this scenario:
In the physical world you can run Windows 2003 Standard Edition on up to 8 cores (using a 2-socket quad-core box) but in a virtual machine they can only run on 4 cores because VMware tells the operating system that each CPU has only 1 core per socket.

VMware now has a setting that provides you control over the number of cores per CPU in a virtual machine.

This new setting, which you can add to the virtual machine configuration (.vmx) file, lets you set the number of cores per virtual socket in the virtual machine.
To implement this feature in vSphere Client:
  1. Power off the virtual machine.
  2. Right-click on the virtual machine and click Edit Settings.
  3. Click Hardware and select CPUs.
  4. Choose the number of virtual processors.
  5. Click the Options tab.
  6. Click General, in the Advanced options section.
  7. Click Configuration Parameters.
  8. Click Add Row.
  9. Include cpuid.coresPerSocket in the Name column.
  10. Enter a value (try 2, 4, or 8) in the Value column.

    Notes: Ensure that the number of vCPUs is divisible by the number of cpuid.coresPerSocket in the virtual machine. That is, when you divide the number of vCPUs by the number of cpuid.coresPerSocket , it must return an integer value. For example, if your virtual machine is created with 8 vCPUs, coresPerSocket can only be 1, 2, 4, or 8.

    The virtual machine now appears to the operating system as having multi-core CPUs with the number of cores per CPU given by the value that you provided in step 9.

  11. Click OK.

    For example:

    Using 4 vCPU

    Configuration you want

    Settings needed for this configuration

    Number of sockets

    Number of cores per socket

    Total cores

    Set vCPU to:

    Set cpuid.coresPerSocket/sockets to:

    1

    4

    4

    4

    4

    2

    2

    4

    4

    2











    Using 8 vCPU

    Configuration you want

    Settings needed for this configuration

    Number of sockets

    Number of cores per socket

    Total cores

    Set vCPU to:

    Set cpuid.coresPerSocket/sockets to:

    1

    8

    8

    8

    8

    2

    4

    8

    8

    4

    4

    2

    8

    8

    2

Notes:
  • To be able to assign more than 4 vCPUs or if the processor supports more than 6 cores per processor, you have to assign an Enterprise Plus license, which supports up to 8 vCPUs and 12 cores per processor.
  • Configuration of the max number of vCPU's is subject to your license.
  • Only values of 1, 2, 4, 8 for the cpuid.coresPerSocket are supported for the multi-core vCPU feature in ESX 4.x.
  • In ESX 4.0, if multi-core vCPU is used, hot-plug vCPU is not permitted, even if it is available in the UI.
  • Only  Hardware version 7 virtual machines support the multi-core vCPU feature.
Important: When using cpuid.coresPerSocket, you should always ensure that you are in compliance with the requirements of your operating system EULA (that is, regarding the number of physical CPUs on which the operating system is actually running). For more information, see:

For more details on vCPU entitlement in various vSphere editions, see Compare vSphere Editions.

Additional Information

If you are using operating systems that were released when SMP was a high-end server-only, you expect that you need to do some tweaks such as selecting SMP kernel for Linux virtual machines and Multiprocessor PC HAL for Windows virtual machines.
 
Note: You do not encounter problems with recent operating systems. XP and newer and RHEL5 and newer either always install SMP kernel or automatically switch to it.
 
Some examples of the older operating system versions are:
  • RHel3-ES32
  • RHel3-ES64
  • RHel4.8-AS32
  • RHel4.7-ES32
  • RHel4.7-ES64
  • Win2000-Pro
  • Win2000-Serv
For information on:
Notes:
  • In vSphere 5.0 with Enterprise Licensing and Virtual Machine Hardware Version 8, the maximum number of vCPUs per Virtual Machine is 32.
  • In vSphere 5.0 with Virtual Machine Hardware Version 7, the maximum number of vCPUs per Virtual Machine is 8.

For more information on maximum CPUs allowed, see vSphere 5.0 Configuration Maximums.

Tags

change-number-of-cpu's vm-configure-multi-core-cpu

See Also

This Article Replaces

1022289

Update History

03/14/1012 - Added links to ESX/ESXi 4.1 and 5.0 for configuring Multicore vCPUs 03/26/2012 - Added table examples for setting vCPUs 03/22/2013 - Updated Product Versions to 5.1. Added step 8. 11/14/2013 - Added ESXi 5.5 and vCenter Server 5.5 to Products

Request a Product Feature

To request a new product feature or to provide feedback on a VMware product, please visit the Request a Product Feature page.

Feedback

  • 107 Ratings

Did this article help you?
This article resolved my issue.
This article did not resolve my issue.
This article helped but additional information was required to resolve my issue.
What can we do to improve this information? (4000 or fewer characters)
  • 107 Ratings
Actions
KB: