Consider the following code which runs in an ASP.Net web application on IIS...
_thread = new Thread(Method1)
_thread.Start();
As there is a thread pool within the ASP.Net process what is the effect of this code? Specifically...
Will it take another thread from the ASP.Net thread pool? Or from a different threadpool? Or does this code bypass the thread pool and just get a new thread?
Is this the same thread pool that is used to serve page requests? Therefore, this code which was put in to improve performance could actually reduce it by taking another thread that could be used to serve another resource to another user?
Is the thread pool only used for serving non-static resources? Does IIS have it's own thread pool for serving resources that do not run through the managed pipeline?
What would happen if the App. Pool was recycled after calling
_thread.Start()? Would IIS allow this thread to complete before closing down the application pool?It seems to be that this code forces the creation of a new thread. Would there be a benefit to swapping this code to use Async/Wait? The code that runs in
Method1()is IO bound.