From: Derek Fawcus <dfawcus+lists-tuhs@employees.org>
To: tuhs@tuhs.org
Subject: Re: [TUHS] "Fork considered harmful"
Date: Fri, 12 Apr 2019 01:12:10 +0100 [thread overview]
Message-ID: <20190412001210.GA31597@bugle.employees.org> (raw)
In-Reply-To: <7A06D817-72BD-47CB-BEE5-25755B4C3ABF@eschatologist.net>
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@gmail.com> wrote:
> > Any view on this? https://www.microsoft.com/en-us/research/publication/a-fork-in-the-road/
> 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
next prev parent reply other threads:[~2019-04-12 0:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-10 23:06 Richard Salz
2019-04-10 23:24 ` Bakul Shah
2019-04-10 23:37 ` George Michaelson
2019-04-11 11:38 ` Tony Finch
2019-04-11 23:37 ` Chris Hanson
2019-04-12 0:12 ` Derek Fawcus [this message]
2019-04-12 16:11 ` Jim Capp
2019-04-12 14:51 Noel Chiappa
2019-04-12 15:33 ` Warner Losh
2019-04-12 19:55 ` Dan Cross
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190412001210.GA31597@bugle.employees.org \
--to=dfawcus+lists-tuhs@employees.org \
--cc=tuhs@tuhs.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).