Simple description of worker and I/O threads in .NET

Posted by Konstantin on Stack Overflow See other posts from Stack Overflow or by Konstantin
Published on 2010-01-20T08:29:06Z Indexed on 2010/06/06 10:42 UTC
Read the original article Hit count: 318

Filed under:
|

It's very hard to find detailed but simple description of worker and I/O threads in .NET

What's clear to me regarding this topic (but may not be technically precise):

  • Worker threads are threads that should employ CPU for their work;
  • I/O threads (also called "completion port threads") should employ device drivers for their work and essentially "do nothing", only monitor the completion of non-CPU operations.

What is not clear:

  • Although method ThreadPool.GetAvailableThreads returns number of available threads of both types, it seems there is no public API to schedule work for I/O thread. You can only manually create worker thread in .NET?
  • It seems that single I/O thread can monitor multiple I/O operations. Is it true? If so, why ThreadPool has so many available I/O threads by default?
  • In some texts I read that callback, triggered after I/O operation completion is performed by I/O thread. Is it true? Isn’t this a job for worker thread, considering that this callback is CPU operation?
  • To be more specific – do ASP.NET asynchronous pages user I/O threads? What exactly is performance benefit in switching I/O work to separate thread instead of increasing maximum number of worker threads? Is it because single I/O thread does monitor multiple operations? Or Windows does more efficient context switching when using I/O threads?

© Stack Overflow or respective owner

Related posts about .NET

Related posts about threads