[Solved] Guest using 50% host CPU despite having only 1 core

Discussions related to using VirtualBox on Windows hosts.
Post Reply
BoxBoxBox
Posts: 10
Joined: 12. Dec 2017, 14:32

[Solved] Guest using 50% host CPU despite having only 1 core

Post by BoxBoxBox »

I run a win10 host and win7 guest. The guest is set to have 1/4 cores. Guest uses ~60% of that core(shown from within guest task manager) and yet on host virtualbox process is using 50% cpu which means 2 full cores. How is this possible and what is going on?
Last edited by BoxBoxBox on 12. Dec 2017, 18:31, edited 1 time in total.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Guest using 50% host CPU despite having only 1 core

Post by mpack »

Probably a failure to understand Cores vs Threads. But, if you want more than sheer speculation you need to provide a VM log file. With the VM fully shut down, right click and "Show Log" in the GUI, save "VBox.log" (no other file) to a zip, and attach the zip here.
BoxBoxBox
Posts: 10
Joined: 12. Dec 2017, 14:32

Re: Guest using 50% host CPU despite having only 1 core

Post by BoxBoxBox »

Here you go. My machine has 4 cores and no hyperthreading so I don't see how cpu/thread confusion would apply here.
Last edited by BoxBoxBox on 12. Dec 2017, 18:29, edited 1 time in total.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Guest using 50% host CPU despite having only 1 core

Post by mpack »

BoxBoxBox wrote:I don't see how cpu/thread confusion would apply here.
Like I said, if no log is provided then gross speculation is our only option.

Ok, as to the actual issue. Two cores may be used if both the host and the guest need to do work. Note that VirtualBox (and VBoxSVC) are host processes. The limit on the number of cores applies only to guest processes.

What exactly are the guests doing when this CPU hoggage is happening? If it's I/O bound then IME it is normal for both guest and host to have some CPU bound to their respective ends of this task. Probably there are other examples, e.g. graphics acceleration, especially if its an old low efficiency direct mode GL app.
BoxBoxBox
Posts: 10
Joined: 12. Dec 2017, 14:32

Re: Guest using 50% host CPU despite having only 1 core

Post by BoxBoxBox »

mpack wrote:
BoxBoxBox wrote:I don't see how cpu/thread confusion would apply here.
Like I said, if no log is provided then gross speculation is our only option.
Um, do you not see the attached zip?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Guest using 50% host CPU despite having only 1 core

Post by mpack »

Um, can you not wait for me to finish composing a post?
BoxBoxBox
Posts: 10
Joined: 12. Dec 2017, 14:32

Re: Guest using 50% host CPU despite having only 1 core

Post by BoxBoxBox »

mpack wrote:Um, can you not wait for me to finish composing a post?
You replied as if it wasn't there. It was not meant to be of offense or anything, I just wasn't sure if you could see the attachment. Some forums allow to change visibility of such things and I simply did not know if it was visible, that's all.
mpack wrote:
BoxBoxBox wrote:I don't see how cpu/thread confusion would apply here.
Like I said, if no log is provided then gross speculation is our only option.

Ok, as to the actual issue. Two cores may be used if both the host and the guest need to do work. Note that VirtualBox (and VBoxSVC) are host processes. The limit on the number of cores applies only to guest processes.

What exactly are the guests doing when this CPU hoggage is happening? If it's I/O bound then IME it is normal for both guest and host to have some CPU bound to their respective ends of this task. Probably there are other examples, e.g. graphics acceleration, especially if its an old low efficiency direct mode GL app.
Particular job that causes this is when downloading many torrents from inside guest. Right now guest reports 32% cpu usage of it's single core while host is 50% loaded. If I stop torrenting cpu usage will drop on both to insignificant value. What, if anything, can be done to reduce host cpu usage without sacrificing guest downloading performance?
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: Guest using 50% host CPU despite having only 1 core

Post by mpack »

BoxBoxBox wrote:What, if anything, can be done to reduce host cpu usage without sacrificing guest downloading performance?
Not a lot - that I know of. Like I said, VirtualBox is a host OS process. Processes can't run without consuming CPU.

That said you may find that some VirtualBox configurations consume less CPU than others. If network performance is your problem then I'd look at configuring a virtio-net adapter for the guest.

Obviously Win7 doesn't have native support for VirtIO-net, so you'll need to Google for the guest drivers (from the KVM project I think they are).
BoxBoxBox
Posts: 10
Joined: 12. Dec 2017, 14:32

Re: Guest using 50% host CPU despite having only 1 core

Post by BoxBoxBox »

mpack wrote:
BoxBoxBox wrote:What, if anything, can be done to reduce host cpu usage without sacrificing guest downloading performance?
Not a lot - that I know of. Like I said, VirtualBox is a host OS process. Processes can't run without consuming CPU.

That said you may find that some VirtualBox configurations consume less CPU than others. If network performance is your problem then I'd look at configuring a virtio-net adapter for the guest.

Obviously Win7 doesn't have native support for VirtIO-net, so you'll need to Google for the guest drivers (from the KVM project I think they are).
Installed virtio driver on guest and set it as network adapter for it. Host cpu usage dropped by 20%. This pretty much solves my issue. Huge thanks.
mpack
Site Moderator
Posts: 39134
Joined: 4. Sep 2008, 17:09
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Mostly XP

Re: [Solved] Guest using 50% host CPU despite having only 1 core

Post by mpack »

Well done. I'm glad it worked for you.
socratis
Site Moderator
Posts: 27329
Joined: 22. Oct 2010, 11:03
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Win(*>98), Linux*, OSX>10.5
Location: Greece

Re: Guest using 50% host CPU despite having only 1 core

Post by socratis »

BoxBoxBox wrote:Um, do you not see the attached zip?
Actually, no one can see your ZIP anymore. You edited your messages and apparently deleted the ZIP. This is considered post vandalism and I would appreciate it if you didn't do it in the future. Thank you.
Do NOT send me Personal Messages (PMs) for troubleshooting, they are simply deleted.
Do NOT reply with the "QUOTE" button, please use the "POST REPLY", at the bottom of the form.
If you obfuscate any information requested, I will obfuscate my response. These are virtual UUIDs, not real ones.
Post Reply