Processes in memory are represented by a tree, where each process has a parent. In Linux, systemd is always the root parent processes for all user processes and has pid 1. In MacOS, launchd has the same role.

Child processes are created via fork(), which duplicates the parent process. Optionally, exec() can then load a new program into the child’s address space.

When a child process needs resources, either it obtains them directly from the OS or from the parent.

During execution, there are two possibilities:

  • parent continues to execute concurrently with its children
  • parent waits until some or all of its children have terminated

Also for address-space there are two possibilities:

  • child process is a duplicate of the parent process
  • child process has a new program loaded into it

See also

References

  • A. Silberschatz, P. B. Galvin, e G. Gagne, «Operating System Concepts».