Using Python on a fork-less POSIX-like OS
stephanh42 at gmail.com.invalid
Tue Jul 31 08:14:40 EDT 2018
Op 2018-07-29, Terry Reedy schreef <tjreedy at udel.edu>:
> multiprocessing module uses 'spawn' rather than 'fork' on Windows and it
> has an option to use 'spawn' even on *nix. I presume the latter refers
> to posix_spawn. You might want to check the multiprocessing code to see
> what *it* is doing 'under the covers'.
Actually, the only place posix_spawn is currently used in Python is in
some experimental and currently-disabled code in the posix module.
`spawn' in multiprocessing only refers to a fork/exec combination
(on Posix, at least), as opposed to `fork' which only does a fork.
Note that posix_spawn cannot provide full subprocess functionality
(obviously preexec_fn, but also not start_new_session).
So it's a hard sell to add a posix_spawn special case there, since
a generic fork/exec would need to be maintained anyway.
(The same reason is also why most shells such as bash, zsh, don't bother
More information about the Python-list