.NET 2.0 pool exhaustion ...

Doing a bit of R&R programming with a beer here, trying to test .NET 2.0 pool exhaustion. Exhausting work ...

The surprise was, that on pool exhaustion, it is not the invoking client that gets blocked. Instead it seems that .NET queues the BeginInvoke() requests, and so the client can continue happily along, even when the pool is exhausted. Which is nice.

It seems that:

The default max pool size is 25 per CPU.

So on my dual CPU box, the default max pool size is 50 threads.
You can programmatically increase the thread pool size. I got 266 concurrent threads running on dual processor 2.79 GHz 1 Gb RAM

When the thread pool is exhausted, the client is not blocked. Instead, the work item is added to a queue of work items, and the client can continue immediately.



The code, expurgated version:

this code a bit damaged, somehow lost to the annals of time ...

private int countThreads(int _iThreads)
{
iPeakThreadCount = 0;
iThreadCount = 0;
Console.WriteLine();
for (int i = 0; i < tmdel =" new"> 0);
return iPeakThreadCount;
}

Comments