home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / unix / question / 14784 < prev    next >
Encoding:
Text File  |  1992-12-18  |  3.0 KB  |  68 lines

  1. Newsgroups: comp.unix.questions
  2. Path: sparky!uunet!psinntp!dg-rtp!hobbit!hunt
  3. From: hunt@dg-rtp.rtp.dg.com (Greg Hunt)
  4. Subject: Re: <defunct> Zombies
  5. Message-ID: <1992Dec17.151254.4317@dg-rtp.dg.com>
  6. Sender: hunt@hobbit.rtp.dg.com (Greg Hunt)
  7. Date: Thu, 17 Dec 92 15:12:54 GMT
  8. Reply-To: hunt@dg-rtp.rtp.dg.com
  9. References:  <6JwuVB11w165w@iowegia.uucp>
  10. Organization: Data General Corp., Research Triangle Park, NC
  11. Lines: 55
  12.  
  13. In article <6JwuVB11w165w@iowegia.uucp>, kjhoule@iowegia.uucp (Kevin Houle) writes:
  14. > I'm learning to manage a Wyse 9000i running Wyse's Sys V Unix, and have
  15. > a question concerning zombie processes. A few days ago, the current
  16. > admin rebooted the machine to clear out some processes he described as
  17. > "defunct". I asked how you see these processes, and he said to use ps.
  18. > So I did. And I read up in the man pages about ps. The process state 'Z'
  19. > means the process is in zombie state, and that it is finished but the
  20. > parent process has not begun waiting for it. If it does in fact even
  21. > HAVE a parent process, the process is marked as <defunct> in the
  22. > listing. So I'm thinking, the mere fact the process is marked defunct
  23. > means it has a parent that very well may come a' lookin' for the zombie.
  24. > Am I right?
  25.  
  26. Right.  Glad to see you were curious enough to read up on things for
  27. yourself.
  28.  
  29. > Are zombie processes really a problem, and if so, can't the kill command
  30. > be used to get rid of them? I hate the idea of rebooting the machine all
  31. > the time and don't think it is needed.
  32.  
  33. They can be a problem if the parent creates lots of child processes and
  34. never waits for the completion status from them.  This will eventually
  35. fill up the process tables, and then no more processes will be able to
  36. be created on the system.
  37.  
  38. The right way for any parent process that creates children to handle
  39. this is to remember to wait for the completion status of each child
  40. at some point.  Various calls are available to do this, including
  41. wait(2) and waitpid(2).  There are options for pending until any child
  42. completes, pending until a specific child completes, or not pending if
  43. no children have completed recently.
  44.  
  45. If the parent of a child exits, then the child will be adopted by the
  46. init process.  The init process periodically wakes up and will get the
  47. completion status of adopted children, and then those zombies will
  48. disappear.
  49.  
  50. The kill command can't get rid of a zombie, because the process is
  51. already dead.  They shouldn't consume many resources, just a slot in
  52. the process table and whatever is needed to return the completion
  53. status. The only ways to get rid of them are to have the parent wait
  54. for the zombie, or rebooting the system.
  55.  
  56. Rebooting the machine to get rid of zombies is quite extreme, and in
  57. my opinion means that there is at least one parent process on the
  58. system that isn't following the rules.  It should be found and fixed.
  59.  
  60. Hope this helps.
  61.  
  62. -- 
  63. Greg Hunt                            email: hunt@dg-rtp.rtp.dg.com
  64. DG/UX Core Development
  65. Data General Corporation
  66. Research Triangle Park, NC, USA      These opinions are mine, not DG's.
  67.