Question

I have a general question about System.Threading.Threadpool when run in a webapplication on IIS. Say we have 2 requests execute at once, and we fire up a couple of threads through the ThreadPool.QueueUserWorkItem method. Will the two requests share the ThreadPool, or will the calls to the ThreadPool from the two requests operate in a two separate pools?

This is in IIS6 and 7.

Thanks for any insight.

Was it helpful?

Solution

Here is a quote from the MSDN documentation about the ThreadPool class:

There is one thread pool per process. The thread pool has a default size of 250 worker threads per available processor, and 1000 I/O completion threads.

In IIS6 and IIS7 any given ASP.NET application is hosted inside of a single process (w3wp.exe) through the Application Pool infrastructure.
An Application Pool can host multiple web applications by keeping them in different AppDomains, but it runs inside of one physical process on the server.

These two facts mean in practice that all threads from a running web application instance execute inside the same .NET Thread Pool.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top