22

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.

  • 2
    When learning about fork(), it's also worth exploring BSD's vfork(). – fadden Apr 20 '18 at 15:35
28

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 fork system 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 location label; in the child process, there is a normal return. The processid returned by the fork call is the identification of the other, offspring process.

  • 2
    That 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
  • I 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 1 '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 2 '18 at 0:22
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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.