News for hackers. Stuff that matters.
Re:Fork is not my favourite syscall by jrochkind1 on Thursday January 04, 2018 @08:59AM (#16070329)
That's false teleology. Not everything we end up with was intentionally designed to end there. Maybe it did not occur to the designers that you would want to create new processes for anything but parallelism; or that if someone did, they would invent a new mechanism for that, instead of deciding it was convenient to re-use and extend the fork mechanism.
Re:Fork is not my favourite syscall by chrisseaton on Thursday January 04, 2018 @09:20AM (#16070449)
> Maybe it did not occur to the designers that you would want to create new processes for anything but parallelism

Parallelism? In the original unix? You're talking absolute nonsense. These were single socket, single core systems. How on earth do you think it was designed for parallelism?

But we don't even need to debate this - read the 1971 manual.

https://www.bell-labs.com/usr/dmr/www/pdfs/man21.pdf

"fork is the only way new processes are created"

exec is also in there, and refers to fork and describes how to use them to run programs.

Re:Fork is not my favourite syscall by dgsb on Thursday January 04, 2018 @09:31AM (#16070524)
Parallelism is probably not the correct word, but multi-tasking on I/O seems to have appear early, don't you think ?
Re:Fork is not my favourite syscall by chrisseaton on Thursday January 04, 2018 @09:32AM (#16070531)
Yes multi-tasking, or concurrency, but not parallelism!
Re:Fork is not my favourite syscall by jrochkind1 on Thursday January 04, 2018 @09:54AM (#16070678)
The OP's argument that fork doesn't make a lot of sense for what it gets used for seems persuasive, I'm definitely curious how it ended up that way. This was relatively early days for multi-tasking (ie "time-sharing") at all, maybe the only explanation is that it was early days and it wasn't clear how it was going to end up being used and 'fork' was convenient to implement. Or that's how the previous time-sharing OSs did it, for equally mysterious reasons, and it was copied? I dunno.

The suggestion that it was done this way because the expected main use case was a fork without an exec at least provides a rational explanation (I don't think 'threads' as distinct from processes existed yet in unix? a fork without an exec was the closest thing you had), but I have no idea if it's historically accurate. Would be interesting to find people who were around and get some background.

Ah, this is interesting:

> Then came Unix, in the early 1970s. The Unix notion of a “process” became a sequential thread of control plus a virtual address space (incidentally, the Unix notion of a process derived directly from the Multics process design [Saltzer, 66]). So “processes”, in the Unix sense, are quite heavyweight machines. Since they cannot share memory (each has its own address space), they interact through pipes, signals, etc). Shared memory (also a rather ponderous mechanism) was added much later.

> After some time, Unix users started to miss the old processes that could share memory. This led to the “invention” of threads: old-style processes that shared the address space of a single Unix process. They also were called “lightweight”, by way of contrast with “heavyweight” Unix processes. This distinction dates back to the very late 1970s or early 1980s, i.e. to the first “microkernels” (Thoth (precursor of the V-kernel and QNX), Amoeba, Chorus, the RIG-Accent-Mach family, etc).

http://www.serpentine.com/blog/threads-faq/the-history-of-th...

Not totally sure what light that sheds on the question, if any, heh.