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 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.

© 1985-2000 Microsoft Corporation. All rights reserved.



Microsoft Corporation Staff, IT Professional Staff - Microsoft Windows 2000 Server Operations Guide
Microsoft Corporation Staff, IT Professional Staff - Microsoft Windows 2000 Server Operations Guide
ISBN: N/A
EAN: N/A
Year: 2002
Pages: 404

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net