Export (0) Print
Expand All

Monitoring Context Switches and Threads

When examining a multiprocessor system, monitor Thread\Context Switches/sec and Thread\% Processor Time to observe which threads are running on which processors, and to find out how frequently they switch between them to do the work of a particular process. This is important to know because there can be occasions when the switching of threads impedes optimal performance.

Typically, Windows 2000 uses a soft affinityI> ,Affinityis the mechanism for associating threads of a process with a processor. With soft affinity, the association can vary between different processors; with hard affinity, the association is fixed to a set of one or more processors. In general, soft affinity is an optimal design that takes advantage of cache locality. However, when threads migrate from one processor to another processor, memory access to previously cached data may be slower. At worst, thread migration might cause false sharing because, to the cache coherency hardware of the CPU, it might appear that multiple processors are sharing a cache line.

Therefore, monitoring context-switching activity and thread processor usage is useful to application developers in understanding thread behavior.

Was this page helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft