From owner-cvs-all Sat Jul 7 21:35:11 2001 Delivered-To: cvs-all@freebsd.org Received: from smtp4ve.mailsrvcs.net (smtp4vepub.gte.net [206.46.170.25]) by hub.freebsd.org (Postfix) with ESMTP id 4AF5637B401; Sat, 7 Jul 2001 21:35:01 -0700 (PDT) (envelope-from babkin@bellatlantic.net) Received: from bellatlantic.net (client-151-198-135-226.nnj.dialup.bellatlantic.net [151.198.135.226]) by smtp4ve.mailsrvcs.net (8.9.1/8.9.1) with ESMTP id EAA51132899; Sun, 8 Jul 2001 04:34:56 GMT Message-ID: <3B47E2EF.3022DF3F@bellatlantic.net> Date: Sun, 08 Jul 2001 00:34:55 -0400 From: Sergey Babkin X-Mailer: Mozilla 4.7 [en] (X11; U; FreeBSD 4.0-19990626-CURRENT i386) X-Accept-Language: en, ru MIME-Version: 1.0 To: Greg Lehey Cc: Matt Dillon , Alfred Perlstein , "Justin T. Gibbs" , John Baldwin , Jake Burkholder , cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org, Matthew Jacob , Doug Rabson Subject: Re: cvs commit: src/sys/sys systm.h condvar.h src/sys/kern kern_ References: <200107052228.f65MSeU64741@aslan.scsiguy.com> <20010705174135.A79818@sneakerz.org> <200107060214.f662ElT61708@earth.backplane.com> <20010708110449.E75626@wantadilla.lemis.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG Greg Lehey wrote: > > >> Y'know this sorta got me thinking about something else, shouldn't the > >> wakeup() calls for most exclusive locks use wakeup_one? I know > >> wakeup_one() hoses priority, but for the locks in things like vnodes > >> and the pager locks, shouldn't we do a wakeup_one() since it is an > >> exclusive lock? > >> > >> -- > >> -Alfred Perlstein [alfred@freebsd.org] > > > > I would not recommend using wakeup_one until 5.2ish. A mistake could > > result in hard-to-find system lockups. > > I would not recommend using wakeup_one. It has the potential to hang > the system. > > One of the tradeoffs in the sleep/wakeup paradigm is that you wait on > an arbitrary address. This works fine as long as you wake up *every* > process. But consider two independent subsystems which wait on the > same address. wakeup_one wakes the first waiter on the list, which > happens to belong to the other subsystem. It checks its environment > and goes back to sleep. Bingo! The first subsystem has lost a > wakeup. Hm, my understanding is that the intended "standard" way of using the likes of wakeup_one (such as sVr4.mp condition variable non-broadcast signalling) is that after the woken up process/thread completes its work it _must_ check if anybody else is sleeping on the same condition and wake up the next sleeper. The idea is that the conditional variable protects a resource that may only be used by one process at a time, so to avoid waking up all the potential herd of sleeping processes only to get all of them but one to check the condition and go to sleep again, only one process is woken up at a time, and after it's done it must wake up the next one. I'd say that any other use of such non-broadcast wakeup is probably bogus. -SB To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message