[comp.unix.questions] What is a process group

kevin@msa3b.UUCP (Kevin P. Kleinfelter) (10/18/89)

What is a process group?  I know the following things:

	You can make a process the process group leader via setpgrp();
	   (with some versions of UNIX)
	You can send a signal to all members of a process group

I have inherited some code which does
	pid = setpgrp ();
	ioctl (2, TIOCSPGRP, &pid);
to change the process group on the terminal.  Why would someone want to
do this?
-- 
Kevin Kleinfelter @ Management Science America, Inc (404) 239-2347
gatech!nanovx!msa3b!kevin

chris@mimsy.umd.edu (Chris Torek) (10/20/89)

In article <1158@msa3b.UUCP> kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes:
>What is a process group?

The short answer is `something you should not use unless you know what it
is' :-)

>I know the following things:
>
>	You can make a process the process group leader via setpgrp();
>	   (with some versions of UNIX)

(SysV)

>	You can send a signal to all members of a process group

Tty signals go to process groups.  If you want to avoid tty signals you
need to be in a different group, and/or not connected to the tty, and/or
simply ignore the signals (a la `nohup').

The rest of the situation is system-dependent, so that the question cannot
be answered without knowledge as to the specific Unix variant.
-- 
`They were supposed to be green.'
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris@cs.umd.edu	Path:	uunet!mimsy!chris

cpcahil@virtech.UUCP (Conor P. Cahill) (10/20/89)

In article <1158@msa3b.UUCP>, kevin@msa3b.UUCP (Kevin P. Kleinfelter) writes:
> I have inherited some code which does
> 	pid = setpgrp ();
> 	ioctl (2, TIOCSPGRP, &pid);
> to change the process group on the terminal.  Why would someone want to
> do this?

The main purpose for changing the process group (and disconnecting from the 
tty -- the ioctl()) is to allow a background/daemon process to continue
running without being affected by operations happening on the tty from 
which the process started.  Like the user loggin out, which will normally 
send a SIGHUP to all processes associated with the terminal.



-- 
+-----------------------------------------------------------------------+
| Conor P. Cahill     uunet!virtech!cpcahil      	703-430-9247	!
| Virtual Technologies Inc.,    P. O. Box 876,   Sterling, VA 22170     |
+-----------------------------------------------------------------------+