*BSD News Article 42009


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!bunyip.cc.uq.oz.au!munnari.oz.au!constellation!news.uoknor.edu!ns1.nodak.edu!netnews.nwnet.net!oracle.pnl.gov!osi-east2.es.net!lll-winken.llnl.gov!uwm.edu!vixen.cso.uiuc.edu!howland.reston.ans.net!pipex!sunic!news.kth.se!nac.no!ifi.uio.no!axelstep
From: axelstep@ifi.uio.no (Axel-Stéphane C. Smørgrav)
Newsgroups: comp.unix.bsd
Subject: Re: fork() Questions.
Date: 30 Jan 1995 08:20:11 +0100
Organization: Dept. of Informatics, University of Oslo, Norway
Lines: 30
Message-ID: <3gi3vb$sfv@gymir.ifi.uio.no>
References: <3g92mu$9dl@outer.net>
NNTP-Posting-Host: gymir.ifi.uio.no


In article <3g92mu$9dl@outer.net>, Mike Mood <mgmood@tulum.com> writes:
> A few quick questions about a daemon I am trying to write. In which:
> The parent does not need to wait for the child to finish. 
> It mearly hands off a socket to the child.
> 
> 1)  After a child process is terminated [exit(0)] why do I still 
> have a zombie process existing?

Because the parent has to do a wait(), waitpid() or some equivalent 
call to pick up the exit status for the child.
 
> 2)  Is there a better way to kill a child process than exit()?

It will remain in the process table as a zombie until it has been 
waited for.
 
> 3)  Would it be better if the child issues an exec*() after the fork()? 

That depends on what you want to do. If you want to load a new process 
image, execXX() is what you need.

Anyway, before proceeding any further, I recommend you read
RW Stevens "Advanced Programming in the UNIX Environment" or/and 
"UNIX Network Programming" or any other book on UNIX programming.

-ascs