- Hands-On System Programming with Go
- Alex Guerrieri
- 106字
- 2021-06-24 13:42:16
Process life cycle
The creation of a new process can happen in two different ways:
- Using a fork: This duplicates the calling process. The child (new process) is an exact copy (memory) of the parent (calling process), except for the following:
- PIDs are different.
- The PPID of the child equals the PID of the parent.
- The child does not inherit the following from the parent:
- Memory locks
- Semaphore adjustments
- Outstanding asynchronous I/O operations
- Asynchronous I/O contexts
- Using an exec: This replaces the current process image with a new one, loading the program into the current process space and running it from its entry point.