O'Reilly logo

Advanced Mac OS X Programming: The Big Nerd Ranch Guide by Mark Dalrymple

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

fork

To create a new process in Unix, you must first make a copy of an existing process. That copy can continue to execute the code of the original process, or it can begin executing another program. The fork() system call performs the process copying:

pid_t fork (void);

fork() makes a copy of the running process, and it is one of the few functions that can return twice. In the original process, called the parent process, fork() returns the process ID of the new process. In the new process, called the child process, fork() returns zero. When an error occurs, there is no child process, and fork() returns -1 in the parent and sets errno.

As a copy of the parent process, the child inherits the parent process’ memory, open files, real and effective ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required