Fork–exec

This replacement is, however, a choice of the architecture one builds the given program on, and is therefore not an obligatory step in the child process' life.

One can also asynchronously wait on their children to finish, by using a signal handler for SIGCHLD, if they need to ensure everything is cleaned up.

Although all data are replaced, the file descriptors that were open in the parent are closed only if the program has explicitly marked them close-on-exec.

This allows for the common practice of the parent creating a pipe prior to calling fork() and using it to communicate with the executed program.

The spawn() family of functions declared in process.h can replace it in cases where the call to fork() is followed directly by exec().