Page 1 of 1

VirtualBox 5.0 - Problem on Hyperthreaded CPU

Posted: 6. Sep 2015, 18:35
by NexusPenguin
Hi,

As I would like to build my own ROM for my smartphone, I have to use Linux.
(I know it's possible to build natively in MacOsX, but I've never been able to set-up my Mac to do that, and never heard of anyone able to build with OsX ! - All guides that can be founded on the internet are false or deprecated :-)

So I decided to go for VB as it's free and offers a lot of possibilities.

But I think I am doing something wrong. Let me explain.

I run VB on a MacPro 4.1 with MacOsX 10.10.5, driven by 2 Xeon 5560 and 40GB of RAM.
The storage HDD is on a raided array of 2 X 600GB Intel DC-S3500 SSD's on a PCI card (up to 850GB/s speed).
It's a 200GB fixed size disk image configured with Virtual Box.
Basic settings are :
- resources allocated to VM : 100%
- RAM allocated to VM : 16GB
- Number of processors used : 16

My problem is following...

The MacPro sprots Xeon processors that supports Hyperthreading. I have 8 physical cores that are splitted to get 16 cores when hyperthreaded.
This is why I decided to allocate 16 processors in VB settings...

The Guest is Debian 8.1 "Pure" (not a Debian based distro).

It launches and is rather reactive.
If I look at the CPU monitor, 16 cores are recognized.

When I launch my build, the 16 cores sometimes (but ONLY SOMETIMES) go up to 16 X 80%... but even then, looking at the Host monitor, only 45-50% of CPU resources are used.

So my conclusion is that VB does not take advantage of Hyperhreading in a Mac...

And that gets obvious when I consider the build times : about 75 minutes in VB. The exact same config in VMWare Fusion is done in 38 minutes...

MY QUESTION :
- 1°) Is VB supposed to support Hyperthreading in MacOs ?
- 2°) If answer to 1°) is YES, how should I set up VB so it uses 100% of CPU resources of the MacOs X Host ?

Thanks for your answers.

Regards.

Re: VirtualBox 5.0 - Problem on Hyperthreaded CPU

Posted: 6. Sep 2015, 19:00
by loukingjr
NexusPenguin wrote: MY QUESTION :
- 1°) Is VB supposed to support Hyperthreading in MacOs ?
- 2°) If answer to 1°) is YES, how should I set up VB so it uses 100% of CPU resources of the MacOs X Host ?

Thanks for your answers.

Regards.
1, Yes.
2. If it was theoretically possible for a guest to use 100% of your Mac's resources, what would OSX use and how would it run VirtualBox itself?

Just set your Debian guest to use 2 cores.

As far as Fusion, it is a commercial program optimized for Macs, as opposed to a cross platform hypervisor. It still doesn't use 100% of a Mac's resources.

Re: VirtualBox 5.0 - Problem on Hyperthreaded CPU

Posted: 6. Sep 2015, 19:28
by Perryg
Also keep in mind that the host monitor probably does not indicate the actual CPU usage. VirtualBox is a simulator and uses direct calls to the CPU that the host may not be able to reflect.
Another thing to remember is that there is an overhead when attaching multiple processors to the guest. Much over 4 can actually slow the guest down.

Re: VirtualBox 5.0 - Problem on Hyperthreaded CPU

Posted: 6. Sep 2015, 19:34
by loukingjr
To add to what Perry said, I also run Fusion 8 on a 4 core i7. When I create a guest, the default number of cores is two in Fusion. If there were any advantage to running all 4 cores the recommended number of cores would be 4 I believe.

p.s. Threads are not cores.

Re: VirtualBox 5.0 - Problem on Hyperthreaded CPU

Posted: 7. Sep 2015, 06:18
by NexusPenguin
Hi,

Thanks for your answers.

Either I did not express myself correctly... or I misunderstand your answers.

So : I would like to stress that if I use the EXACT same guest (Debian 8.1) on the EXACT same hardware, compiling my ROM takes (almost) EXACTLY twice the time in VB compared to Fusion or Parallels Desktop (38 minutes in Fusion/PD vs. 74 minutes in VB).

The hardware monitor installed on the host (my MacPro) reports about 1580% of CPU resources used by Fusion or PD. That includes of course the resources used by the virtualization software itself. So each thread is used to almost it's full extend.
When I run VB, the same hardware monitor reports a CPU usage of about 800%... As the monitor indicates the load thread per thread, each thread is used, but to 50% only.

In the Guest, the hardware monitor indicates that the CPU's available are used to 100% (of course INSIDE the guest, that does not include what is happening in the Host ! I know that...) if the guest is running inside Fusion or PD.
In Virtual Box, the same guest uses about 50% of CPU power available even if it reports 16 threads.

Just to point it out : loukingjr : if I would leave everything to default in Fusion or Parallels or VB, I would not even bother virtualizing anything. Using 2 "threads" (1 core for me) results in a VM that's barely usable because it's so slow.
I tried to set it up to use 2 cores as advised : result is simple. While compiling, in the terminal window I have the time to read each line of the output process. It I set it up to 16 threads (8 cores with hyperthreading - the max) the output lines in terminal just fly over the display...
So if you leave everything to default, no wonder you don't see any difference between VB and Fusion... Just set it to 8 (you have an i7 CPU, that is hyperthreaded : so 4 cores => 8 threads : Fusion should allow to go up to 8 ) and you'll probably know what I'm talking about.

Regards.

Re: VirtualBox 5.0 - Problem on Hyperthreaded CPU

Posted: 7. Sep 2015, 06:24
by loukingjr
I never said there was no difference. I said one difference is because Fusion is optimized for Macs.

Then again, anyone that thinks it's possible to have 1580% of a CPU's resources used… :roll:

Reminds me of commentators that talk about someone giving 110% effort.

Re: VirtualBox 5.0 - Problem on Hyperthreaded CPU

Posted: 7. Sep 2015, 18:32
by NexusPenguin
Hi loukingjr,

Thanks for your post. It explains a lot of things... especially that you're obviously not accustomed to multicore/multithreaded CPU's.

Almost EVERY hardware monitor considers each core/thread as an individual CPU and grants 100% to it.

As I said, my MacPro is a Dual Xeon model.
So it has 2 processors that each has 4 cores.
So that's 2 X 4 cores = 8 cores.
When it's hyperthreaded, each core is divided in 2 threads.
So that's 16 threads total.

As I said, almost EVERY hardware monitor considers each core/threaded as a single "CPU" and grants it 100%.
As I have 16 threads, that 1600%.
So when my computer runs at 1580%, that simply means that almost each of the 16 threads is running @100%.

Of course, when the hardware monitor is cleverly conceived, you have the option to display each thread as a separate CPU (thus having 1600%) or to mix everything up. You'll then have the average load of the separate threads scaled down to 100%.

I decided to display each thread as a separate CPU so I can monitor what the problem with Virtual Box is.
It seems to be indeed an optimization problem because each thread is used (so Virtual Box is multithread compatible) but for some unexplained reason, seems to use only 50% of the available power for each thread.

Anyways, I will stop to discuss this here... it is pointless.

Please get me correctly : I am not complaining.
Virtual Box exists and it is free and it is functional.
I was simply wondering if I set it up in a wrong way to get the most out my computing resources.
It seems I did not...
So the conclusion is : VirtualBox is a really nice software that simply does not fulfill my own needs.
But this is simply personal and you can of course consider it as the best choice of all. This is up to you and I won't argue.

Of course, you can make fun of me when I speak of 1580%...
I will return you the favor pointing to your post : "When I create a guest, the default number of cores is two in Fusion. If there were any advantage to running all 4 cores the recommended number of cores would be 4 I believe."
Well, this CLEARLY indicates that you consider the default settings to be the most suited for your hardware and thus never tried to change them.
This is of course hilarious...
But as I am well mannered, I will just guess that you are not researching the same thing I do, which is the best performance for the GUEST OS.

Regards.

Re: VirtualBox 5.0 - Problem on Hyperthreaded CPU

Posted: 7. Sep 2015, 21:10
by loukingjr
Good grief. Obviously you are not familiar with math. Hypothetically if you have an 8 core 16 thread CPU, and all threads are being used to their absolute maximum, that would be 100% or all of the CPU's resources being used. It matters not what some hardware monitor says it is.

Let's say you have an 8-cylinder car that puts out 240 H.P. Do you think if you measure the output of each cylinder which measure 30 h.p. each, that means your engine is putting out 800% of it's potential? :lol: :lol: :lol:

As far as what I said about the default setting, that is your inference and not what I said. The reason most (all that I know of) hypervisors default to half the number of cores is because it gives the best performance for both the guest and the host.

Re: VirtualBox 5.0 - Problem on Hyperthreaded CPU

Posted: 7. Sep 2015, 23:18
by brycesteiner
I would try Virtualbox 4.3.26 - above that there are ctrl-mouse issues and .

I find it to be the best. I keep trying Virtualbox 5 but there are still too many problems. Games like Medal of Honor don't work anymore and they did before. Acrobat plugins crawl in 5.0.x compared to 4.3.26 in Acrobat 10 on Windows 7. Same virtual machine, same hardware, different virtualbox.

I would assume that there are still underlying issues in 5. I will keep trying new versions as they come out but nothing better than 4.3.26 yet.

Developers made it easy enough to try new versions and very easy to go back if need be by uninstalling from the finder window and updating to the correct guest additions.

Good Luck!