[ale] compiled system calls versus shell scripts

Bjorn Dittmer-Roche dittmeb at mail.rockefeller.edu
Thu Oct 23 13:50:11 EDT 2003


On Thu, 23 Oct 2003, Geoffrey wrote:

> Jeff Hubbs wrote:
>
> > I think the speedup comes from the fact that if everything is done
> > serially, you can't sneak in some computing amongst disk i/o waits, for
> > instance.  The objective seems to be to let the kernel and its MM to
> > make the best of the barrage.
>
> Okay, call it ignorance.  How is the parallel make process any different
> then say:
>
> foo & bar
>
> At the shell level 'foo & bar' run parallel.
>

Normal init scripts start a process, wait for it to be done starting, and
then start the next process. The shell equivilant is this:

service1.start ; service2.start ; ...

make, in it's most basic form, does exactly this, it just figures out the
order for you automatically and, optionally, checks for errors. A simple
makefile might have a shell equivilant of something like this:

service1.start && service2.start && ...

make with the -j option paralelizes things. This would appear to have a
shell equivilant of this:

service1.start &  service2.start & ...

except that make can be used to help you figure out much more complex
things that cannot easilly be expressed in shell. Here's psuedocode of one
possible implementation:

tree T #derived from makefile. each target is a node. leaves have no
       #dependencies and branches are dependent on their respective
       #children. Note that this "tree", may in fact be more complex than a
       #tree

while T.hasElements
	foreach n in T.leaves
		if !n.isStarted
			n.start &

        p = wait( T.leaves ) #wait for one of the started nodes to finnish
        T.remove( p )        #after this, one of the branch nodes may
                             #become a leaf.


The advantage of make is simply that it's easy and efficient to define
dependencies.

	bjorn



More information about the Ale mailing list