Process control and such

Bill Freeman f at ke1g.mv.com
Wed Jan 25 16:43:01 EST 2006


Ben Scott writes:
 >   Someone at last night's meeting (I already forget who it was) was
 > reporting an issue where they start some program from one window,
 > program opens a new window, then they close the first window, and the
 > program (new window) dies too.  I've forgotten the details, too. 
 > (Geez, only 28 and I'm already going senile.)
 > 
 >   Anyhow, a few people, myself included, mumbled things like "process
 > groups" and "sessions" and "job control".  ...

	Well, I wasn't there for the discussion, but, yes, process
groups are probably involved.

	Usually you don't have to think about this kind of stuff
because you start such a program "in the background" by giving the
shell an ampersand at the end of the list.  The shell then puts the
list (I'm pretty sure that it works for a whole list, rather than only
for a pipe or a single process) in its own process group.  Then, when
the closing window sends the shell's process group a HUP, the
background process don't receive it, and continue to run.

	If, instead of just backgrounding commands from the shell,
you're writing some code that backgrounds itself or creates children
that are intended to be persistant, then you do need to worry about
process groups yourself.  Check out the setpgrp(2) man page.

							Bill



More information about the gnhlug-discuss mailing list