Multi-Threaded make

David G. Miller dave at davenjudy.org
Thu Nov 29 22:48:14 UTC 2012


Gabriel VLASIU <gabriel <at> vlasiu.net> writes:

> 
> 
> On Thu, 29 Nov 2012, JD wrote:
> 
> > That does not make sense.
> 
> > I have a unicore!! An old Athlon64 3700+,
> In this case %{?_smp_mflags} is expanded to "-j1" or "" and you will have 
> exactly only one "cc1".
> 
<SNIP>
> > and yet ps -ef shows up to 4 makes running at a time.
> Read the previous mail again.
> 
> Gabriel
> 
Make is much more constrained by disk I/O than by CPU load.  Setting -j to be
equal to the number of cores/CPUs is just playing it safe.  This is especially
true when building a rpm which involves not just compiles and link but also
packaging, dependency resolution and documentation tasks which are even more
disk I/O intensive than compiles.  Chances are that several of these operations
that not dependent on successfully compiling the code are fired off in parallel
rather than doing them sequentially and that old workhorse make gets the task of
managing each of these tasks.  Thus, you end up with multiple copies of make
running at the same time even on a single core/CPU system to perform these tasks.

Now just to totally blow your mind...  while working with the 2.5.X development
kernels prior to the release of 2.6.0 I was doing at least one kernel build for
each new point release (sometimes more if there were build issues to resolve). 
At that time my primary desktop was a dual CPU (back in the day before multiple
cores) Athlon rig.  Since I had all sorts of time and plenty of trials to
experiment with I played around with the setting of -j for kernel builds.  My
best results were with -j 12.

Cheers,
Dave





More information about the users mailing list