Mike Gilbert <flop...@gentoo.org> wrote:

> > Well, bosh has been tested to work as /bin/sh on Gentoo.
> > BTW: On Solaris, bosh is faster than dash (because Solaris has a fully 
> > working
> > vfork()). On Linux bosh is "only" of the same speed as dash since vfork() on
> > Linux does not borrow the parents address space description but copies it.
>
> Is that also true of clone(CLONE_VM|CLONE_VFORK)? Recent versions of
> glibc use this to implement the posix_spawn() function.

I guess... from reading the man page.

There is a simple test to verify my clain for vfork():

bosh may easily be configured for various behavior. If you like a bosh that
does not use vfork() just call:

        cd sh
        smake clean
        smake COPTX=-DNO_VFORK

If you run tests like:

        CONFIG_SHELL=$shell $shell ./configure

in the directory "autoconf" from the schilytools:

http://sourceforge.net/projects/schilytools/files/

(first run "rm *cache"), there is a significant performance win on Solaris
for the version that uses vfork() - 20% less kernel CPU time.

On Linux, there is a too little win for the same comparison.

On Solaris, a vfork() call (check with truss -c) is takes only 1/3 of the time 
of a fork(), on Linux the win is only 30%. The total performance win for bosh
executing configure using vfork() on Solaris is 10-15%, on Linux the total win 
is only 3%.

Note that Linux copied the Solaris concept to implement a normal fork() with 
copy on write mmaps to the parent. So the only difference between fork() and 
vfork() is the handling of the address space description for the processes 
in the kernel.

I would be happy, if there could be a way to get the same vfork() performance 
win 
on Linux as seen on Solaris.

BTW: I forgot to mention that the unit tests for bosh are used this way:

-       first compile schilytools by running smake from top level.

-       Then chdir to "sh" and call "smake tests", see the global code
        in $SRCROOT/tests and the specific code in sh/tests

Jörg

-- 
 EMail:jo...@schily.net                    (home) Jörg Schilling D-13353 Berlin
    joerg.schill...@fokus.fraunhofer.de (work) Blog: http://schily.blogspot.com/
 URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'

Reply via email to