Penguin
Note: You are viewing an old revision of this page. View the current version.

Notes on all the different ways that processes can be related to one another.

Parent/Child

When one process creates another using the fork(2) system call, the former is recorded as the parent of the latter, while the latter becomes a child of the former. Significance of parent/child relationship:

  • The parent is allowed to change the process group ID of the child (as long as the child has not done an execve(2) call).
  • When the child terminates, the parent can get a notification, either via the wait(2) or waitpid(2) calls, or by enabling receipt of the SIGCHLD signal.
  • If the parent should terminate before the child, the child is given a new parent, the InitProcess?.

ProcessGroup

A process group is a set of processex all sharing the same process group ID. This is the ID of the process that created the group.

Session?

A session is a set of processes all spawned (directly or indirectly) by the same session leader. A login shell is a session leader, and all processes it spawns in response to user commands are (at least initially) part of that same session. Any process can make itself into the leader of a new session by calling setsid(2), though it is probably a good idea to detach from its ControllingTerminal first.