1

Is there a way to limit the number of logical CPUs that an underlying VM will use (on a Windows 10 host running VMWare Workstation 15 Professional)?

I've tried changing the number of cores per processor but it doesn't have the desired effect. I have 8 cores, but if I set this number to 4, then all 8 cores are still used.

The only solution I know of is to start the VM, get the PID of the VM, and then change the processor affinity (manually) to the logical CPUs I want to limit the VM to use.

I searched the VMWare knowledge base for "limit cpu vmware workstation" (URL is https://kb.vmware.com/s/global-search/%40uri#q=limit%20cpu%20vmware%20workstation&t=Knowledge&sort=relevancy), and get back an error Something went wrong.

This is important because of another question I have, see What VmWare VM is associated with a Process (pid) (on Windows Host)?.

PatS
  • 389
  • 1
  • 4
  • 14

2 Answers2

2

This is set per VM. To edit the settings for the VM: Select the VM; from the menu choose VM>Settings>Processors and choose "Number of processors" and "Number of cores..." How you allocate between those is less important than the product "Total processor cores'. This is the number of cores allocated to the VM.

Also:

  • Workstation itself will use some CPU power to administrate the VM(s)
  • This will not cap the total amount of cores Workstation will use. If you run two 4-core VMs at the same time, you could be using 8 cores.
User5910
  • 536
  • 1
  • 4
  • 19
  • This is not the answer I was hoping to find, but I do believe it is the correct answer so I've accepted this. I have noticed since changing the number of processors to a smaller number that when the VM enters what I call **CPU burn** the VM does not use **all of the host** CPU. So, if I have 8 cores and set the VM to use 4 cores, then when the VM is in **CPU burn**, the host VM will only allow that VM to consume 50% of the host's processing power. This in spirit addresses my problem which was trying to limit a VM from using all the hosts CPU power. – PatS Mar 30 '19 at 15:59
  • On 2020-07-11, I selected Chris's answer because it is the answer I was looking for! – PatS Jul 11 '20 at 04:03
2

You can manually configure a VM's processor affinity in the vmx file. One line per logical core. For example on an 8 core hyperthreaded cpu:

processor0.use = "TRUE"
processor1.use = "TRUE"
processor2.use = "TRUE"
processor3.use = "TRUE"
processor4.use = "FALSE"
processor5.use = "FALSE"
processor6.use = "FALSE"
processor7.use = "FALSE"
processor8.use = "FALSE"
processor9.use = "FALSE"
processor10.use = "FALSE"
processor11.use = "FALSE"
processor12.use = "FALSE"
processor13.use = "FALSE"
processor14.use = "FALSE"
processor15.use = "FALSE"
Chris
  • 36
  • 1
  • Great info! I did not find this anywhere in VMWare documentation. VMWare talks about affinity for vShpere and ESX but not for Workstation. Thank you. – FLICKER Nov 21 '21 at 03:06