From owner-freebsd-smp Mon Jun 26 17: 0:30 2000 Delivered-To: freebsd-smp@freebsd.org Received: from pcnet1.pcnet.com (pcnet1.pcnet.com [204.213.232.3]) by hub.freebsd.org (Postfix) with ESMTP id 961F637BA93 for ; Mon, 26 Jun 2000 17:00:27 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: (from eischen@localhost) by pcnet1.pcnet.com (8.8.7/PCNet) id UAA17781; Mon, 26 Jun 2000 20:00:09 -0400 (EDT) Date: Mon, 26 Jun 2000 20:00:09 -0400 (EDT) From: Daniel Eischen To: Jason Evans Cc: Luoqi Chen , smp@FreeBSD.ORG Subject: Re: SMP meeting summary In-Reply-To: <20000626151441.L8965@blitz.canonware.com> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-smp@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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... In regards to turnstiles, each kernel thread is born with its own turnstile. When it blocks on a mutex that doesn't have any waiters (no turnstile allocated to it), it uses the threads turnstile. If the mutex already has a turnstile (there are other waiters), then the threads turnstile is added to the system (per-CPU?) pool of turnstiles. When the thread wakes up and acquires the mutex, it takes a turnstile back from the turnstile pool. Turnstiles are also used for read/write locks. -- Dan Eischen To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-smp" in the body of the message