Making a dynamically-linked root

Matthew Dillon dillon at
Mon Jun 2 14:25:45 PDT 2003

:Gordon Tetlow <gordont at> writes:
:> On Mon, Jun 02, 2003 at 10:21:16PM +0200, Dag-Erling Smorgrav wrote:
:> > Was /bin/sh dynamically linked?  It shouldn't be.
:> Why shouldn't it be dynamically linked? I'd like to be able to use
:> ~username expansion via nss_ldap.
:Because forking a dynamically linked binary is slower, and /bin/sh
:forks a lot.
:Dag-Erling Smorgrav - des at

    I think you meant 'EXECing' a dynamically linked binary is slower.
    fork() should not be appreciably slower.  An exec will take a lot 
    of copy-on-write faults vs static, fork() might take one or two
    extra faults due to data being strewn all over the place vs static.

    In anycase, this is a convenience vs performance issue.  I think a number
    of solutions should be investigated before people give up and start 
    hacking dynamic vs static binaries.  For example, a lot of startup delay
    is due to disk waiting (since nothing is in the disk cache at system
    start!).  Running certain daemon startups in the background might yield
    a significant overall improvement in startup times.  

    e.g. instead of running 'sshd' you would run sshd in a subshell, aka
    (sshd &), so the RC script can continue on with the next thing without
    having to wait for sshd to fault-in from disk.  Same goes for sendmail
    and many other daemons.


More information about the freebsd-arch mailing list