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

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


Solution 1:

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.

Solution 2:

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.

Solution 3:

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.