Are there any real advantages to assigning more "cores" to VirtualBox?
Solution 1:
The "virtual" cores you assign to a VM are available to use in multi-processing within the client OS. If you assign only one core to a VM, then there is no chance by the guest OS to distribute load across multiple cores. So let's assume some practical scenarios:
Host with 4 CPUs, guest assigned 1 CPU
- Host machine running 4 physical cores
- Client OS within VM assigned 1 core
In this case the guest OS will be able to use only one core. Therefore if you run a multi-threaded application which scales well on multiple cores it will still run on one core only. Therefore all threads on the guest OS have to share one physical core.
Running a guest OS in this setup which fully loads the CPU will yield a host OS CPU load of ~25% (one out of 4 cores loaded on host).
Of course you can still have CPU-consuming tasks running within your host OS and make use of the remaining 3 cores.
Host with 4 CPUs, guest assigned 4 CPUs
- Host machine running 4 physical cores
- Client OS within VM assigned 4 cores
In this case you can run well-scaling multi-threaded applications within the guest VM which can make full use of all 4 virtual CPUs. VirtualBox will use 4 physical cores to process tasks scheduled within the VM and therefore your host CPU load could reach a maximum of 100% usage.
So what setting should you chose?
The answer to this question depends pretty much on what you would like to do. In some cases it might be useful to assign all cores to a VM or even running multiple VM having each one the full amount of CPUs assigned. In such cases a VM can make full use of the whole processing power of the host. If more CPUs are assigned to VMs than actually physicall present then the VMs will be impacted by load on different VM. To prevent this you might dedicate some cores to specific VMs. For example running 2 VMs with 2 CPUs assigned each on a 4 core node could help that each VM gets 2 dedicated CPUs (assuming there is no load imposed by host OS which takes a part of the processing-power too).
Does it have negative impact on my host to assign all cores to a VM?
Again this depends on the software run. If you run a VM which is idle (no CPU-intensive programs run at all) the load imposed by this VM will be near to 0%. You can even run 10 VMs in parallel and still experiencing a host CPU load of close to 0% if all VMs are idle.
How does the CPU behave on uneven load?
Well, CPU load distribution heavily depends on an OS-specific built-in component called the scheduler. For Windows XP the scheduler tried to round-robin load all CPU cores. So running a single-threaded task with full load on a quad-core CPU would have yielded ~25% load on each core.
Unfortunately this has proven to be bad for modern CPU power management. For modern systems it's even an advantage if one single core is loaded up to 100% before the second core even gets involved. The reason is that as long as there is not sufficient load to fully use up one core the other cores can remain in deep-sleep mode to save energy and reduce heat dissipation.
For some CPUs like Intel Core i-Series and newer AMD (Bulldozer) this is even more interesting since in case only a subset of the cores are used the unused ones are switched off. This reduces the power consumption of the CPU. Both (Intel and AMD) start to use the thermal and power consumption budget then to overclock the cores which are active. So this can give single-threaded applications (which cannot be distributed to multiple cores to work on a task in parallel) a boost. However when all cores are active then most of these "boost" technologies do have only a small effect on processing power since the "all cores active" situation is exactly the situation the CPU was designed for. But when you switch off some cores then the remaining cores can run overclocked without causing the chip to run more hot (or consuming more power) than in case all cores are active.
So the answer is that your core i7 very well handles uneven load on single cores and might even provide a performance boost to single-threaded applications. However this boost is within the range of a few percent while actually multi-threaded applications which can distribute the load across multiple CPU cores can be boosted by factors (x2 on dual-core, 4x on quad-core...) in optimal case. So multi-threading is always providing more power in terms of combined CPU power than single-threading combined with clock boosting.