In Gentoo Linux it is possible to set the MAKEOPTS
variable in /etc/portage/make.conf
to tell make
how many jobs it should run in parallel when building packages. Since I have a dual-core CPU, I naively chose to use the -j2
option: one job per core, so both have something to do. The "problem" is there are a lot of references that tell users having a dual-core CPU to set the -j3
option instead. Some of them are:
- Gentoo handbook
- Gentoo wiki
- make.conf(5) man page
For example, the Gentoo handbook says:
A good choice is the number of CPUs (or CPU cores) in your system plus one, but this guideline isn't always perfect.
But what is the rationale for "CPUs + 1" rule? Why the extra job?
The make.conf(5) man page even says:
Suggested settings are between CPUs+1 and 2*CPUs+1.
I also read section 5.4 (Parallel Execution) in the make
info page and make
man page explanation for the -j
option, but it seems there's no answers there.