From owner-freebsd-hackers Fri Aug 25 5:58:37 2000 Delivered-To: freebsd-hackers@freebsd.org Received: from almso1.proxy.att.com (almso1.att.com [192.128.167.69]) by hub.freebsd.org (Postfix) with ESMTP id 9610437B423 for ; Fri, 25 Aug 2000 05:58:32 -0700 (PDT) Received: from gab200r1.ems.att.com ([135.37.94.32]) by almso1.proxy.att.com (AT&T IPNS/MSO-2.2) with ESMTP id IAA10921; Fri, 25 Aug 2000 08:58:31 -0400 (EDT) Received: from njb140bh2.ems.att.com by gab200r1.ems.att.com (8.8.8+Sun/ATTEMS-1.4.1 sol2) id JAA01545; Fri, 25 Aug 2000 09:00:21 -0400 (EDT) Received: by njb140bh2.ems.att.com with Internet Mail Service (5.5.2652.35) id ; Fri, 25 Aug 2000 08:58:30 -0400 Message-ID: From: "Yevmenkin, Maksim N, CSCIO" To: "'Alfred Perlstein'" , core-ix@hushmail.com Cc: freebsd-hackers@FreeBSD.ORG Subject: RE: Preventing zombies to occure Date: Fri, 25 Aug 2000 08:58:28 -0400 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2652.35) Content-Type: text/plain; charset="iso-8859-1" Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > > I have some ideas to improve fork()-ing and getting rid of > zombie processes. > > This things mentioned here are proposed of a man that do > not know very well > > (author means 'the depths' of) BSD kernel source although > he have some ex- > > pirience with it (mainly in reading it :-). > > > > By definition zombie is a process entry in proc table that > wasn't released > > by wait*() called form the parent's code. So all we need to > do is to ensure > > that parent will call wait*() as many times as it called > fork(). This meth- > > od have some advantages but it has some disadvantages too. > First of all, > > we > > provide programmers & all users with full out-of-zombies > enviroment where > > everything created will be destroyed in the right way. > Second, proposed > > me- > > thod is easy to include in current source with minnor modifications. > > > > [snip] > > If a parent that has zombie children exits the kernel will attach them > to init (I haven't checked, but this is the common unix solution). > init will be calling waitpid to clear zombies automagically. > > So this sorta already happens. :) two ways: first: something like SIGCHLD_handler(int) { while (waitpid(-1, NULL, 0)) ; } you need to handle SIGCHLD, otherwise you will have zombies. second: use SA_NOCLDWAID flag in sigaction(2) in this case ``init'' will be responsible for zombie process thanks, emax To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message