Table of Contentsfork, vfork - create a child process #include <unistd.h> pid_t fork(void);
pid_t vfork(void);
fork creates a child process that differs from the parent process only in its PID, and in the fact that resource utilizations are set to 0. Under Linux, fork is implemented using copy-on-write pages, so the only penalty incurred by fork is the time and memory required to duplicate the parent's page tables, and to create a unique task structure for the child.
On success, the PID of the child process is returned in the parent's thread of execution, and a 0 is returned in the child's thread of execution. On failure, a -1 will be returned in the parent's context, no child process will be created, and errno will be set appropriately. - EAGAIN
- fork cannot allocate sufficient memory to copy the parent's page tables and allocate a task structure for the child.
Under Linux, vfork is merely an alias for fork. SVID, AT&T, POSIX, X/OPEN, BSD 4.3 clone(2), execve(2), wait(2)
Table of Contents
www.fiveanddime.net