Using all cores to 100% on host

Discussions related to using VirtualBox on Windows hosts.
Post Reply
geohei
Posts: 2
Joined: 13. Apr 2020, 18:15

Using all cores to 100% on host

Post by geohei »

Hi.

I'm presently working on a test project with VirtualBox.

Host: Windows 10 on i9900 CPU
Guest : Ubuntu 18.04 server
VB: 6.0.14

I compiled some code using the POSIX multithread libraries (pthread.h).
When using 16 threads, I get around 62% CPU load on the host side.

For testing, I recompiled using 8 and 32 threads.
More or less the same result.
The host CPU load varies between 55% and 63%.

Is that normal?
Last edited by geohei on 13. Apr 2020, 19:02, edited 1 time in total.
Martin
Volunteer
Posts: 2562
Joined: 30. May 2007, 18:05
Primary OS: Fedora other
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: XP, Win7, Win10, Linux, OS/2

Re: Using all cores to 100% on host

Post by Martin »

You have a CPU with 8 cores.
The hosts needs a free core for itself to run a VM efficiently.
So in most cases you would see best guest performance with less than 8 virtual CPUs in the guest on this system.
Threds don't count for virualization in almost all cases.
scottgus1
Site Moderator
Posts: 20945
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: VirtualBox+Oracle ExtPack
Guest OSses: Windows, Linux

Re: Using all cores to 100% on host

Post by scottgus1 »

also, the more cores you put in a guest the slower it will run, due to extra scheduling commands needed on the host to put the guest commands through the CPU cores. A modern OS is happy with two cores, and more will make it sluggish unless there are other multi-threaded programs running in it that need more cores.
geohei
Posts: 2
Joined: 13. Apr 2020, 18:15

Re: Using all cores to 100% on host

Post by geohei »

Thanks a lot for the answers.
Martin wrote:You have a CPU with 8 cores.
The hosts needs a free core for itself to run a VM efficiently.
So in most cases you would see best guest performance with less than 8 virtual CPUs in the guest on this system.
Threds don't count for virualization in almost all cases.
For testing purpose, I reduced from 8 to 7 cores.
Performance dropped from 63% to 51%.
scottgus1 wrote:also, the more cores you put in a guest the slower it will run, due to extra scheduling commands needed on the host to put the guest commands through the CPU cores. A modern OS is happy with two cores, and more will make it sluggish unless there are other multi-threaded programs running in it that need more cores.
That's what I noticed as well (2 cores are best), but only for single-thread binaries. Mine is however multi-thread and uses all cores.
Post Reply