Penguin
Blame: ProcessGroup
EditPageHistoryDiffInfoLikePages
Annotated edit history of ProcessGroup version 11, including all changes. View license author blame.
Rev Author # Line
8 BenStaz 1 A Process group is a collection of related processes. One important feature is that it is possible to send a signal to every process in the group. Typically when the shell creates a process to run an application, the process is placed into a new process
2 group. As that application forks new processes, the processes are all members of the process group. Process groups are used for distribution of signals, and by terminals to arbitrate requests for their input and output:
7 BenStaz 3
8 BenStaz 4 !Foreground Process Groups
5
9 BenStaz 6 * A foreground process has read and write access to the terminal.
10 BenStaz 7 * Every process in the foreground receives [SIGINT] [SIGQUIT] and [SIGTSTP] signals.
8 BenStaz 8 * Usually consists of the processes forked by the shell and all the processes they fork.
9
10 !Background Process Groups
11
12 * A background process does not have read access to the terminal.
13 * If a background process attempts to read from its controlling terminal its process group will be sent a [SIGTTIN].
11 BenStaz 14
15 !Example
16
17 Notice that cat, sort and uniq all have the same PGID (Process Group ID).
18 <verbatim>
19 staz@tokra:~/log$ cat results | sort | uniq & ps -jf
20 [1] 1239
21 UID PID PPID PGID SID C STIME TTY TIME CMD
22 staz 1237 28341 1237 28341 0 17:55 pts/6 00:00:00 cat results
23 staz 1238 28341 1237 28341 0 17:55 pts/6 00:00:00 sort
24 staz 1239 28341 1237 28341 0 17:55 pts/6 00:00:00 uniq
25 </verbatim>
8 BenStaz 26
27 The [TIOCGPGRP] and [TIOCSPGRP] calls described in termios(4) are used to get/set the process group of the control terminal.
2 PerryLorier 28
5 LawrenceDoliveiro 29 If a ProcessGroup has a ControllingTerminal, [CLOCAL] is not set and a hangup occurs, then the ProcessGroup is sent a [SIGHUP].
4 PerryLorier 30
31 If a ProcessGroup Leader exits, all children processes are sent a [SIGHUP]
2 PerryLorier 32
33 If the exit of the process causes a process group to become orphaned, and if any member of the newly-orphaned process group is stopped, then a [SIGHUP] signal followed by a [SIGCONT] signal will be sent to each process in the newly-orphaned process group.
11 BenStaz 34
35
6 LawrenceDoliveiro 36
37 !! See Also
38
39 * ProcessRelationships