Previous: , Up: Compiling With Make   [Contents][Index]


1.3.2 Parallel Builds

GNU Make offers parallel builds through the -j flag, which specifies the maximum number of concurrent jobs. This is supported by both tame and tamed.

tamed starts by spawning a single runner, which is marked as available. When a command is issued to tame, it will reserve the first available runner it finds by marking it as busy. Once the runner is finished, it will be marked as available once again. If all available runners are busy, tame issues a signal to tamed to spawn another runner, which tame then reserves and marks as busy. No runners are ever freed (terminated) until tamed itself terminates.

For example, to build with up to four concurrent runners, use ‘-j4’:

$ make -j4

Figure 1.5: Compiling with four concurrent runners

Compiling and linking large packages can be memory intensive. While runner memory consumption may vary, it’s wise to profile the memory usage of a single runner and use that to estimate how many concurrent runners your system can support.

Saxon is also multi-threaded under certain circumstances, so you should allocate fewer jobs than you have available CPU cores. GNU Make also offers a -l flag that tells it not to spawn more jobs if the system is above the indicated load. But note that, even if a runner is idle, it is still using up memory.