Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 7 Jul 2003 14:42:10 -0400 (EDT)
From:      Daniel Eischen <eischen@vigrid.com>
To:        Petri Helenius <pete@he.iki.fi>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: thread scheduling priority
Message-ID:  <Pine.GSO.4.10.10307071436550.4037-100000@pcnet5.pcnet.com>
In-Reply-To: <3F0994CB.6070403@he.iki.fi>

next in thread | previous in thread | raw e-mail | index | archive | help
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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.GSO.4.10.10307071436550.4037-100000>