Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.2 9/18/84; site fritz.UUCP Path: utzoo!watmath!clyde!burl!ulysses!allegra!mit-eddie!genrad!decvax!ittatc!dcdwest!sdcsvax!sdcrdcf!trwrb!scgvaxd!felix!fritz!zemon From: zemon@fritz.UUCP (Art Zemon) Newsgroups: net.unix-wizards,net.unix Subject: Re: UNIX question Message-ID: <4324@fritz.UUCP> Date: Mon, 9-Dec-85 20:36:45 EST Article-I.D.: fritz.4324 Posted: Mon Dec 9 20:36:45 1985 Date-Received: Thu, 12-Dec-85 05:19:58 EST References: <156@uw-june> Reply-To: zemon@fritz.UUCP (Art Zemon) Organization: FileNet Corp., Costa Mesa, CA Lines: 34 Keywords: zombies, wait() Xref: watmath net.unix-wizards:16063 net.unix:6600 Summary: use wait() In article <156@uw-june> pjs@uw-june (Philip J. Schneider) writes: > > >I have a C program which, during the course of its execution, spawns(forks) >child processes. I should mention that a process is spawned, it lives >for a while, then exits, and then sometime later the same thing happens, >and so on. This all happens within the lifetime of the parent, and I >would like to do this an arbitrary number of times. Sometimes, two or >more child processes exist at once, but the upper limit on child >processes that exist concurrently is low, and a group of such children >exit before the next process begins. > >Since UNIX only allows one a certain number of processes at a time, >eventually during the course of execution of the parent I run out of >processes. If I temporarily stop the parent process execution and >do a 'ps', the child processes show up in the list with a 'Z' status. >They do not completely disappear until the parent process exits. As some >of you probably already know, these useless ex-processes can't even >be completely gotten rid of with a 'kill' command. The result is that >these processes are taking up my process quota, even though they are >dead in all practical terms (in that they finished their work and exited >properly). Of course, they do go away completely once the parent exits. The child processes have gone away properly and are waiting for someone (some process) to collect their exit statuses with a wait() or a wait3(). They cannot be kill()-ed because they are already dead. They go away after the parent exits because init inherits them and does enough wait()s to get rid of all of them. -- -- Art Zemon FileNet Corp. ...! {decvax, ihnp4, ucbvax} !trwrb!felix!zemon