Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

There are lots of reasons to want to spawn fresh processes, which aren't solved by linking a library.
 help



Sure, but not many times a second

Every build system ever says hello.

Why not?

Because it comes with a lot of overhead and, unless for some reason you really need every of those processes to have their own address space, set of privileges, file descriptors, etc., there's no point in wasting resources repeatedly setting those up only to tear them down milliseconds later. Running the same workloads in an nginx-style process pool usually works better.

I see what you mean now. I agree, a sustained workload of creating many processes very quickly is probably not a great idea. But it's also useful to be able to spawn that process pool (and any number of other use cases like that) efficiently.

Spawning processes should not be on the hot path of any program.

Why? That's a very useful processing primitive.

It’s a hack with many disadvantages. Sometimes a hack is the right answer, but the kernel should it add a primitive for it.

Should bash link in every program the user might want? Load them up as dynamic libraries?

Bash as an interactive tool is very different. It is used to run an almost arbitrary number of things, and a pretty low rate.

Bash as a programming language is just a bad idea.


Node, Python, PowerShell, and the rest do (almost) just that. launchd and systemd famously strived to remove as much shell from the start up process as possible because it was harming boot times and introducing unpredictability.

I don't know Node or PowerShell very well, but I'm not sure what you mean by this with respect to Python.

CPython doesn't usually create subprocesses unless specifically asked to, it loads Python modules and native extensions into its process. The former is similar (you're still extending an existing process with new code, just interpreted), the latter is literally dlopen(), so loading dynamic libraries.

A lot of other Python implementations don't have the ability to spin up new processes at all too.


I still don't really get this point. It's just two different things, spawning processes and running libraries. Seems like you're comparing apples and oranges to me.

Aren't we discussing just such a primitive?

oh, sorry, typo

s/it/not/


It ends up on the hot path of programs that use process isolation aggressively

Sure, and there a primary thing you want is a whole new environment/context for the child (new environment, fds, memory, cgroups, namespaces, etc).



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: