Comment by afiori
7 years ago
Also levels of abstraction compose.
> Booting a system doesn't compose;
Actually this is false, virtual machine and hypervisors allow to boot a system inside another system
7 years ago
Also levels of abstraction compose.
> Booting a system doesn't compose;
Actually this is false, virtual machine and hypervisors allow to boot a system inside another system
Virtual machines can be forked processes, and contain operating systems with forked processes, some of which are virtual machiens ... fork composes!
as a function obviously, the point is that it does not compose easily with other abstractions. That is every other library and OS functionality needs to be fork-aware.
spawn do not have this requirement.
The concept of "fork aware" didn't exist until threads. You could argue it's a thread problem. Remember, every library and OS functionality aso needs to be "thread aware" when threads are introduced. The pthread_atfork function can be thought about as "what do we do about thread and thread paraphernalia when we fork" rather than "what do we do about fork when we have threads".
Even the close-on-exec flag race condition is a result of threads. duplicating a file descriptor and setting its close-on-exec flag is a two step process during which a fork can happen, causing a child to inherit the descriptor without close-on-exec flag being yet set. But that can only happen if there are threads. (Or something crazy, like fork being called out of an async signal handler).
2 replies →