Strange ThreadPool Behavior


posted by Damir Dobric
07-14-2008

Downloads: 298
File size: 37.2kB
Views: 159,855
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)
(optional)
(required) 
developers.de is a .Net Community Blog powered by daenet GmbH.