Hands-On System Programming with Go
上QQ阅读APP看书,第一时间看更新

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.