Analyzing Processor Activity

Previous Topic Next Topic

Single vs. Multiple Threads in a Bottleneck

Bottlenecks can result from activity of multiple threads in a single process, single threads in multiple processes, or multiple threads in multiple processes. Because these problems require different solutions, you need to first distinguish their causes.

To study threads during a bottleneck, log counters of the Processor, Process, and Thread objects for several days at an update interval of 60 seconds. This will allow you to look at thread activity during typical operating conditions and help you associate that activity with processor usage.


important-icon

Important

Performance counter values for threads are subject to error when threads are stopping and starting. Faulty values sometimes appear as large spikes in the data. For more information, see "Overview of Performance Monitoring" in this book.

To determine whether a process is single-threaded or multithreaded

  1. Right-click the Windows task bar and select Task Manager.
  2. In Task Manager, click the Processes tab and, on the View menu, click Select Columns.
  3. In the Select Columns dialog box, select the Thread Count check box, and then click OK.

    This column shows the total number of threads associated with the process.

Figure 7.10 illustrates how Task Manager displays the number of threads running in a process, and the name of the process.

Figure 7.10    Number of Threads Initiated by a Process Shown in Task Manager
Enlarge figure

Figure 7.10 Number of Threads Initiated by a Process Shown in Task Manager

In System Monitor or Counter Logs, select the Thread object and look at all instances listed in the Instance box. If there are several thread identifiers (IDs) listed, then the process is multithreaded. Figure 7.11 illustrates multiple threads of a process as they are listed in the Instances box in the System Monitor user interface.

Figure 7.11    Thread Instances Shown When Adding Counters in System Monitor
Enlarge figure

Figure 7.11 Thread Instances Shown When Adding Counters in System Monitor

System Monitor identifies threads by process name and thread number. The order in which the threads appear on the chart depends on the order in which you add them to your chart. The thread number shown in the Instance box represents the order in which the threads started, and it can change even as the process runs.

Thread identifiers are valid only during the lifetime of the thread; they are recycled when the thread terminates. Thread numbers can change while running, so it is best to monitor by thread identifier. The Tlist utility provides thread identifier information. For information about Tlist, see Windows 2000 Support Tools Help. For information about installing and using the Windows 2000 Support Tools and Support Tools Help, see the file Sreadme.doc in the \Support\Tools folder of the Windows 2000 operating system CD.

If a process is multithreaded, adding a processor will help improve performance. If it is single-threaded, you can improve performance by using a faster processor. These solutions are more advanced and more relevant to developers who also might want to tune the problem applications.

© 1985-2000 Microsoft Corporation. All rights reserved.