Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 25 Apr 2003 02:26:48 -0400 (EDT)
From:      Daniel Eischen <eischen@pcnet1.pcnet.com>
To:        David Xu <davidxu@freebsd.org>
Cc:        freebsd-threads@freebsd.org
Subject:   Re: SMPing libpthread
Message-ID:  <Pine.GSO.4.10.10304250218180.12192-100000@pcnet1.pcnet.com>
In-Reply-To: <02c001c30add$7377ff40$f001a8c0@davidw2k>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, 25 Apr 2003, David Xu wrote:
> ----- Original Message ----- 
> From: "Daniel Eischen" <eischen@pcnet1.pcnet.com>
> To: "David Xu" <davidxu@freebsd.org>
> Cc: <freebsd-threads@freebsd.org>
> Sent: Friday, April 25, 2003 11:07 AM
> Subject: Re: SMPing libpthread
> 
> 
> > On Thu, 24 Apr 2003, David Xu wrote:
> > 
> > > I have put a patch to enable userland support SMP scheduling. 
> > > http://people.freebsd.org/~davidxu/libpthread_smp.diff
> > > The patch works on my SMP machine, but not fully tested,
> > > and I will work on idle kses stuffs. At least, it seems
> > > the SMP speed is not slower than UP. :-)
> > 
> > Cool, I just found the bug with scope process threads that was
> > causing Token_Strategy_Test to fail.  Now the 2 ACE tests that
> > were SIGBUS'ing (with scope system threads enabled) are now
> > running.  Only Token_Strategy_Test fails, but it is just an
> > expected result where some mean value is less than the stddev.
> > 
> >   http://people.freebsd.org/~deischen/kse/libpthread.diffs
> > 
> > I was willing to work on the idle KSEs; I was just asking
> > your opinion :-)  Feel free to tackle it though.
> > 
> I have a simple idea, in kse_wait(), a kse inserts itself into
> an idle kse queue under scheduler lock held(it is already), 
> then release scheduler lock and call kse_release(). any
> other kses enters in _thr_sched_multi and got a completed context 
> list should look the idle kses queue and wakeup those idle kses
> accordingly, also _thr_set_runnable_unlocked etc should look
> the idle queue as well, because all things are done under scheduler
> lock, it seems very nice for me. :-)

Yeah, very similar to what I was going to do.  I was just
going to increment the KSEG's kg_idle_kses and add an idle flag
to the KSE (and set it in kse_wait()).  The KSE's are already
in a list hung off the KSEG, so you could just walk the list
until you found an idle KSE to wakeup.  But you could add another
"idle KSE" list just as well.

I also thought about adding a _pq_count() (or _pq_depth())
function to the priority queues.  So you can tell if there
is more than one thread.  There's no sense in waking idle
KSEs if there's not enough runnable threads for them to run.

-- 
Dan Eischen



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