For your convenience, this table summarizes the fork rules we have encoded in this chapter:
Rule | The rule of fork |
1 | After a successful fork, execution in both the parent and child process continues at the instruction following the fork |
2 | To determine whether you are running in the parent or child process, use the fork return value: it's always 0 in the child, and the PID of the child in the parent |
3 | After a successful fork, both the parent and child process execute code in parallel |
4 | Data is copied across the fork, not shared |
5 | After the fork, the order of execution between the parent and child process is indeterminate |
6 | Open files are (loosely) shared across the fork |
7 | The parent process must ... |