Hacker News new | past | comments | ask | show | jobs | submit login

> if a big one wants to spawn children

Should this be considered poor behavior or design?

It's been quite a while since I wrote explicit fork/ exec code, but wouldn't a better approach be to have a small master process that spawns off the necessary children and then either links them up or mediates communication?

I mean, on a unix-like system, init is ultimately the spawner of everything else and it's not a particularly large process.




Yes on Unix it can be interesting, if needing fork/exec to spawn children, to pre spawn an helper child process that will do just that. But that would just be because the fork/exec model is insane: with a posix_spawn (or CreateProcess) centric approach, you don't have to add that extra layer, and you have very few drawbacks. Also, that will not help you when trying to use libraries that attempt to spawn on their own.

As for init being small, I leave you the responsibility of your words, now that we live in a systemd world :p




Consider applying for YC's Spring batch! Applications are open till Feb 11.

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

Search: