Faster Compiling With Multicore Machines (using Ubuntu)


(Carl Nuessle) #1

You often can speed up the build (compile) process considerably by using multiple CPU cores on your machine. Use the -j flag to specify how many parallel jobs you want bmake to spawn. A good rule of thumb is to use 1x or 2x the number of physical CPU cores. Specifically (assuming a 4-8 core system):

(1) When building the kernel dependencies and building the complete kernel: see the Assignment 0 (ASST0) webpage, section 3.4, steps 1 and 2. Type “bmake depend -j8” and “bmake -j8”, respectively. (doing this for bmake clean or install has minimal benefit)

(2) When building system usercode: see section 3.8. Type “bmake -j8”. **Note that bmake depend is not a valid option for this configuration file.

Note: This optimization works well for toolchains that are installed directly on Ubuntu (that is, if you used the ops-class PPA to install it directly). Benefit is notably less for the vagrant VM setup (regardless of configuration settings). YMMV.