Home » Questions » Computers [ Ask a new question ]

Is there an optimal setting for the number of CPU cores exposed to a VM?

Is there an optimal setting for the number of CPU cores exposed to a VM?

VirtualBox, and possibly other VM software, allows the user to specify the number of CPUs exposed to the VM. In my particular case, I have a dual core CPU, with Windows 7 64-bit running natively, and Ubuntu 9.04 64-bit as the VM.

Asked by: Guest | Views: 306
Total answers/comments: 4
Guest [Entry]

"It entirely depends on what the guest OS is doing. In my personal experience a VM is running a single program (build server, trac server, SVN, etc) so there is no reason to set it above one.

A possible case may be if it's an end user on say a University that is using the guest OS as a throwaway (i.e. TAs) then maybe set it to higher than one."
Guest [Entry]

"The number of cores exposed to guest CPUs does not affect performance as much as you would like. It merely adjusts the amount of cores the guest CPU ""sees"".

Depending on how the emulator is set up, it could literally half the performance of the virtual machine, do nothing, or only impact the way the guest OS/applications split up their thread scheduling.

It's best to leave it to the default. If you encounter performance issues on the host PC, then you can simply adjust the process priority with the Windows Task Manager."
Guest [Entry]

"This depends on what you want to do on the virtual machine as well as on the physical machine. If you need to use the virtual machine while the host operating system is being used for some other activity, it may be better to use two processor cores for the VM so that the host has two remaining if the VM is under full load. On the other hand, if you are working primarily on the VM, you can use all processor cores.

However, unless the guest can be expected to use all four cores at once, you can safely use all of them while continuing to work on the host OS. Remember that you can always adjust the priority of the VM process while it's running on the host operating system, and the system will balance the loads accordingly."
Guest [Entry]

yes, I'd also say that it depends. But I'll say what I prefer to do. At work I have a quad core CPU. So for my virtual image (win7), I've allocated two CPUs. That way, I can use both the host machine and the virtual machine at the same time, and they each have equal CPU resources.