On Thu, Apr 11, 2019 at 04:37:52PM -0700, Chris Hanson wrote:
On Apr 10, 2019, at 4:06 PM, Richard Salz
<rich.salz(a)gmail.com> wrote:
Quite
correct in my experience.
The posix_spawn() API isn’t a panacea but (especially with a few *_np extensions) it’s
much saner for large real-world applications that run a ton of subprocesses. I work on a
large IDE which invokes compilers and such, and it makes a huge difference.
What I ended up doing for children of GUI apps (on OSX) is to fork very early on
before the GUI starts, or the process becomes multi-thread. Then that child does
all of the real spawning, using fd passing and messages over a pipe (actually a
unix domain socket) to drive it, so usually no need for _np stuff.
There for cases where posix_spawn() is viable, as I recall it was faster than fork+exec.
DF