The fork() call: POSIX Processes and Parent-Child Relationships

To find out if an operating system might support the POSIX®.1 specification, simply ask, “Does it support the fork() call?”

Fork() calls are scattered throughout UNIX®/Linux® code.

fork00aTo support fork(), an operating system must first support the concept of parent-child relationships between processes.

If fork() and other common POSIX.1 calls are not supported, the vast majority of your UNIX/Linux code will not port to that operating system without major rewrites.

Understanding fork()

The fork() system call creates a new process called a child. The original process is called the parent, and the child is a near-exact copy of the parent. The child’s run time is set to zero and file locks are not inherited.

The child has its own process ID and its own copy of the parent’s file descriptors.

A parent process can recover the exit status of a child using the wait() or waitpid() function.