-
Notifications
You must be signed in to change notification settings - Fork 18.4k
Closed
Milestone
Description
Why: At a basic level posix_spawn(2) is a subset of fork(2). A new child process from fork(2): 1) gets an exact copy of everything that the parent process had in memory, and 2) gets a copy of all the file descriptors that the parent process had open. posix_spawn(2) preserves #2, but not #1. In some cases, say, shelling out a command, it's unnecessary to get a copy of memory of the parent process. With copy-on-write, fork will be less expensive but still, not necessary. What's out there: https://github.com/rtomayko/posix-spawn#benchmarks I am wondering if it makes sense to have this API and let developers decide which one to use (fork/exec vs. posix_spawn)
cespare, neelance, upovod, kuangchanglang, brunocassol and 3 more