| Fork (computing) |
Article Index for Fork |
Website Links For Fork |
Information AboutFork (computing) |
|
: ''For other uses, see Fork (disambiguation) .'' A fork, when applied to Computing is when a Process creates a copy of itself, which then acts as a " Child " of the original process, now called the " Parent ". More generally, a fork in a Multithreading environment means that a Thread of execution is duplicated. Under Unix and Unix-like Operating Systems , the parent and the child operations are selected by examining the return value of the fork() System Call . In the child process, the return value of fork() is 0, whereas the return value in the parent process is the PID of the newly created child process. As soon as fork is called, there will be a separate address space created for the child. The child process will have an exact copy of all the segments of the parent process. Both the parent and child process may execute independent of each other. EXAMPLE Here is some sample C Programming Language code to illustrate the idea of forking. The code that is in the "Child process" and "Parent process" sections are executed simultaneously.
This code will print out the following:
The order of each output is determined by the kernel. SEE ALSO |
|
|