Interesting piece on thread pools

Herb Sutter has just published an interesting article over at DDJ on correctly using thread pools: Use Thread Pools Correctly: Keep Tasks Short and Nonblocking.

It’s not rocket science and it doesn’t deal with platform issues but it’s a useful summary of why The Server Framework’s thread pools operate as they do. Note that on Windows you can use IO Completion Ports to manage the work queue into the thread pool and this can keep the number of threads that are scheduled to run at the optimum number so that the pool operates at the ‘correct load’ for most of the time even in the presence of blocking tasks.