[comp.unix.questions] parents and children

jfjr@mitre-bedford.ARPA (Jerome Freedman) (08/19/88)

Are(is) the health of child processes connected to the
health of the parent, ie if a process forks off another
process and the parent process dies will the child continue
to live? If so can I arrange that the child live on??


                              Jerry Freedman, Jr
                              jfjr@mitre-bedford.arpa

Jerry Freedman, Jr       "Why did 
jfjr@mitre-bedford.arpa      Unix come from the east?"
(617)271-3191           

gwyn@smoke.ARPA (Doug Gwyn ) (08/21/88)

In article <39060@linus.UUCP> jfjr@mitre-bedford.arpa (Freedman) writes:
>Are(is) the health of child processes connected to the
>health of the parent, ie if a process forks off another
>process and the parent process dies will the child continue
>to live? If so can I arrange that the child live on??

Processes don't "die".  They terminate either by invoking the exit
system call or as the default action for certain uncaught signals
posted to them (either self-generated or from another process via
the kill system call).

Termination of a parent process does not normally result in
generation of a signal, so the child is unaffected.  The only
circumstance under which a signal might be generated is when
some process such as one's login shell terminates causing a
SIGHUP to be sent to the process group associated with the
controlling terminal.  The details of this vary among UNIX
implementations.  If a process ignores SIGHUP it will be safe.
The "nohup" command can be used to spawn a process with
SIGHUP ignored, or a process can invoke signal(SIGHUP,SIG_IGN).