Subject: Re: vfork vs. fork (was Re: popen reentrant (was Re: SA/pthread and
To: Greywolf <email@example.com>
From: Frederick Bruckman <firstname.lastname@example.org>
Date: 09/14/2003 17:13:19
On Sun, 14 Sep 2003, Greywolf wrote:
> Thus spake Matthias Buelow ("MB> ") sometime Today...
> MB> Just for the records, I just did some timings fork vs. vfork. I
> MB> [v]fork/execl'd /usr/bin/true (basically /bin/sh with a script) for a
> MB> certain number of iterations and found out that vfork() does indeed
> MB> have a certain effect (I never expected it NOT to be faster, mind
> MB> you): the tradeoff was about 50% on NetBSD 1.6.1/i386. On
> MB> Solaris/sparc (which also seems to implement a faster vfork), it was
> MB> less pronounced -- only about 20%. What do these results show? The
> MB> speedup isn't crucial for most applications (which do not have an
> MB> extremely high fork/exec rate); but in certain situations it might be
> MB> beneficial. Although if you have to wait over an hour for a typical
> MB> job to complete, shaving off a minute or two probably isn't that
> MB> spectacular.
> 50 percent? That's half -- a big win in anyone's book. That means that
> my build of the toolchain is only taking 13 minutes instead of 26.
I hate to cloud a clear-cut ideological issue with facts, but that
isn't what mkb said AT ALL. It's up to 50% if you do nothing but
execute "/bin/true". In a more practical situation, others have stated
that it shaves a few minutes of off a several hours build. That's a