Subject: Re: race condition in pthread write()?
To: enami tsugutomo <enami@sm.sony.co.jp>
From: Nathan J. Williams <nathanw@wasabisystems.com>
List: tech-kern
Date: 02/11/2003 17:15:45
enami tsugutomo <enami@sm.sony.co.jp> writes:

> > That's one possibility... more likely, though, is that the userland
> > code is wedged in a state where it doesn't get around to recycling the
> > used stacks back to the kernel.
> 
> Just a thought but in pthread__resolve_locks(), is it ok to swtich
> with holding recycle candidates in the local queue?

Yes. Every upcall eventually is coninued to completion and calls
pthread__recycle_bulk() and then recycles itself via
pthread__upcall_switch(). Even in the event that the last stack is
gone and the resolve_locks loop is interrupted by a LWP unblocking,
the resolve_locks LWP will not be removed from the runqueue until
there are stacks avaliable.

        - Nathan