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. Concerning bugs, this is actually the first motivation behind my changes. There are subtle bugs that appear when libports_stability.patch (which enforces global and thread timeouts to 0, preventing threads from exiting), isn't applied to the Hurd. I didn't take care to note them down, and instead decided to fix them as a side effect of reworking thread termination. I too agree that fixing bugs is the first priority. -- Richard Braun