Comment by shadowofneptune
4 years ago
Dennis Richie addresses this in a history of early Unix: https://www.bell-labs.com/usr/dmr/www/hist.html
"Process control in its modern form was designed and implemented within a couple of days. It is astonishing how easily it fitted into the existing system; at the same time it is easy to see how some of the slightly unusual features of the design are present precisely because they represented small, easily-coded changes to what existed. A good example is the separation of the fork and exec functions. The most common model for the creation of new processes involves specifying a program for the process to execute; in Unix, a forked process continues to run the same program as its parent until it performs an explicit exec. The separation of the functions is certainly not unique to Unix, and in fact it was present in the Berkeley time-sharing system [2], which was well-known to Thompson. Still, it seems reasonable to suppose that it exists in Unix mainly because of the ease with which fork could be implemented without changing much else."
OK, but why has it not be replaced with something better in the intervening 50 years? There have been a lot of improvements to unix since 1970. Why not this?
It was; ~20 years ago we got posix_spawn(3).
It was! vfork() was added to BSD because fork() sucks.
But then someone very opinionated wrote "vfork() Considered Dangerous" and too many people accepted that incorrect conclusion.
I mean, I've personally had to fix cves from vfork(2) being a such footgun; so I wouldn't consider it a "incorrect conclusion".
1 reply →