20

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?

17

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.

  • so this is not possible on a 32 bit Ubuntu? – user47206 Oct 9 '14 at 15:44
  • 1
    @cipricus thanks for the notice, 64-bit is only required for a 64-bit guest, of course. – Takkat Oct 9 '14 at 17:48
  • @Takkat I am using 32 bit Ubuntu as guest OS. How can I enable multiple cpus? – smwikipedia May 9 '15 at 9:56
15

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

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.