Parallel compilation and the final link

A developer measures a clean build of a C program. Compiling sensor.c, filter.c, stats.c, and format.c takes exactly 9 s, 7 s, 5 s, and 3 s, respectively. The four compilations are independent. Linking their object files takes exactly 2 s and starts immediately after all four compilations finish.


Four independent source compilation jobs feed a link job that requires all four object files.


Compare two identical build machines, one allowing two compilation jobs at once and the other allowing three. Both use this scheduling rule: at time zero, start as many jobs as possible from the queue sensor.c, filter.c, stats.c, format.c; whenever a slot becomes free, immediately start the next waiting job. Each job occupies one slot until it finishes.


Assume that the stated durations remain unchanged when jobs overlap, and ignore other overhead. Determine:

  • Total build time with two compilation slots, in seconds to the nearest whole second.
  • Total build time with three compilation slots, in seconds to the nearest whole second.
  • Percentage reduction in total build time when moving from two slots to three, relative to the two-slot build, to one decimal place.
Your answers

Create a free account to get started

Unlock full course notes by signing up

  • Video lessons taught by top educators
  • Practice questions with guided solutions
  • Written review notes for reference
  • Expert answers anytime from course tutors

More Compiling and the Build Process Questions: