Diff: ProcessRelationships

Differences between current version and predecessor to the previous major change of ProcessRelationships.

Other diffs: Previous Revision, Previous Author, or view the Annotated Edit History

Newer page: version 4 Last edited on Thursday, October 11, 2007 8:13:19 pm by MartinJerabek
Older page: version 2 Last edited on Tuesday, January 2, 2007 9:48:41 pm by LawrenceDoliveiro Revert
@@ -9,12 +9,23 @@
 * 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. 
+A ''process group'' is a set of processes all sharing the same ''process group ID''. This is the ID of the process that created the group. Typically a shell will create a new process group for all processes that are part of a single shell ''pipeline''.  
+Process groups are used to arbitrate access to the ControllingTerminal; to avoid user confusion processes currently in the ''foreground'' process group are the only ones allowed to read from this terminal (the assumption is they are all cooperating on the same task), while those in other process groups are blocked from doing so.  
+E.g. consider the following shell command:  
+ find bin -printf '%f\n' | xargs make  
+The shell spawns two initial processes in this process group: one running <tt>find</tt>, the second running <tt>xargs</tt>. The latter will in turn spawn another process, which goes by default into the same group, running <tt>make</tt>. And <tt>make</tt>, in turn, will likely spawn other processes to run compilers or whatever other else is necessary to rebuild the targets returned by the <tt>find</tt> command, depending on what's in the makefile.  
+Because the above command did not end with "&", the new process group is immediately put into the foreground, and the shell waits for the initial processes that it created to terminate before prompting the user for the next command
 !! [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. 
 !! See Also 
 [Concepts of Job Control|]