The book, Linux Kernel in a Nutshell, discusses the use of the -j option when compiling the kernel to specify the number of threads to use during the compile. It recommends using -jX where X, the number of threads, is set to twice the number of CPUs available. If -j is not specified, the default is for a single thread to be used. I have found that the recommendation of 2x the number of CPUs is too high. My own experiments show that X should be, at most, equal to the number of CPUs.
The following table shows the results of these tests which were run on an Intel single Quad Core at 2.5GHz with 6GB of RAM and no swapping taking place. The kernel being compiled was 22.214.171.124. The time command was used to determine the amount of real, user and system time spent during each compile.
|Command||make||make -j2||make -j4||make -j6||make -j8|
Note that any number larger than the number of CPUs results in a longer compile time, although only slightly. There is clearly no advantage to specifying more threads than the total number of CPUs. However there is a significant advantage to specifying the -j option to be equal to the number of CPUs.