How do I enable multiple cores in my virtual enviroment?
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)
-
enable I/O APIC in the Motherboard settings tab
-
enable hardware virtualization (VT-x/AMD-V) in the Acceleration tab
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 :
- Stop virtual machine or exit.
- Launch VMWare --> Select machine -->Click System --> Click Processor --> Change number processors.
- 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.
Related videos on Youtube
Admin
Updated on September 18, 2022Comments
-
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:
Now when I run the
lscpu
in Ubuntu I get the following info revealing that only 1 core is being utilized: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:
How do I enable multiple cores (processors) in my virtual enviroment?
-
Admin over 9 yearsso this is not possible on a 32 bit Ubuntu?
-
Takkat over 9 years@cipricus thanks for the notice, 64-bit is only required for a 64-bit guest, of course.
-
smwikipedia about 9 years@Takkat I am using 32 bit Ubuntu as guest OS. How can I enable multiple cpus?
-
Tomáš Zato - Reinstate Monica over 8 yearsThough it would be really cool if we could swap processors at runtime. That would give CPU throttling a new dimension.
-
bbigras over 8 yearsVirtualbox supports CPU hot-plugging