Where are my managed threads in W3WP
-
26-10-2019 - |
Question
I create some managed threads inside an asp.net application (System.Threading.Thread
). Each thread creates a row in a database and deletes it after the work is done (~3-5 minutes).
When I look thread count of w3wp
in task manager
of windows, the thread count is less than what I expect. For example if I have 100 running jobs according to database, there are 50 threads in w3wp
. It is very fluctuating and sometimes it's one to one.
Does thread count
in task manager
count managed threads? If yes, then where are my threads ?
Solution
An operating-system [thread] has no fixed relationship to a managed thread, because an unmanaged host can control the relationship between managed and unmanaged threads. Specifically, a sophisticated host can use the Fiber API to schedule many managed threads against the same operating system thread, or to move a managed thread among different operating system threads.