Regarding some current issues

Jan 12, 2010 at 3:31 PM

This looks like a great tool and I would love to utilize it.


I have a question on some posts I saw, and one of your own admonishments.


1) This post on Codeplex ( indicates that the pool is not efficient at queueing under load. Has this been addressed?


2) Your own article makes the following statement:

When to use?

The Smart Thread Pool is good when your work items don't do too much, but wait for events, IOs, sockets, etc. This means that the work items don't use CPU, but run for a long time. It is also good when you don't need to keep alive too many threads in the air all the time. If your work items do a short time work, then use the .NET ThreadPool. If you have a constant heavy load of work, then use Toub's thread pool and define the maximum number of threads accordingly.

Can you elaborate on why you make this restriction?

Can you offer some more guidelines to use when evaluating appropriateness?

 We'd like to use it as the basis of a prioritized processing daemon framework. What I am concerned about is that I know where the line is, so we don't cross it and wind up with a problem down the line. I need to know the underlying reasons for your restriction.



Eric A. Anderson



Jan 30, 2010 at 12:03 PM


I am working on the Smart Thread Pool for a quite long time now and my drive is to
implement features that don’t exist in the .NET Thread Pool and are needed in
a multi tasking environment.

To implement it I used locks and XXXResetEvents which are enough for the implementation,
but not so efficient comparing to lock free data structures and batching work items.

Because of this, Thread Pools (or parallel libraries), which are dedicated for speed will work
faster than the Smart Thread Pool. However, if you need more features, such as the WorkItemsGroup
and Cancel you will choose the Smart Thread Pool.

Locks are inefficient when you have many work items that work for short time (I don’t
know exactly how short), this is why I recommend on Smart Thread Pool when you need to work
on a long work items, which will use less locking.

am aware of the Parallel library that is going to be published as part of .NET 4.0. It has
many features that I implemented in the Smart Thread Pool. And it supposes to be very efficient,
especially on Windows 7 where it utilize the new threading APIs.