01-31-07 06:29 AM
On Jan 31, 10:34 am, Paul Pluzhnikov <ppluzhnikov-...@charter.net>
wrote:
> baumann....@gmail.com writes:
>
> Parent fork()s child C1 and immediately wait()s for it.
> Child C1 immediately fork()s child C2 and exit()s.
> Parent P collects C1 exit status and continues doing whatever it
> needs to do.
>
> Now C1 can't become a zombie -- it has exited and has been waited
> for by P.
>
> C2 can't become a zombie either -- it's parent (C1) has exited,
> so C2 is an orphan.
>
> Orphans on UNIX get inherited by process 1 (init).
> Process 1 is constantly waiting for any childred that might exit
> (that's one of its jobs). When C2 exits, its exit status gets
> collected by init -- C2 doesn't become zombie.
>
> Cheers,
> --
> In order to understand recursion you must first understand recursion.
> Remove /-nsp/ for email.
How about if parent immediately exits after child C1 forks(let the C1
be the orphan, parent process are not planing to do anything else)?
[ Post a follow-up to this message ]
|