VirtualBox eats excessive CPU, up to 100% usage

If your VirtualBox guest operating system is eating excessive CPU on the host, perhaps causing your laptop fan to spin up and excessive heat to be generated, you may try this list of ways this can possibly be fixed.

  • If you have not installed the “guest additions” driver package provided by VirtualBox, do so, since it provides virtual display, virtual disk, and other drivers that are optimized for usage under a virtual machine.
  • Deprioritize the VirtualBox process. This may make the host OS scheduler treat the VirtualBox process differently and clear the problem. Under a Unix host, use nice; under Windows, use Task Manager or Process Explorer to set a lower priority for the process.
  • If you are using a Linux guest, try to disable the tickless kernel on the guest by either compiling the guest kernel with HZ=100 or by issuing nohz=off on the guest kernel command line.
  • Also try setting the CPU affinity of the VirtualBox host process to one CPU only to avoid scheduler thrashing. For example, on a Linux host this can be done using taskset.
  • If you are using a Windows guest, and IO-APIC is enabled, use the HAL updater (HALu) utility to change to a non-IO-APIC HAL, and/or a non-ACPI HAL. (Also disable IO-APIC and ACPI in the VirtualBox configuration.)
  • Try disabling the VirtualBox clipboard sharing feature.
  • Try disabling VirtualBox USB emulation support. (Currently this only applies with the non-opensource version distributed by Sun.)
  • Try running another VirtualBox process with a dummy virtual machine side by side with the real process. This seems like a very strange solution, but as explained in the bug tracker, there is a load balancing logic built into VirtualBox that sometimes has trouble with a particular erratically behaving VM.
  • Try increasing graphics memory of the VM guest up to 32MB, so that the guest OS does not spend time swapping pixmaps and textures around.
  • If you are using a program inside the VM such as Google Earth, Delphi 2007, Picasa 2007, SQL Server 2008, or SQL Server 2005 SP3, the reason for the high CPU usage is that the process is using the Real Time Clock (RTC) timer at a very high frequency. This will occur with any process that uses the Windows MMTIMER rather than the standard system timer or the TSC cycle counter. There is an open VirtualBox bug regarding this behavior that can be followed until a solution is found.

Reference:

18 Responses to “VirtualBox eats excessive CPU, up to 100% usage”

  1. Peter says:

    Hi,

    This is really the best summary of (all?) the problems that can cause this issue. I’ve been reading up on this a lot since I have this issue and I wish I had found this page first.

    I think I have narrowed down my issue to being the last one, the RTC timer problem. When running perfmon I get ~7000 interrupts/sec when doing nothing, and up to 60000 interrupts/sec when moving the mouse quickly. I have not had any success in find the culprit though. And I’ve killed *a lot* of processes.

    Do you know of a way to identify the process sending the interrupts?

    Thanks.

  2. Peter says:

    I forgot to mention that I am running Ubuntu 9.04 as host and Windows XP as guest in VirtualBox 2.1.4_OSE.

  3. nemesis says:

    Have you tried using msconfig to disable all startup processes and services and to re-enable them one by one?

  4. Peter says:

    I haven’t had time to try that yet, but it’s first on the list.

    Thanks for the suggestion!

  5. Peter says:

    I disabled everything that didn’t seem to be necessary (I left almost all Microsoft entries, though), but I still have the same problem.

    I am running the guest WinXP from an existing partition to be able to boot into it directly if I want to, and it was installed by the Windows support. Maybe I should ask them for the installation CD and reinstall it as virtualized only. then I would have some control over which programs are installed.

  6. nemesis says:

    Have you tried running a dummy instance side by side with the real WinXP?

  7. axeman says:

    I got the same problem after migration from i386 (on AMD64) to x86_64 Linux on host. One of VirtualBox threads became utilizing almost 100% of CPU. I tried versions of VirtualBox 2.2.4 and 3.0.x with different guests (WinXP, several i386 Linux) – no difference. Problem solves by disabling sound system in VirtualBox.

    P.S. Currently host working under Arch Linux x86_64.

  8. nemo34 says:

    Same here: host=Ubuntu 9.04, Virtualbox 3.0.4, Guest=Windows XP SP3 already installed and virtuallized through a .VDMK drive.

    Tried many things. My problem could be linked to my proc: It’s a dual core and I could never get VT-x to be recognized by VB, so i’m declaring a single proc to untick the VT-x use.

    I do not recommend messing around with HALU: I was then unable to reboot…

  9. nowhere says:

    My problem is with high speed USB. I need it since I am only using windows for iTunes and my iPhone but when it is transferring, the CPU is pegged and it gets HOT. It also hangs my 9.04amd64 host hard sometimes. I have both of the ACPI setting enabled, but HALU didn’t work for me either (the instructions on how to do this in the right order etc are not clear at all) and it is a major pain (thanks Apple) to reinstall Win/iTunes.

    Do you think the ACPI is worth pursuing? The CPU is moderately utilized when the VM is idle and only gets real hot when USB transfers are taking place.

  10. nemesis says:

    The CPU usage may be high because of the virtualization involved. But you should be able to prevent it from getting too hot by settings your ACPI thermal zone trip points lower. The “passive” trip point is the one you are interested in. That is the one that will trip if the fan is already running but the CPU is still way too hot, and it will throttle the CPU down to prevent any further heat rise until it cools off.

  11. nowhere says:

    Is this setting in the bios or in the host operating system? I’m not sure where in Ubuntu to look so I will poke around in the bios right now.

  12. nemesis says:

    Sometimes it is in the BIOS, listed as ACPI Temperature Limit or something similar. Otherwise, you can set it on a Linux host through variables in /sys/devices/virtual/thermal/*. There is more information on doing that around the web.

  13. nowhere says:

    Poked around a bit. In the bios, I changed the AC power, freq scaling to balances from performance and it helped a bit. Knocked about 5 – 10 degrees off the avg temp for a USB transfer.

    I also found the trip point files in Ubuntu but Im not sure yet if these are read from the bios, overridden by the bios, or if I can actually make changes and have them take effect. In anycase, passive is set for 96C. Seems a bit high…

  14. nemesis says:

    Looks like the trip point override feature was disabled a while back.

    http://lwn.net/Articles/244595/

    Too bad, it was handy on a previous laptop I had to deal with.

  15. This is a good list of the problems that may affect VirtualBox performance.
    I’m affected by the last one, because I need to use SQLServer 2005 SP3.

    Where can I found the VirtualBox bug report / solution for the Real Time Clock (RTC) timer?

  16. nemesis says:

    Try running another “dummy” virtualbox instance side by side as described in the article. According to the bug tracker, this is the only solution that has helped so far:

    http://www.virtualbox.org/ticket/3613

  17. In my case reasons were different:
    1. Video memory was set to low. Default for new VirtualBox machine for Windows 2008r2 for example is less than 32 MB although that is the minimum you should use. I am currently using 64 MB
    2. Network Adapters make different problems (done for each adapter):
    a) Disabled IPv6 for all adapters
    b) added local main IP to %WINDIR%\System32\drivers\etc\hosts
    c) Disabled Link-Layer topologies
    (in my case not needed, but depending on server role might be needed)
    d) Clicking “configure” button in Power management tab disable
    “Allow the computer to turn off this device to save power.

  18. Tomislav says:

    This is old blog but here is fix for Delphi 2007.
    Just install this component in Delphi 2007, dummy component reset timer to defaul, you can check with Sysinternals Clockres.exe:

    // hkResetTime.pas
    unit hkResetTime;

    interface

    uses
    SysUtils, Classes, MMSystem, ExtCtrls;

    type
    TResetClockTime = class(TComponent)
    private
    t: TTimer;
    { Private declarations }
    procedure Tick(Sender: TObject);
    protected
    { Protected declarations }
    public
    { Public declarations }
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    published
    { Published declarations }
    end;

    procedure Register;

    var hkReset: TResetClockTime;

    implementation

    procedure Register;
    begin
    RegisterComponents(‘Samples’, [TResetClockTime]);
    end;

    { TResetClockTime }

    constructor TResetClockTime.Create(AOwner: TComponent);
    begin
    inherited;
    t := TTimer.Create(nil);
    t.Interval := 20000;
    t.Enabled := True;
    t.OnTimer :=Tick;
    end;

    destructor TResetClockTime.Destroy;
    begin
    t.Enabled := False;
    t.Free;
    inherited;
    end;

    procedure TResetClockTime.Tick(Sender: TObject);
    begin
    timeEndPeriod(1);
    t.Enabled := False;
    end;

    initialization

    hkReset := TResetClockTime.Create(nil);

    finalization

    hkReset.Free;

    end.

Leave a Reply