Change the number of virtual CPUs in VirtualBox

In VirtualBox they recommend setting the number of vCPUs or processors for virtual machine no more than the physical CPU cores in the host, any more is flagged as an invalid setting.

More virtual CPUs are assigned to the virtual machine than the number of physical CPUs on the host system. This is likely to degrade performance of your virtual machine. Please consider reducing the number of virtual CPUs.

If you only run one VM at any given time, you can set vifrtual processors/CPUs to same as host, use 1:1 ratio, one vCPU per one host CPU core.

If you use VirtualBox on Mac, run the virtual machine software, select the virtual machine from the left panel of the Oracle VM VirtualBox Manager, click Settings, you will get a new windows, switch from General to System tab, then click Processor below the top menu bar to view the current processor number and you can drag the slider to change the number of processor for the virtual machine.

VirtualBox can only use real cores as CPUs for Vitualization purposes. When the number of Processors assigned to the VirtualBox exceed the real cores in the host, VitualBox displays a warning at the bottom of the window, titled Invalid settings detected. This warning reports more virtual CPUs are assigned to the virtual machine than the number of physical CPUs or CPU cors on the host system.