Jobserver Implementation

submited by
Style Pass
2024-11-26 19:00:05

This paper describes the GNU make “jobserver” implementation: it is meant mainly for people who want to understand the GNU make jobserver, but also for those interesting in a traditionally hairy problem in UNIX programming: how to wait for two different types of events (signals and file descriptors) at the same time.

GNU make, as I assume you know if you’re reading this, is the GNU implementation of the venerable make program which controls and directs the rebuilding of programs from source in the most efficient way possible. GNU make has a capability not found in too many other implementations of make: it can invoke multiple commands, or “jobs”, in parallel. When GNU make can determine that two commands are completely independent of each other (and when the user has requested it), GNU make will invoke them both at the same time. There are basically three types of parallelism available in GNU make: none (each job is executed serially so that the previous job must complete before the next begins), infinite (GNU make invokes as many jobs as are possible, given the prerequisite information in the makefile), and “at most N”, where GNU make will invoke between 1 and N jobs, but never more than N.

It’s this last type of parallelism that is the most common, for users who use parallelism at all, and it is that type at which the jobserver feature is directed.

Leave a Comment