Physical CPUs VS virtual CPUs

This is for discussing general topics about how to use VirtualBox.
danielebean
Posts: 5
Joined: 28. Jul 2010, 17:39
Primary OS: Linux other
VBox Version: OSE Fedora
Guest OSses: CentOS

Physical CPUs VS virtual CPUs

Post 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
uli100
Posts: 59
Joined: 29. Oct 2009, 18:34
Primary OS: Ubuntu other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Various Linux Distros
Location: Stuttgart, Germany

Re: Physical CPUs VS virtual CPUs

Post 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
danielebean
Posts: 5
Joined: 28. Jul 2010, 17:39
Primary OS: Linux other
VBox Version: OSE Fedora
Guest OSses: CentOS

Re: Physical CPUs VS virtual CPUs

Post 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
danielebean
Posts: 5
Joined: 28. Jul 2010, 17:39
Primary OS: Linux other
VBox Version: OSE Fedora
Guest OSses: CentOS

Re: Physical CPUs VS virtual CPUs

Post 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?
vbox4me2
Volunteer
Posts: 5218
Joined: 21. Nov 2008, 20:27
Location: Rotterdam
Contact:

Re: Physical CPUs VS virtual CPUs

Post by vbox4me2 »

Lockdown all cpu's to all VM's minus 1 cpu, that way no one can hug all cpu's.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Physical CPUs VS virtual CPUs

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
nalmir
Posts: 15
Joined: 3. Aug 2010, 16:27
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: win 2003 server 32bit and 64 bit

Re: Physical CPUs VS virtual CPUs

Post by nalmir »

I think you're wrong! Every core behaves as a single CPU for using in VM.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Physical CPUs VS virtual CPUs

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
nalmir
Posts: 15
Joined: 3. Aug 2010, 16:27
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: win 2003 server 32bit and 64 bit

Re: Physical CPUs VS virtual CPUs

Post 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.
smartysmart34
Posts: 101
Joined: 21. Apr 2008, 20:56

Re: Physical CPUs VS virtual CPUs

Post 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.
nalmir
Posts: 15
Joined: 3. Aug 2010, 16:27
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: win 2003 server 32bit and 64 bit

Re: Physical CPUs VS virtual CPUs

Post by nalmir »

Hm..! I didn't know they returned that technology.
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Physical CPUs VS virtual CPUs

Post 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.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
nalmir
Posts: 15
Joined: 3. Aug 2010, 16:27
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: win 2003 server 32bit and 64 bit

Re: Physical CPUs VS virtual CPUs

Post by nalmir »

ok, ok.. ??????? ?????? ?????? :)
Sasquatch
Volunteer
Posts: 17798
Joined: 17. Mar 2008, 13:41
Primary OS: Debian other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows XP, Windows 7, Linux
Location: /dev/random

Re: Physical CPUs VS virtual CPUs

Post by Sasquatch »

We don't understand Russian, please write it in English. Google Translate makes no sense.
Read the Forum Posting Guide before opening a topic.
VirtualBox FAQ: Check this before asking questions.
Online User Manual: A must read if you want to know what we're talking about.
Howto: Install Linux Guest Additions
Howto: Use Shared Folders on Linux Guest
See the Tutorials and FAQ section at the top of the Forum for more guides.
Try searching the forums first with Google and add the site filter for this forum.
E.g. install guest additions site:forums.virtualbox.org

Retired from this Forum since OSSO introduction.
nalmir
Posts: 15
Joined: 3. Aug 2010, 16:27
Primary OS: MS Windows Vista
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: win 2003 server 32bit and 64 bit

Re: Physical CPUs VS virtual CPUs

Post by nalmir »

That phrase is from The Bible. It means I was wrong
Post Reply