I had to compile the code in Ubuntu installed in my Virtualbox. I considered that it was a virtual machine, but the compilation performance seemed to be way too slow. When I checked how many CPU cores were found in Ubuntu, only one was set.
(Only one CPU will be recognized unless you set it up.)
# cat /proc/cpuinfo
Only one CPU is detected as above.
Let’s recognize more CPUs in a virtual machine.
Virtualbox multicore configuration
1. Select the virtual machine you want to configure, then [Machine]> [Settings].
2. You can select the number of processors by selecting “System”> “Processor” tab in the setting menu.
In my case, the computer running the virtualbox is a system with eight logical processors, so I could set up to eight. However, if the number exceeds 4, the error message will be displayed as below.
[If you move to the red section on the slide bar, an error is displayed.]
The number of processors that can not cause an error can be set to four, half of the total eight.
If the number of CPUs reaches the half of 4, the “Invalid settings detected” error message will be generated.
Select the four possible settings without error and press OK.
You can see that four CPU cores are recognized when cat /proc/cpuinfo is displayed as shown below.