V8/usr/man/man2/fork.2
.TH FORK 2
.SH NAME
fork \- spawn new process
.SH SYNOPSIS
.B fork()
.SH DESCRIPTION
.I Fork
is the only way new processes are created.
The new process's core image is a copy of
that of the caller of
.IR fork .
The only distinction is
that the value returned in the old (parent) process
is 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.
The process ID is used by
.IR wait (2).
.PP
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.
.SH "SEE ALSO"
wait(2), exec(2)
.SH 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.
Only the super-user can take the last process-table slot.