10

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

1

5 Answers 5

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.

3
  • nice to know, that vbox allocates possibliy used cpu-sources on startup
    – Diskilla
    Apr 16, 2010 at 12:06
  • 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
    Mar 8, 2015 at 23:22
  • Amazing this is still an issue.
    – kmarsh
    Mar 9, 2015 at 14:17
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.

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.

1
  • It appears this issue is so complex that no one tweak will fix it.
    – kmarsh
    Oct 27, 2014 at 15:39
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.

2
  • 2
    I 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
    Mar 24, 2011 at 22:38
  • 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
    Feb 21, 2014 at 14:19
0

The other answers do not explain or fix the bug for me (Debian host, paused Ubuntu guest). Oracle has a section for this:

Some Linux guests may cause a high CPU load even if the guest system appears to be idle. This can be caused by a high timer frequency of the guest kernel. Some Linux distributions, for example Fedora, ship a Linux kernel configured for a timer frequency of 1000Hz. We recommend to recompile the guest kernel and to select a timer frequency of 100Hz.

Linux kernels shipped with Red Hat Enterprise Linux, as well as kernels of related Linux distributions, such as CentOS and Oracle Linux, support a kernel parameter divider=N. Hence, such kernels support a lower timer frequency without recompilation. We suggest you add the kernel parameter divider=10 to select a guest kernel timer frequency of 100Hz.

Source: Linux Guests May Cause a High CPU load

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .