thread accounting in libpthread

Daniel Eischen deischen at freebsd.org
Sat Feb 19 11:20:51 PST 2005


On Sun, 20 Feb 2005, Kazuaki Oda wrote:

> Daniel Eischen wrote:
>
> > kse_check_completed() is called after kse_wait().  Do you
> > have local changes that removed it?
> >
>
> No,  I have not changed.  kse_check_completed() is called after kse_wait().
> What I meant in the past e-mail was that in such case there was no
> running thread,
> and so we did not needlessly switch it out.

If there was no running thread before kse_wait(), then after
kse_wait() returns and if there are completed threads, then
either one thread completed or N threads completed.  Either
way, they are all added to the end of the run queue.  But
the run queue must have been empty to begin with, otherwise
kse_wait() would not have been called.  So it doesn't matter
whether they are added to the head or the end of the queue.
If one thread completes, then it will be run right away
since it will be the only thread in the queue.  If N threads
complete (assuming they are all at the same priority) then
the first thread pulled from the completed list will be
run first since it will be the first thread added to the
run queue.

-- 
DE



More information about the freebsd-threads mailing list