Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Dec 2000 03:30:27 -0500 (EST)
From:      Mike Nowlin <mike@argos.org>
To:        Alessandro de Manzano <demanzano@iol.it>
Cc:        Alfred Perlstein <bright@wintelcom.net>, stable@FreeBSD.ORG
Subject:   Re: make -j
Message-ID:  <Pine.LNX.4.21.0012200317540.32584-100000@jason.argos.org>
In-Reply-To: <20001219122433.A1961@libero.sunshine.ale>

next in thread | previous in thread | raw e-mail | index | archive | help

> Could someone, please, explain to me why the "-j" stuff could be dangerous ?
> It's not much clear to me why doing more then one "cc" (example) at time could break the final object code.
> (no flame, it's a very honest question! :-) )

As far as I understand it:

-jX causes Make to queue up X-1 jobs at a time, while preparing job X
while it's waiting for ((X-1)..0) to finish.  

Imagine a makefile that does something like:

  1) start off with "junk.h" that only has "#define SOMEVAL 1" in it
  2) job 1 of the makefile runs a perl script that rewrites junk.h
  3) job 2 of the makefile is a C prog that includes junk.h and
     uses SOMEVAL

...now run "make -j3"
Assuming that job 2 takes a while to run, and job 3 is really fast, the
output of job 2 will be invalid, since job 1 hasn't completed yet,
although the output of job 2 is >technically< valid (proper object code
was created, although with the wrong "stuff".)

Now apply that idea to a bunch of normal .c files.  If they're
well-behaved and simply compile source into object, life is good.  But if
they do anything like rewriting other chunks of code, life is not so good.

Probably 95% of the packages you'll ever compile aren't prone to this sort
of problem, but anything that has a lot of "real" dependencies in it (like
the kernel) can fail horribly under these conditions.  A lot of programs
are coming out these days that pull these sort of tricks to make them
compile under multiple different operating systems, and not all of them do
it very gracefully.....


mike




To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-stable" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.LNX.4.21.0012200317540.32584-100000>