why does Virtualbox use 15-20% CPU when VM is paused?

10

3

I run VirtualBox 3.1 on Ubuntu with a Win XP guest. I have noticed to my surprise that when I pause the VM (its screen grays out) VirtualBox continues using 15-20% of the host's CPU.

Is this normal behavior?

Is there a way to avoid it? (Without saving the state of the VM and exiting VirtualBox.)

Thanks for any insights!

~lara

laramichaels

Posted 2010-04-16T10:46:48.080

Reputation: 679

Answers

8

In order to lessen VirtualBox CPU usage at all times, resort to this weird hack.

Create a new virtual machine and do not install an operating system to it. Tell VirtualBox it will run DOS and give it the absolute minimum resources. Do not install an O/S. Run it, let it error out on boot and minimize it.

While running your real O/S in a second VM, you will see your idle Virtualbox CPU utilization drop to 3-5%.

Idea from jed4czar: http://ubuntuforums.org/showthread.php?s=58e862a814e65eb96f8fe8389b615366&t=838073&page=2

EDIT: To answer your questions directly

why does Virtualbox use 15-20% CPU when VM is paused?

It is a bug. It is always using 15-20% more CPU than it needs to, when any one VM is up, unless the hack provided is used.

Is there a way to avoid it?

See hack above.

kmarsh

Posted 2010-04-16T10:46:48.080

Reputation: 4 632

ooooh it fixed it for me too! Awesome, thanks. For info, I'm running windows 8.1, VM is centos and was consumming at idle time around 15% cpu. VBox v4.3.12 – Sebas – 2015-03-08T23:22:56.307

Amazing this is still an issue. – kmarsh – 2015-03-09T14:17:25.310

nice to know, that vbox allocates possibliy used cpu-sources on startup – Diskilla – 2010-04-16T12:06:10.367

4

I tried the hack described above with the DOS VM, but with no success (running Ubuntu 12.04 guests on a MacBook Pro with OS X). I also tried the kernel parameter changes mentioned in the Oracle thread, again no change. No matter what I did, my guests seemed to eat 15-20% CPU each. However, I noticed that the one guest I happened to assign 2 CPUs was not chewing 15-20% - it was behaving as expected.

Sure enough, when I switched the others to 2 CPU's the issue disappeared. From previous experience, I know that switching to 2 CPUs also enables the IO APIC option in the motherboard section so I suspected that was the truly interesting change. That is, this one:

IOAPIC Enabled

Note that you have to have the machine shut down to change this setting, otherwise it is greyed out. Once I had enabled this on the guests and restart, it didn't matter if I had 1 or more CPUs, the 15-20% CPU utilization went away, so I thought I would share my solution here.

Adam C

Posted 2010-04-16T10:46:48.080

Reputation: 2 475

1

I had the same issue on a Windows 7 Quad box running Oracle 5 in the VM.

Following Adam's advice i checked the Enabled IO APIC option but to no avail. So, i followed kmarsh's idea, which took probably less than a minute to try, and processor usage went down from 15-20% to 4-5%.

The settings used were, Name: Memory Hack, Type: Other, Version: DOS. Memory Size: 4MB, Hard Drive: Do not add a virtual hard drive. Click [Create]. Starting the VM asks for a start-up disk, i used: Host Drive 'D:', click [Start]. Virtual machine states: "FATAL: Could not read from the boot medium! System halted." At that point, the cpu usage dropped, so i minimized the window. Starting a second VM makes no difference.

please delete me

Posted 2010-04-16T10:46:48.080

Reputation: 133

It appears this issue is so complex that no one tweak will fix it. – kmarsh – 2014-10-27T15:39:10.533

0

I experienced this VirtualBox issue on a 2-cpu P4 machine with 3gigs ram running CentOS 5.5 host.

I did not experience this issue on an i720 8cpu machine with 8 gigs running 64-bit Win7. I ran 3 VMWare virtual machines plus the VirtualBox, all with 2-gigs memory, and had no CPU issues whatsoever.

This suggests either running on a "smallish" machine or on a Linux host is the problem.

Your solution worked well, thanks.

I note that these earlier posts are a year old, and my VirtualBox is the most recent Version 4.0.4, so Oracle has not fixed this bug yet.

Wayne Linton

Posted 2010-04-16T10:46:48.080

Reputation: 1

2I would expect that this performance penalty is associated with the face that newer CPUs have VT-x and similar to allow hardware assisted virtualisation which would mean that the VirtualBox program is not doing the work and therefore lower CPU usage. A P4 would likely not have the VT-x technology and so would have to translate system calls via software and use more CPU as a result. – Mokubai – 2011-03-24T22:38:59.917

This must have been fixed by now. using Ubuntu host and XP guest running VirtualBox v4.3.6 when I pause the guest, CPU usage drops bellow 1% – Seeker – 2014-02-21T14:19:55.783