FORK(2) — UNIX Programmer’s Manual
NAME
fork − spawn new process
SYNOPSIS
fork()
DESCRIPTION
Fork is the only way a new process is created. With fork, the new process’s core image is a copy of that of the caller of fork. The only distinction is the fact that the value returned in the old (parent) process contains the process ID of the new (child) process, while the value returned in the child is 0. Process ID’s range from 1 to 30,000. This process ID can be used when doing a wait(2).
Files open before the fork are shared, and have a common read-write pointer. In particular, this is the way that standard input and output files are passed and also how pipes are set up.
SEE ALSO
DIAGNOSTICS
Returns −1 and fails to create a process if: there is inadequate swap space, the user is not super-user and has too many processes, or the system’s process table is full.
7th Edition