logoalt Hacker News

1718627440today at 3:50 PM3 repliesview on HN

But you generally want to communicate with that process, so you do need to setup e.g. file descriptors and stuff, which needs information from the parent process to be passed.


Replies

yxhuvudtoday at 5:13 PM

Yes, you do want to pass in some stuff. But by default you get every single open file descriptor and a copy of every single stack that any threads use for execution.

It shares way too much, and have huge use cases where it is really, really bad.

jonhohletoday at 3:57 PM

Most programming languages abstract this out to be able to connect or drop the 3 standard pipes. Typically this is the only thing that can be shared anyway unless the other program is specifically shared and expects other file handles to be available, in which case fork might be the right system call anyway.

stefan_today at 5:10 PM

Keep in mind that this is the only way to start any process. Even if you just want to launch some throwaway utility program.