Strange ThreadPool Behavior

posted by Damir Dobric

Downloads: 304
File size: 37.2kB
Views: 159,882
Strange ThreadPool Behavior


I implemented a test application (see attachments) which invokes a processor intensive method by using of ThreadPool-threads and IO threads.
The test initiates dispatching of 10 threads. By using of ThreadPool.QueueUserWorkItem  it is expected that pool dispatch some number of threads depending on internal algorithm etc.

By using of IO-threads (native overlapped) it is expected that the number of currently running threads equals to number of processors if the threads internally do not make usage of sleep etc.

As a consequence of this behavior it is expected that IO-threads will take less time than managed threads.

This behavior (very simplified described) works fine on all single processor machines. Unfortunately, on dual core machines all IO threads are dispatched immediately. This has bad impact on performance.


Add a Comment

(required) is a .Net Community Blog powered by daenet GmbH.