This is the mail archive of the
mailing list for the Cygwin project.
Efficient posix_spawn implementation for Cygwin
- From: dancol at dancol dot org
- To: cygwin at cygwin dot com
- Date: Tue, 3 Jan 2012 14:25:28 -0800
- Subject: Efficient posix_spawn implementation for Cygwin
posix_spawn  is an optional POSIX facility that allows programs to
start other programs without using fork or vfork. I've created an
efficient implementation of posix_spawn for Cygwin. The code is available
This library uses Cygwin's nonstandard spawn* family calls in process.h to
provide the full suite of posix_spawn* functionality. Implementing
posix_spawn in terms of spawn turns out to be non-trivial. Nevertheless,
using posix_spawn can improve process startup performance considerably,
especially for large programs:
+ env ITER=1000 JUNKBYTES=209715200 ./testspawn true
+ env ITER=1000 JUNKBYTES=209715200 ./testfork true
(JUNKBYTES here tells both programs to malloc 200MB of private data before
doing anything else; this allocation simulates the working set of a large
Hopefully, it will be more feasible to add posix_spawn support to other
projects than to add Cygwin-specific cases for direct calls to spawn.
posix_spawn is natively supported on OS X, and gnulib provides an
implementation in terms of fork or vfork for all other common platforms.
One example: Emacs is an example of a large program that routinely runs
subprocesses. In my case, fork latency was so great that I had to disable
Emacs' support for version control integration: I didn't want to wait for
two seconds after opening a new file while Emacs queried the . I'm working
on adding support to posix_spawn to Emacs ; when it works, I'll be able
to use the built-in version control integration under Cygwin just like I
do on other Unix systems.
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple