Here is a strange scenario I encountered. One of my customers complained that the number of threads is continuously increasing.
So, in order to check it, I opened the Pefmon and selected the System category that includes both processes count and the threads count. I monitored it for a while and could not detect any increase in the total threads count.
Then I opened the Objects category in the Perfmon and selected the Processes and the Threads objects. At first glance I could see that the System counters and the Objects counters are not in sync.
There are a few processes and threads that are missing from the System category.
When exploring the definitions for both I could see that they are just the same:
System/Objects
Threads - Threads is the number of threads in the computer at the time of data collection.
Processes - Processes is the number of processes in the computer at the time of data collection.
So, If they collect the same data and have the same definition, why are there differences???
Process
Another category that we can use to see the number of threads is the Process category with includes the Thread count counter.
I have noticed that the thread count for the Process category and the System category is the same. The explanation of the thread count counter is as follows:
Thread count - The number of threads currently active in this process.
Bottom line
That means that the total threads for all processes are equal to the System threads count and that the Objects threads count includes the total threads that are active and non-active!
When checking the thread count verify that both the active threads in the system category and the total threads in the Objects category (e.g. both the active and non active ones) does not increase over time.