|
|
Log in / Subscribe / Register

fork() + exec()

fork() + exec()

Posted Jun 8, 2026 21:23 UTC (Mon) by NYKevin (subscriber, #129325)
In reply to: fork() + exec() by roc
Parent article: Moving beyond fork() + exec()

> If for some reason you need lots of separate subprocesses, use the zygote pattern: fork+exec one zygote process, then every time you need a new subprocess, fork the zygote.
>
> There are edge cases where these don't apply, but adding complex new kernel interfaces that give tiny wins on edge cases does not seem like a good idea.

Most of those edge cases are probably covered by some obscure config option in systemd (which is already designed to execute arbitrary programs in arbitrary environments). But nobody wants to faff with systemd config files, hence everyone ends up reinventing the wheel instead.

I think the real win would be getting systemd to provide a nice clean posix_spawn-flavored programmatic interface so that you don't have to deal with unit files. Or if such an interface already exists, evangelizing it and getting people to use it.


to post comments


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds