This is base on the following rule: use only physical cores and if you have only physical cores, leave one core for the OS/UI.
nb_cores()
The recommended number of cores to use.