rom1v 3 hours ago
> ABSTRACT
> The received wisdom suggests that Unix’s unusual combination of fork() and exec() for process creation was an inspired design. In this paper, we argue that fork was a clever hack for machines and programs of the 1970s that has long outlived its usefulness and is now a liability. We catalog the ways in which fork is a terrible abstraction for the modern programmer to use, describe how it compromises OS implementations, and propose alternatives.
> As the designers and implementers of operating systems, we should acknowledge that fork’s continued existence as a first-class OS primitive holds back systems research, and deprecate it. As educators, we should teach fork as a historical artifact, and not the first process creation mechanism students encounter.
mrkeen 3 hours ago
It's weird to leave out a mention of copy-on-write - the optimisation that means that you don't copy over all the memory.
codedokode 11 minutes ago
My idea is that we could make a new syscall, for example "spawn", that creates a new empty process, loads some lightweight "loader" into it, and passes arbitrary configuration data. The loader configures the process and exec()'s the main program. This allows to avoid forking the memory and keep existing APIs, but still requires to fork file descriptors and other things.
sanderjd 3 hours ago
asveikau 17 minutes ago
If you contrast that with win32, where you optionally pack a bunch of initial values into a struct, it is a much more narrow, less pleasant, less freeform interface, where it is harder to introduce more features.
But I think there is already posix_spawn to imitate that philosophy on Unix-like OSs.
uecker 3 hours ago
ajkjk an hour ago
I am curious about what the best way to handle the example in the article of one process spawning many git subprocesses is. Surely it just doesn't make sense to repeatedly start git from scratch in the course of a long-running parent operation. What's the low cost abstraction for the same result, though?
jcalvinowens 2 hours ago
Yes, it's copy on write... but there is a linear relationship between the size of the process and the number of page table entries required to represent it.
ComputerGuru 3 hours ago
ggm 42 minutes ago
I do use threaded code. It's significantly harder to write and reason about. (45 years in to a CS career, ageing out)
You have to be clever to do better than clever people. Clever people bootstrapped me into fork()/exec() and I know my limits.
ktpsns 3 hours ago
a-dub 35 minutes ago
Panzerschrek 2 hours ago
debatem1 3 hours ago
mike_hock 2 hours ago
I.e. a year that starts with 20, not 19.
Sophira 3 hours ago
lokar 3 hours ago
3 hours ago
Comment deletedhparadiz 3 hours ago
I mean maybe this has been optimized for already and I don't know what I'm talking about but maybe someone with more knowledge about the kernel knows? Is this something we simply can't optimize for because of security implications?
burnt-resistor 3 hours ago
Every couple of years, someone claims they have "the solution" implying everyone else who came before them didn't know what they were doing.