spawn new process and block parent
() was originally used to create new
processes without fully copying the address space of the old process, which is
horrendously inefficient in a paged environment. It was useful when the
purpose of fork(2)
would have been to create a new system context for an
efficient, even in the above case, the need for
() has diminished.
() differs from
in that the
parent is suspended until the child makes a call to
or an exit
(either by a call to
abnormally). In addition, fork handlers established using
are not called when a multithreaded program calls
() returns 0 in the child's context and
(later) the PID of the child in the parent's context.
Same as for fork(2)
() function call appeared in
with the additional semantics that the child
process ran in the memory of the parent until it called
That sharing of memory was removed in 4.4BSD
just the semantics of blocking the parent until the child calls
On many other systems the original behavior has been restored, making this
interface particularly unportable.
To avoid a possible deadlock situation, processes that are children in the
middle of a
() are never sent
signals; rather, output or
allowed and input attempts result in an end-of-file indication.