From owner-freebsd-smp Sun Jul 2 19:16:10 2000 Delivered-To: freebsd-smp@freebsd.org Received: from wantadilla.lemis.com (wantadilla.lemis.com [192.109.197.80]) by hub.freebsd.org (Postfix) with ESMTP id F09B637BECD for ; Sun, 2 Jul 2000 19:16:02 -0700 (PDT) (envelope-from grog@wantadilla.lemis.com) Received: (from grog@localhost) by wantadilla.lemis.com (8.9.3/8.9.3) id LAA62161; Mon, 3 Jul 2000 11:45:35 +0930 (CST) (envelope-from grog) Date: Mon, 3 Jul 2000 11:45:35 +0930 From: Greg Lehey To: Daniel Eischen Cc: Jason Evans , Luoqi Chen , smp@FreeBSD.ORG Subject: Re: SMP meeting summary Message-ID: <20000703114535.T39024@wantadilla.lemis.com> References: <20000626151441.L8965@blitz.canonware.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 1.0pre2i In-Reply-To: Organization: LEMIS, PO Box 460, Echunga SA 5153, Australia Phone: +61-8-8388-8286 Fax: +61-8-8388-8725 Mobile: +61-418-838-708 WWW-Home-Page: http://www.lemis.com/~grog X-PGP-Fingerprint: 6B 7B C3 8C 61 CD 54 AF 13 24 52 F8 6D A4 95 EF Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org On Monday, 26 June 2000 at 20:00:09 -0400, Daniel Eischen wrote: > On 26 Jun 2000, Jason Evans wrote: > >> On Mon, Jun 26, 2000 at 02:49:57PM -0700, Jason Evans wrote: >>> On Mon, Jun 26, 2000 at 04:13:24PM -0400, Luoqi Chen wrote: >>>>> Processes that block on a mutex are granted the lock in FIFO order, rather >>>>> than priority order. In order to avoid priority inversion, the mutex wait >>>>> queue implements priority lending. >>>>> >>>> Ok. I remember I have read somewhere that solaris 7 has given up the behavior >>>> of waking up only one thread after a mutex is released, now it wakes up all >>>> the blocking threads. It seems that the "thundering herd" problem is not >>>> serious after all if the lock granuity is high enough. >>> >>> I don't think this is the case. >> >> Whoops. The article is broken into two web pages, and the second page >> states exactly what you said: as of Solaris 7, all waiting threads are >> woken up. > > Yes, this confirms what Jim Mauro said in the Solaris Internals course > at USENIX. Since mutexes are held only for very small amounts of time > and the kernel is sufficiently fine-grained, their was no advantage > to calling wake_one() as opposed to wake_all(). Obviously with these > semantics, the waiter with the highest priority should obtain the > mutex. At least that was my recollection... I find this rather strange. There can be many reasons to take a mutex, and not all of them have to be fast. Even in the case where they are, it doesn't seem to be of any value to wake more processes than can take the mutex. From http://www.sunworld.com/sunworldonline/swol-08-1999/swol-08-insidesolaris-2.html: Sun engineering coded the turnstile_wakeup() in Solaris 7 in a generic enough way so that a single thread wakeup could be executed, instead of all threads inevitably waking up together. Exhaustive testing under a variety of different loads has shown that, in practice, we very rarely end up with a large blocking chain of threads, and thus almost never run into the thundering herd problem. The wakeup-all implementation also solves some bit synchronization issues that make a wakeup-one scenario tricky. This seems like a less honest way of saying "We couldn't figure out how to avoid race conditions on wakeup, and so far nobody has been able to point to a thundering herd". I'd need some conviction. Greg -- Finger grog@lemis.com for PGP public key See complete headers for address and phone numbers To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message