Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Jul 2003 00:37:26 +0300
From:      "Petri Helenius" <pete@he.iki.fi>
To:        <deischen@freebsd.org>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: thread scheduling priority
Message-ID:  <010501c344cf$f66be110$812a40c1@PETEX31>
References:  <Pine.GSO.4.10.10307071436550.4037-100000@pcnet5.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
> > 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.
>
Although I cannot prove this doesnŽt happen, I think the other
thread does not get scheduled until a few moments later because
when I get the scenario where thread1 has the mutex, thread2
is waiting on it, thread1 goes to cpu-bound tasks without
holding the mutex, thread2 is not woken up, at least not immediately.

Is there a delay for waking up the KSE? Obviously if neccessary
I can write a simple test program to spit out timestamps.
>
> 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.
>
IŽll test more soon and see if I can identify a reproducable issue.

Pete



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?010501c344cf$f66be110$812a40c1>