From owner-freebsd-threads@FreeBSD.ORG Mon Jul 7 11:42:12 2003 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 3234637B401 for ; Mon, 7 Jul 2003 11:42:12 -0700 (PDT) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7BCF943F75 for ; Mon, 7 Jul 2003 11:42:11 -0700 (PDT) (envelope-from eischen@vigrid.com) Received: from mail.pcnet.com (mail.pcnet.com [204.213.232.4]) by mail.pcnet.com (8.12.8/8.12.1) with ESMTP id h67IgAAI005352; Mon, 7 Jul 2003 14:42:10 -0400 (EDT) Date: Mon, 7 Jul 2003 14:42:10 -0400 (EDT) From: Daniel Eischen X-Sender: eischen@pcnet5.pcnet.com To: Petri Helenius In-Reply-To: <3F0994CB.6070403@he.iki.fi> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII cc: freebsd-threads@freebsd.org Subject: Re: thread scheduling priority X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: deischen@freebsd.org List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jul 2003 18:42:12 -0000 On Mon, 7 Jul 2003, Petri Helenius wrote: > Daniel Eischen wrote: > > >Mutexes are implemented using direct handoff (I think that's the > >term). Once a mutex is released, it is given to the next thread > >that is waiting on it and that thread is then marked runnable. > >Idle KSEs are suppose to be woken whenever there are runnable > >threads. > > > > > So when the main thread unlocks the mutex there are two runnable threads, > which one keeps running? The current thread. As I said before, if there are idle KSEs, then one is woken to run the newly runnable thread. > > >For now, just see if things work better with 1 CPU defined. > >If not, then all this talk about multiple KSEs isn't your > >problem; it is something else. > > > > > It definetly runs a lot better, however not as good as I would expect if > the running thread would be switched to the higher scheduling priority > thread immediately on the mutex release. Should that happen or does > it wait until the other thread hits a blocking condition ? It waits until either you hit a blocking condition or the quantum expires. The library is not (yet) smart enough to switch out the current thread after the unlock if the new owner has a higher priority. We could do that, but if there are other KSEs that can run the new thread, then they should get it. -- Dan Eischen