Fork (system call)

7 hours ago 1

Merge history part to "Overview". If other contributors have more content, just re-create the "History" part with expansion

← Previous revision Revision as of 04:55, 6 July 2025
Line 10: Line 10:
When a process calls fork, it is deemed the [[parent process]] and the newly created process is its child. After the fork, both processes not only run the same program, but they resume execution as though both had called the system call. They can then inspect the call's [[return value]] to determine their status, child or parent, and act accordingly.
When a process calls fork, it is deemed the [[parent process]] and the newly created process is its child. After the fork, both processes not only run the same program, but they resume execution as though both had called the system call. They can then inspect the call's [[return value]] to determine their status, child or parent, and act accordingly.


The history of fork dates back to the 1960s as one of the earliest references to a fork concept appeared in ''A Multiprocessor System Design'' by [[Melvin Conway]], published in 1962.<ref>{{Cite journal |last=Nyman |first=Linus |date=25 August 2016 |title=Notes on the History of Fork and Join |journal=IEEE Annals of the History of Computing |volume=38 |issue=3 |pages=84–87 |doi=10.1109/MAHC.2016.34}}</ref> Conway's paper motivated the implementation by [[L. Peter Deutsch]] of fork in the [[Project Genie|GENIE time-sharing system]], where the concept was borrowed by [[Ken Thompson]] for its earliest appearance<ref>{{Cite web |date=1970 |title=s3.s from Research UNIX |url=https://github.com/dspinellis/unix-history-repo/blob/Research-PDP7-Snapshot-Development/s3.s#L43-L70 |website=GitHub}}</ref> in [[Research Unix]].<ref>{{cite encyclopedia |title=SYS FORK (II) |encyclopedia=UNIX Programmer's Manual |publisher=[[Bell Labs|Bell Laboratories]] |url=https://www.bell-labs.com/usr/dmr/www/pdfs/man21.pdf |date=3 November 1971 |author=[[Ken Thompson]] and [[Dennis Ritchie]]}}</ref><ref name="Ritchie">{{cite journal |last1=Ritchie |first1=Dennis M. |last2=Thompson |first2=Ken |date=July 1978 |title=The UNIX Time-Sharing System |url=https://www.bell-labs.com/usr/dmr/www/cacm.pdf |journal=Bell System Tech. J. |publisher=AT&T |volume=57 |issue=6 |pages=1905–1929 |doi=10.1002/j.1538-7305.1978.tb02136.x |access-date=22 April 2014 |authorlink1=Dennis Ritchie}}</ref> Fork later became a standard interface in [[POSIX]].<ref name="posix">{{man|sh|fork}}</ref>
== History ==
{{Expand section|date=July 2025}}

One of the earliest references to a fork concept appeared in ''A Multiprocessor System Design'' by [[Melvin Conway]], published in 1962.<ref>{{Cite journal|title=Notes on the History of Fork and Join|last=Nyman|first=Linus|date=25 August 2016|journal=IEEE Annals of the History of Computing|volume=38|issue=3|pages=84–87|doi=10.1109/MAHC.2016.34}}</ref> Conway's paper motivated the implementation by [[L. Peter Deutsch]] of fork in the [[Project Genie|GENIE time-sharing system]], where the concept was borrowed by [[Ken Thompson]] for its earliest appearance<ref>{{Cite web|url=https://github.com/dspinellis/unix-history-repo/blob/Research-PDP7-Snapshot-Development/s3.s#L43-L70|title=s3.s from Research UNIX|date=1970|website=GitHub}}</ref> in [[Research Unix]].<ref>{{cite encyclopedia|title=SYS FORK (II)|encyclopedia=UNIX Programmer's Manual|publisher=[[Bell Labs|Bell Laboratories]]|url=https://www.bell-labs.com/usr/dmr/www/pdfs/man21.pdf|date=3 November 1971|author=[[Ken Thompson]] and [[Dennis Ritchie]]}}</ref><ref name="Ritchie">{{cite journal|last1=Ritchie|first1=Dennis M.|last2=Thompson|first2=Ken|date=July 1978|title=The UNIX Time-Sharing System|url=https://www.bell-labs.com/usr/dmr/www/cacm.pdf|journal=Bell System Tech. J.|publisher=AT&T|volume=57|issue=6|pages=1905–1929|doi=10.1002/j.1538-7305.1978.tb02136.x|access-date=22 April 2014|authorlink1=Dennis Ritchie}}</ref> Fork later became a standard interface in [[POSIX]].<ref name="posix">{{man|sh|fork}}</ref>


==Communication==
==Communication==
Line 47: Line 44:


==Forking in other operating systems==
==Forking in other operating systems==
{{one source|section|date= February 2015}}
{{one source|section|date=February 2015}}
In the original design of the [[OpenVMS|VMS]] operating system (1977), a copy operation with subsequent mutation of the content of a few specific addresses for the new process as in forking was considered risky.{{citation needed|date=October 2013}} Errors in the current process state may be copied to a child process. Here, the metaphor of process spawning is used: each component of the memory layout of the new process is newly constructed from scratch. The [[spawn (computing)|spawn]] metaphor was later adopted in Microsoft operating systems (1993).
In the original design of the [[OpenVMS|VMS]] operating system (1977), a copy operation with subsequent mutation of the content of a few specific addresses for the new process as in forking was considered risky.{{citation needed|date=October 2013}} Errors in the current process state may be copied to a child process. Here, the metaphor of process spawning is used: each component of the memory layout of the new process is newly constructed from scratch. The [[spawn (computing)|spawn]] metaphor was later adopted in Microsoft operating systems (1993).


Open Full Post