Page 1 of 2

Physical CPUs VS virtual CPUs

Posted: 9. Aug 2010, 12:06
by danielebean
Hi.

Chapter 3 of the documentation (http://www.virtualbox.org/manual/ch03.h ... -processor) reads:

"You should not, however, configure virtual machines to use more CPU cores than you have available physically."

I am not sure about a thing, however.

For sure that means none of the guests should be allocated more than the physical number of CPUs.

But, this is my question, does that also mean the sum of virtual CPUs allocated to *ALL* the guests must be less than the number of physical CPU's on the host?

To give you an example, if I have a host with 4 CPU cores, will this configuration of virtual machines cause problems:
_ 1 guest with 2 virtual CPUs +
_ 1 guest with 2 virtual CPUs +
_ 1 guest with 1 virtual CPU +
_ 1 guest with 1 virtual CPU +
_ 1 guest with 1 virtual CPU
???

My understanding was VirtualBox would adjust the CPU usage on the guests in order to keep the host responsive.

Thanks for reading,
Daniele

Re: Physical CPUs VS virtual CPUs

Posted: 9. Aug 2010, 13:12
by uli100
Hi Daniele,

I'm using VB on systems with 1 or 2 cpu cores and am running 4 vms on both of them without any problem. So it can be done. Maybe you have to tweak the numbers of processors you assign to the guests a little bit. I'm not using more than one processor per vm at the moment.

So: I my opinion, it is worth to give it a try.

Best regards, Uli

Re: Physical CPUs VS virtual CPUs

Posted: 9. Aug 2010, 13:44
by danielebean
Hi Uli100.

Thanks for your reply.

But what if all of your 4 VMs would have a huge peak in the CPU load at the same time. That is probably unlike to happen but that would probably freeze the whole box, requiring an hardware reboot.

What do you think?

Cheers,
Daniele

Re: Physical CPUs VS virtual CPUs

Posted: 9. Aug 2010, 13:55
by danielebean
I was thinking, is it possible to reserve only half CPU to a guest?

Probably not explicitly, but is there any way to obtain a similar effect?

Re: Physical CPUs VS virtual CPUs

Posted: 9. Aug 2010, 14:00
by vbox4me2
Lockdown all cpu's to all VM's minus 1 cpu, that way no one can hug all cpu's.

Re: Physical CPUs VS virtual CPUs

Posted: 9. Aug 2010, 21:40
by Sasquatch
And don't rely on Device Manage for the CPU core count. Intel CPUs have hyperthreading capabilities, doubling the amount of cores you see. Those hyperthreaded cores are virtual CPU's, not real ones. So if you have a quad core CPU with HT, you will see 8 cores in Device Manager. This doesn't mean you can run 7 VMs, it means you are still limited to 3 for a smooth system. Running more VMs or assigning more cores than you physically have, or as many as you have can and probably will give a huge performance hit. See the technical details of hyperthreading on Wikipedia or the Intel documentation site for more details on how it works.

Re: Physical CPUs VS virtual CPUs

Posted: 13. Aug 2010, 12:21
by nalmir
I think you're wrong! Every core behaves as a single CPU for using in VM.

Re: Physical CPUs VS virtual CPUs

Posted: 13. Aug 2010, 20:09
by Sasquatch
Where do I state the opposite? All I explain is that you don't have to trust Device Manager to see how many cores you have because of a certain CPU feature. HyperThreading is just two pipes going to the same core. Only one pipe is used and when it's clogged, it's faster to use the other pipe until the clogged one is free again. You can't use both pipes at the same time. These pipes are shown in Device Manager as separate cores, but they aren't. Instead, they're treated as virtual cores in a way.

Just for the record, I wasn't talking about the Guest, I was talking about the Host. The guest doesn't see the HT feature, so the core(s) it sees is as real as it is. Just keep it in mind when setting cores to or starting VMs that you don't exceed your physical core count. Things will slow down otherwise.

Re: Physical CPUs VS virtual CPUs

Posted: 16. Aug 2010, 15:39
by nalmir
Why do you write about HyperThreading. It's an old technology. Since 2006 we have real multicore CPUs. I don't think that somebody still works with those Pentium 4 with HT.

Re: Physical CPUs VS virtual CPUs

Posted: 16. Aug 2010, 17:31
by smartysmart34
Sorry, but all current Core I7 9xx CPUs have Hyperthreading capabilities. This is a pretty current technology and is not quite comparable to the HT the old P4 used to have.

And guess what: My i7-960 (which has 4 physical cores) reports 8 cores to the Host-OS.

Re: Physical CPUs VS virtual CPUs

Posted: 16. Aug 2010, 19:08
by nalmir
Hm..! I didn't know they returned that technology.

Re: Physical CPUs VS virtual CPUs

Posted: 16. Aug 2010, 20:55
by Sasquatch
That's why I brought it up ;). One could be easily fooled by that, thinking he has 8 cores, starts 7 VMs and complains it runs slow. Only when using 4 or less (depending on the Host use itself) will make it smooth again.

Re: Physical CPUs VS virtual CPUs

Posted: 17. Aug 2010, 13:44
by nalmir
ok, ok.. ??????? ?????? ?????? :)

Re: Physical CPUs VS virtual CPUs

Posted: 22. Aug 2010, 13:27
by Sasquatch
We don't understand Russian, please write it in English. Google Translate makes no sense.

Re: Physical CPUs VS virtual CPUs

Posted: 23. Aug 2010, 09:01
by nalmir
That phrase is from The Bible. It means I was wrong