At Mon, 18 Nov 2013 12:31:42 +0100,
Richard Braun wrote:
> 
> On Mon, Nov 18, 2013 at 11:33:55AM +0100, Neal H. Walfield wrote:
> > Richard Braun wrote:
> > > The current state is to never terminate threads, on the assumption that
> > > they can't both terminate and release their stack on their own. Such
> > > resources are recycled by the threading library.  This patch makes use
> > > of a new GNU Mach specific call (thread_terminate_release [1]) so that
> > > threads do terminate themselves and release their stack, and in addition
> > > their last self reference, and their reply port.
> > 
> > Eliminating bugs should be our first priority.  However, recycling
> > threads is a good idea, particularly when the application sees threads
> > as lightweight resources.  Ideally, there is some mechanism that
> > identifies thread churn and sizes the reserve thread pool
> > appropriately (e.g., the maximum of the maximum number of live threads
> > during each minute in the past 5 minutes).  Note: this isn't a reason
> > not to apply the patch, but should perhaps be noted as possible future
> > work.
> 
> Personally, I consider this to be the responsibility of another
> component, such as a work queue library. The threading library is a
> low level component and should act as closely as its users expect it to.

I don't agree.  On Linux, creating a thread is a pretty much a single
system call.  On a micro-kernel based system, there is a lot more work
to do.  This is a relatively straightforward optimization that doesn't
changed the semantics of the operations.

Neal

Reply via email to