process group question

Martin Kirk mkirk at zaphod.axion.bt.co.uk
Fri Feb 9 08:59:09 AEST 1990


>From article <1281 at sun2.summer.bt.co.uk>, by francis at summer.bt.co.uk (Francis Tsui):
> Can someone please tell me what a process group leader does,
> especially with regards to terminals, and how you can make a 
> process a process group leader. I am using SunOS4.0.
> 
> Thanks to all those people who answered my last question.
> 
> ----------------------------------------------------------
> Francis Tsui	British Telecom Research Lab.
> 		Martlesham Heath,
> 		Ipswich.
> 
> 

Process groups are normally manipulated by shells and used to
associated together groups of processes. I have never had to play with
them, but I think that the following is correct in principle. 

Process groups are generally used by job contol shells such as the csh
and ksh on systems that provide kernel support for job control (BSD,
System V Release 4, etc).

Each "job" is put in its own process group. Thus all the processes in
the group can receive the same signals. This is necessary to support
transferring jobs between background and foreground, and for killing
entire jobs.

In System V, prior to Release 4, process groups are also used by the
shell to contol "controlling terminal" association.

A process group leader has it's process ID the same as it's process group ID.
The setpgrp() system call is used to set this up. The number of
arguments differs between BSD and System V. In System V, calling
setpgrp() makes the process a pg leader and dissociates it from its
contolling terminal. This is necessary for daemon processes and is
equivalent to the TIOCNOCTTY ioctl call in BSD systems.

POSIX has changed the concepts slightly, introducing the idea of
"sessions". Here process groups are used for job control and sessions
are used to associate process common to a login session. Thus sessions
deal with the controlling tty issues and process groups deal with job
control.

Hope this helps.  There is a good description in the Rationale of the
P1003.1 standard. I assume that this would also be well covered in the
Bach and Leffler et al books.

Martin

============================================================================
E-Mail:       MKirk at axion.bt.co.uk (...mcvax!ukc!axion!mkirk)
Organisation: British Telecom Research Laboratories (RT3134)
Snail Mail:   BTRL, Rm 306A SSTF, Martlesham Heath, IPSWICH IP5 7RE, UK
Telephone:    +44 473 642518            Fax: +44 473 643019
Quote:        "It has been stated somewhere that men can be divided into
	       two classes - those who can and those who can not stop a dog
	       fight."          "Bulldog Drummond at Bay" by "Sapper"
============================================================================



More information about the Comp.unix.questions mailing list