Page 1 of 2
How does VB handle Hyperthreading?
Posted: 17. Nov 2010, 20:16
by ToddAndMargo
Hi All,
How does Virtual Box handle multiple hyperthreaded cores?
I have an x5650 processor with 6 real cores that presents itself to my OS as 12 virtual cores (hyperthreading). Hyperthreading can not be turned off in the BIOS.
Does Virtual Box see 6 or 12 cores?
My big concern here is that if I tell Virtual Box to use 4 cores on my x5650, will I get 4 hyperthreaded cores for a total of 2 actual/real cores?
Or if I ask for four cores, will I actually get four actual/real cores?
Many thanks,
-T
Re: How does VB handle Hyperthreading?
Posted: 17. Nov 2010, 21:19
by Sasquatch
VB handles the cores by asking the Host OS for it. The Host then allocates the resources. If you read more about Hyperthreading, you will know what it does and what it means.
Re: How does VB handle Hyperthreading?
Posted: 17. Nov 2010, 22:08
by ToddAndMargo
Sasquatch wrote:VB handles the cores by asking the Host OS for it. The Host then allocates the resources. If you read more about Hyperthreading, you will know what it does and what it means.
And I have no idea what you just said. :'[
Re: How does VB handle Hyperthreading?
Posted: 17. Nov 2010, 22:17
by kebabbert
Then maybe you should not concern about hyper threading?
It seems that VirtualBox asks the hardware about cores. Read the manual?
Re: How does VB handle Hyperthreading?
Posted: 17. Nov 2010, 22:37
by ToddAndMargo
kebabbert wrote:It seems that VirtualBox asks the hardware about cores.
And does VirtualBox get told 6 or 12 cores?
Does VirtualBox even know the difference?
Read the manual?
Not in the manual.
To re-ask my question: if I tell Virtual Box to use 4 cores on my x5650, will I get 4 hyperthreaded cores for a total of 2 actual/real cores? Or if I ask for four cores, will I actually get four actual/real cores?
Re: How does VB handle Hyperthreading?
Posted: 17. Nov 2010, 22:45
by fixedwheel
ToddAndMargo wrote:if I tell Virtual Box to use 4 cores on my x5650, will I get 4 hyperthreaded cores
yes
... for a total of 2 actual/real cores? Or if I ask for four cores, will I actually get four actual/real cores?
no, you can not tell, its handled by the host OS like that: VBox starts another quite ordinary process for each additional virtual CPU you assign
Re: How does VB handle Hyperthreading?
Posted: 17. Nov 2010, 23:21
by Sasquatch
fixedwheel wrote:ToddAndMargo wrote:if I tell Virtual Box to use 4 cores on my x5650, will I get 4 hyperthreaded cores
yes
Actually, no. You don't get hyperthreaded cores. You get separate cores. If you assign 2 cores to VB and it happens to be one physical core split in two due to the hyperthreading, then so be it.
If you would get a hyperthreaded core, you would get on the Guest what you have on the Host. One physical cores with two virtual ones. Not the case with VB.
Of course, if that was the question, then yes is the correct answer

.
Re: How does VB handle Hyperthreading?
Posted: 18. Nov 2010, 22:45
by ToddAndMargo
fixedwheel wrote:ToddAndMargo wrote:if I tell Virtual Box to use 4 cores on my x5650, will I get 4 hyperthreaded cores
yes
... for a total of 2 actual/real cores? Or if I ask for four cores, will I actually get four actual/real cores?
no, you can not tell, its handled by the host OS like that: VBox starts another quite ordinary process for each additional virtual CPU you assign
By any chance, are the guest's core not actually linked to the physical cores on the host? Rather, are they made up (fake) cores like everything else on the guest (video, network, hard drive, PCI controllers, etc.)?
In which case, does a guest core just correspond to a "Program" (or "processes" if you wish) on the host? Also in which case, can you have any number of "fake" cores on the guest as long as the host has the chops to handle it? And are the "fake" cores just single cores emulating a core with only one pipe (not two, like hyperthreading)?
If so, with 6 real cores and 12 hyperthreaded cores on my motherboard (hyperthreading can not be turned off in BIOS), how many cores would you assign to the guest? 4 or 10? (Must be an even number of cores or M$ programs like M$SQL will lay an egg.)
Is there a "best practice" rule to follow when assigning hyperthreaded cores to a guest?
Sorry for being so thick headed here. I will get this eventually.
Many thanks,
-T
Re: How does VB handle Hyperthreading?
Posted: 18. Nov 2010, 22:50
by ToddAndMargo
Sasquatch wrote:fixedwheel wrote:ToddAndMargo wrote:if I tell Virtual Box to use 4 cores on my x5650, will I get 4 hyperthreaded cores
yes
Actually, no. You don't get hyperthreaded cores. You get separate cores. If you assign 2 cores to VB and it happens to be one physical core split in two due to the hyperthreading, then so be it.
If you would get a hyperthreaded core, you would get on the Guest what you have on the Host. One physical cores with two virtual ones. Not the case with VB.
Of course, if that was the question, then yes is the correct answer

.
Sasquatch,
I still have no idea what you are saying. It is embarrassing! Would you please lower the technical level a notch so that a beginner can grasp what you are saying? (Tie half your brain behind your back.)
Is the guest seeing an actual core or just a fake process emulating a core?
Many thanks,
-T
Re: How does VB handle Hyperthreading?
Posted: 18. Nov 2010, 23:13
by Sasquatch
The Guest gets a real core, but the Host decides which it gets. The load gets balanced between all the cores, so it can run on core 1 for two seconds, and then run on core 3 a second later. The load is distributed over the HT pipes too, so you don't always get the first pipe to the core, sometimes you get the second. But I've yet to see a VM getting both pipes to just one core when it's set to have 2 cores. I think that is impossible due to the nature of how HT works, but I've been proven wrong on more than one occasion.
I do have a bad habit of writing things down the way I see them, which makes no sense at all for others. Makes it hard to see what is hard to understand. I hope I made sense to you with this post.
Re: How does VB handle Hyperthreading?
Posted: 19. Nov 2010, 01:32
by ToddAndMargo
Sasquatch wrote:The Guest gets a real core, but the Host decides which it gets. The load gets balanced between all the cores, so it can run on core 1 for two seconds, and then run on core 3 a second later. The load is distributed over the HT pipes too, so you don't always get the first pipe to the core, sometimes you get the second. But I've yet to see a VM getting both pipes to just one core when it's set to have 2 cores. I think that is impossible due to the nature of how HT works, but I've been proven wrong on more than one occasion.
Okay, so the guest is just another program to the host. And, the host OS does the load balancing.
Do you have a rule of thumb as to how many core to assign to a guest? For instance, with an Intel x5650 with 6 real and 12 hyperthreaded cores, how many cores would you assign to the guest?
Many thanks,
-T
I do have a bad habit of writing things down the way I see them, which makes no sense at all for others. Makes it hard to see what is hard to understand. I hope I made sense to you with this post.
No problem. You are doing fine. I am thicker than cement on this question.
Re: How does VB handle Hyperthreading?
Posted: 19. Nov 2010, 05:16
by crash0veride
See My thread on Intel SMT and VBox:
Intel SMT
Re: How does VB handle Hyperthreading?
Posted: 20. Nov 2010, 00:50
by Sasquatch
Basic rule for core assignment is to leave one for the Host so that VMs can never lock up the host. So with a hexacore CPU, it would be 5 cores tops.
Re: How does VB handle Hyperthreading?
Posted: 20. Nov 2010, 02:04
by ToddAndMargo
Sasquatch wrote:Basic rule for core assignment is to leave one for the Host so that VMs can never lock up the host. So with a hexacore CPU, it would be 5 cores tops.
Thank you!
So, just ignore the hyperthread. Also, use an even number of multiple cores, if you are using any M$ software on the guest that freaks out over odd numbers of processors, such as MSQL server
-T
Re: How does VB handle Hyperthreading?
Posted: 20. Nov 2010, 13:22
by Sasquatch
The assignment of cores also counts for the amount of VMs you can safely start without having to worry about a possible compromise of the Host resources. With 5 cores at your disposal, you can start 5 VMs with single core or 2 VMs with 2 cores and 1 with 1 core, etc.