[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


From: Roland McGrath
Subject: posix_spawn
Date: Sat, 16 Jun 2001 05:53:52 -0400 (EDT)

It has been noted that the slowness of fork on the Hurd may be a
substantial factor in uses like large builds.  One way to avoid this
problem is to avoid fork.  In glibc we have <spawn.h> providing posix_spawn
and related functions; most common cases where a program uses fork and exec
directly can be replaced by calls to posix_spawn et al.

I am working on a Hurd-specific implementation of posix_spawn for glibc.
This avoids almost all the hair involved in fork, and should have overhead
closer to that of plain exec without fork.  

glibc already has a generic implementation of these interfaces that just
uses fork and exec.  Since this is already there and working, programs can
be ported to use this interface (when autoconf finds it) without delay.  If
programs like make and bash use this interface, it could have a substantial
impact on observed performance in situations like builds when the optimized
Hurd-specific implementation goes into libc.

So porting programs to use posix_spawn in place of fork+exec is something
that anyone can do, without ever touching the Hurd, to help the Hurd.  Any
program you port should obviously use autoconf checks for spawn.h and
posix_spawn and only try to use them on systems that have them.  You can do
this development entirely on a GNU/Linux system with glibc-2.2.x, which has
the generic posix_spawn implementation.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]