Measuring Multiprocessor System Activity |
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 affinity algorithm that favors running a thread either on the last processor that serviced it or its ideal processor, a processor associated with a thread with a default value assigned by the system or optionally specified by the program developer in the application code. Affinity is 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.