Benefits of enabling multiple processors?

Discussions related to using VirtualBox on Windows hosts.
Post Reply
omega1
Posts: 46
Joined: 7. Nov 2013, 12:53

Benefits of enabling multiple processors?

Post by omega1 »

Hello,

I have a Windows 7 host with some Windows XP and WIndows 7 guests.

I have been doing some testing with multiple processors, changing from 1 to 4 (on the guests) and cannot see any benefit in doing so from an overall performance point of view.

Would I be right in assuming that if you only have one processor enabled on the guest that VirtualBox takes care of everything? I notice that when I only have one processor enable, the load of the guest seems to be spread out over various cores of the host, but if I enable 4 processors, the load is handles in pretty much the same way (load over 4 cores on the host).

I guess my question is, what is better to achieve overall performance for both the host and the guests? Should I enable the maximum processors on all guests or should I just enable one processor on each guest and allow VirtualBox to sort out the load across the host cores?

Thanks in advance for any suggestions and clarifications on the way this works.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Mostly XP

Re: Benefits of enabling multiple processors?

Post by mpack »

Multiple CPUs only benefit multithreaded apps. A modern guest OS is itself a multithreaded app, but of course it is generally designed to use minimal CPU (it isn't CPU bound). A multi-CPU aware guest OS will also tend to run guest apps on separate cores when it can.

So the answer to your question as to whether adding additional CPU cores to a VM will boost performance, the answer is - possibly, it depends on what apps you run in the guest.

However: the feature does carry a management overhead (N times as much context info to save on every task switch), so you shouldn't really add more cores to a VM than it absolutely needs.

Other common misconceptions:
  1. Mistaking threads for cores. A 2-core intel CPU with hypertheading has.... 2 cores (not 4).
  2. Assuming that guests will always go faster if you add cores. In fact they will only go faster if they are designed to be multithreaded AND were previously CPU bound. E.g. if they're actually I/O bound then the extra CPU will make things slower (management overhead again), not faster (does adding two engines to a car make the car go faster?).
  3. Wooly thinking: e.g. the only way to guarantee that CPU bound apps will go faster is to increase the clock speed. Adding extra cores at the same clock speed by itself will do nothing.
  4. Forgetting that the host needs cores too. In the above dual core case, giving the VM 2 cores leaves the host with none. Of course that can't really happen, but it can leave the host starved of resources, and if the host is running like a snail then the guest won't be fast either, no matter what resources you gave it.
Post Reply