Gentoo Archives: gentoo-user

From: Joerg Schilling <Joerg.Schilling@××××××××××××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] Per package /bin/sh selection
Date: Thu, 09 Apr 2020 10:40:34
Message-Id: 5e8efb92.LEoV6y0bgMkNCV4Y%Joerg.Schilling@fokus.fraunhofer.de
In Reply to: Re: [gentoo-user] Per package /bin/sh selection by Mike Gilbert
1 Mike Gilbert <floppym@g.o> wrote:
2
3 > > Well, bosh has been tested to work as /bin/sh on Gentoo.
4 > > BTW: On Solaris, bosh is faster than dash (because Solaris has a fully working
5 > > vfork()). On Linux bosh is "only" of the same speed as dash since vfork() on
6 > > Linux does not borrow the parents address space description but copies it.
7 >
8 > Is that also true of clone(CLONE_VM|CLONE_VFORK)? Recent versions of
9 > glibc use this to implement the posix_spawn() function.
10
11 I guess... from reading the man page.
12
13 There is a simple test to verify my clain for vfork():
14
15 bosh may easily be configured for various behavior. If you like a bosh that
16 does not use vfork() just call:
17
18 cd sh
19 smake clean
20 smake COPTX=-DNO_VFORK
21
22 If you run tests like:
23
24 CONFIG_SHELL=$shell $shell ./configure
25
26 in the directory "autoconf" from the schilytools:
27
28 http://sourceforge.net/projects/schilytools/files/
29
30 (first run "rm *cache"), there is a significant performance win on Solaris
31 for the version that uses vfork() - 20% less kernel CPU time.
32
33 On Linux, there is a too little win for the same comparison.
34
35 On Solaris, a vfork() call (check with truss -c) is takes only 1/3 of the time
36 of a fork(), on Linux the win is only 30%. The total performance win for bosh
37 executing configure using vfork() on Solaris is 10-15%, on Linux the total win
38 is only 3%.
39
40 Note that Linux copied the Solaris concept to implement a normal fork() with
41 copy on write mmaps to the parent. So the only difference between fork() and
42 vfork() is the handling of the address space description for the processes
43 in the kernel.
44
45 I would be happy, if there could be a way to get the same vfork() performance win
46 on Linux as seen on Solaris.
47
48 BTW: I forgot to mention that the unit tests for bosh are used this way:
49
50 - first compile schilytools by running smake from top level.
51
52 - Then chdir to "sh" and call "smake tests", see the global code
53 in $SRCROOT/tests and the specific code in sh/tests
54
55 Jörg
56
57 --
58 EMail:joerg@××××××.net (home) Jörg Schilling D-13353 Berlin
59 joerg.schilling@××××××××××××××××.de (work) Blog: http://schily.blogspot.com/
60 URL: http://cdrecord.org/private/ http://sf.net/projects/schilytools/files/'