How do I enable multiple cores in my virtual enviroment?

94,942

Solution 1

To enable more than 1 CPU in your VM the following settings are needed in addition:

  • 64-bit virtual guest hardware in General settings tab (for 64-bit guests)

    enter image description here

  • enable I/O APIC in the Motherboard settings tab

    enter image description here

  • enable hardware virtualization (VT-x/AMD-V) in the Acceleration tab

    enter image description here

Note that if your run your VM on all cores available you may experience a better host performance when assigning an execution cap to the CPU.

If you had not enabled hot-plug CPU feature of virtualbox changing of the number of cores can only be done on a machine that was shut down.

A performance boost in the guest is only to be expected for software that makes use of several cores. Only then giving all cores with an execution cap makes sense.

Solution 2

If your VM is currently running (or "Saved") you can't change that value. Power off your VM first.

Solution 3

I was working on a multithreaded program which executed in sequential order on virtual machine. I had similar problem as you had. I fixed it by :

  1. Stop virtual machine or exit.
  2. Launch VMWare --> Select machine -->Click System --> Click Processor --> Change number processors.
  3. Start Virtual Machine.

Earlier std::thread::hardware_concurrency() from standard thread returned 1, but, after changes it returns the number of CPU's on the settings of Virtual Machine.

Now, I was able to run my multithreaded programs on VM successfully.

Share:
94,942

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin over 1 year

    I've installed Ubuntu in a virtual environment using Oracle VM VirtualBox Manager and it works great.

    However I'd like to enable multiple cores - as seen in the image below my Windows machine has 2 cores:

    enter image description here

    Now when I run the lscpu in Ubuntu I get the following info revealing that only 1 core is being utilized:

    enter image description here

    I've tried changing the settings of the virtual box to enable multiple processors but it won't allow me to do so as shown in the image below:

    Image

    How do I enable multiple cores (processors) in my virtual enviroment?

  • Admin
    Admin over 9 years
    so this is not possible on a 32 bit Ubuntu?
  • Takkat
    Takkat over 9 years
    @cipricus thanks for the notice, 64-bit is only required for a 64-bit guest, of course.
  • smwikipedia
    smwikipedia about 9 years
    @Takkat I am using 32 bit Ubuntu as guest OS. How can I enable multiple cpus?
  • Tomáš Zato - Reinstate Monica
    Tomáš Zato - Reinstate Monica over 8 years
    Though it would be really cool if we could swap processors at runtime. That would give CPU throttling a new dimension.
  • bbigras
    bbigras over 8 years
    Virtualbox supports CPU hot-plugging