Keeping an eye on hung system calls..

Benjamin Smith bsmith at vtrl.co.uk
Fri Jun 9 11:03:53 BST 2006


On Thu, Jun 08, 2006 at 10:03:34PM +0100, Nik Clayton wrote:
> Since I've just had to do exactly that, I thought I'd mention that the 
> relevant call is POSIX::setsid().

No, it's not.  setsid creates a new *session*.  setpgid/setpgrp create
new process groups.

A session has a controlling terminal (which is where the terminal name
in ps output comes from), and contains one or more process groups.  At
any one time, one of these pgrps is the terminal process group (the
foreground one), and receives signals from user input such as ^C (INTR).

So, if you've got a POSIX job control shell for example, the shell and
all the processes it creates are in one session, but a background job is
in a separate pgrp to a foreground one so that interrupts don't affect
it.

-- 
Benjamin Smith <bsmith at vtrl.co.uk, benjaminsmith86 at yahoo.co.uk>


More information about the london.pm mailing list