Is fork() older than C? What are its origins? I might think that fork() was created along with C (1970s) but I recently read a reference to a 1963 paper where fork() was mentioned.
- 121,835
- 17
- 505
- 462
- 1,111
- 8
- 22
2 Answers
The fork() system call is definitely older than the C language because it already existed in the UNIX v0 draft, page 18 of the PDF, when the C language hasn't been conceived yet.
The mechanism was different from what we're used to:
Except while UNIX is bootstrapping itself into operation, a new process can come into existence in only one way: by use of the
forksystem call.processid = fork(label)When fork is executed by a process, it splits into two independently executing processes. The two processes have core images which are copies of each other, but they are not precisely equivalent: one of them is considered the parent process. In the parent, control does not return directly from the
fork, but instead passes to locationlabel; in the child process, there is a normal return. Theprocessidreturned by theforkcall is the identification of the other, offspring process.
-
3That looks like an editorial mistake, mixing parent and child – the parent would need the child's processid, not the child, right? – Paŭlo Ebermann Apr 21 '18 at 11:38
-
@PaŭloEbermann You're most likely right, as the last sentence indicates that the most recent phrase should be about the parent process. – Leo B. Apr 21 '18 at 17:12
-
1I don't have any documentation on Multics but could this have been taken from Multics - after all both the Unix (formerly Unics) inventors were previously Multics programmers. – cup May 01 '18 at 21:51
-
@cup In a conversation the other day I was told that the concept of forking a process did exist in Multics, but the evolution of the calling convention is of interest as well. – Leo B. May 02 '18 at 00:22
An article on the history of fork appeared in the IEEE Annals of the History of Computing 2016 vol. 38.
This article states that fork was invented by Melvin Conway in 1962 when considering the allocation of tasks to processors in multi-processor systems.
-
The original Conway paper can be found on page 164 of http://www.textfiles.com/bitsavers/pdf/afips/1963-11_%2324.pdf – dmw Nov 10 '18 at 19:53
-
@dmw Unfortunately, your link gives a 404; any chance you can find an active one? Please? – Richard T Aug 08 '22 at 04:14
-
1@RichardT Here you go https://www.docdroid.net/oEodAHw/1963-11-24-pdf#page=146 – dmw Aug 09 '22 at 11:02
-
@dmw I'm VERY appreciative for you providing that link. As it was published less than two weeks before my birth AND as I have spent over 44 years in computing (and am still very active), this is a VERY interesting read! I've downloaded the whole thing and while I really don't have time to read ALL of it, I'd never have found it without your link! THANKS! – Richard T Aug 10 '22 at 02:44
-
1@RichardT the lesson is clear.. never delete a PDF you've downloaded once ;) Best wishes, and glad you liked it – dmw Aug 10 '22 at 16:57
fork(), it's also worth exploring BSD'svfork(). – fadden Apr 20 '18 at 15:35