The Unix Heritage Society mailing list
 help / color / mirror / Atom feed
From: helbig@Informatik.BA-Stuttgart.DE (Wolfgang Helbig)
Subject: [TUHS] In V6 exit(): wakeup(&proc[1])) unnecessary?
Date: Mon, 23 Dec 2002 00:01:55 +0100 (MET)	[thread overview]
Message-ID: <200212230104.gBN14iw00526@bsd.korb> (raw)

>>When a process terminates (in sys1.c/exit()), it explicitly wakes up
>>the init process. In light of the fact, that every process has a parent,
>>this extra wakeup(&proc[1]) seems unnecessary.
>
>I believe this is meant to handle the case where a process exits
>without having called wait() on its children.
>
>Imagine two processes, A and B, where A is B's parent and A's parent
>is some process other than init.  B calls exit(), becomes a zombie,
>and awakens A.  Some time later, A calls exit() without ever having
>called wait().  This will cause B to become a child of init, and as B
>is a zombie, init should awaken so that B can die.  However, A might
>have any number of zombie children, and it would be redundant to call
>wakeup(&proc[1]) for each one.  Therefore, the wakeup call to init is
>done up front, whether it is needed or not.  This does result in some
>unnecessary wakeup calls but on the whole it seems a good tradeoff for
>code simplicity.

Oh, I see! So the condition to wakeup init would be
	"Do I have any zombie children"?
The code as it is is simpler. But harder to understand.
Thank you very much for your help!

Greetings

Wolfgang Helbig




             reply	other threads:[~2002-12-22 23:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-12-22 23:01 Wolfgang Helbig [this message]
  -- strict thread matches above, loose matches on Subject: below --
2002-12-22 11:15 Wolfgang Helbig
2002-12-22 19:00 ` Mirian Crzig Lennox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200212230104.gBN14iw00526@bsd.korb \
    --to=helbig@informatik.ba-stuttgart.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).