Observing Processor Consumption by Multiple Processes

Figure 7.7 shows a histogram of processor time for many active processes. This example was produced by running two instances of CPU Stress, which consumes processor cycles at the priority and activity levels you specify.

Cc938596.FNED09(en-us,TechNet.10).gif

Figure 7.7 Processor Time for Multiple Active Processes

In this example, two processes are consuming the processor while sharing it nearly equally. Although each process is using only 45 percent of the processor, the result is the same as a single process using 90 percent of processor time.

Figure 7.8 shows System\Processor Queue Length during this bottleneck.

Cc938596.FNED10(en-us,TechNet.10).gif

Figure 7.8 Processor Queue Length During Activity of Many Processes

In Figure 7.8, Processor\% Processor Time for all processes is close to 100 percent during the sample interval. System\Processor Queue Length reveals a long queue, averaging over six threads.

Figure 7.9 shows Task Manager during the same bottleneck. It shows that two CPU Stress processes are each using about half of the time of the single processor on the computer. (Task Manager shows current values, so you need to watch the display to see changes in processor use for each process.)

Cc938596.FNED11(en-us,TechNet.10).gif

Figure 7.9 CPU Usage for Multiple Processes in Task Manager

At this point, you can choose to add a processor or upgrade the one you have, or you can investigate the activity further by researching thread behavior. Although a faster processor might help this situation somewhat, multiple-process bottlenecks are best resolved by adding another processor. Multithreaded processes, including multithreaded Windows 2000 services, benefit the most from additional processors because their threads can run simultaneously on multiple processors. You might want to partition the processes among the processors for optimal efficiency. For more information, see "Measuring Multiprocessor System Activity" in this book.

To find out more about how a particular process uses the processor, examine the Process\% User Time and Process\% Privileged Time counters, followed by Thread object counters, as described in the following section.

For more information about determining if your application is multithreaded, see "Threads in a Bottleneck" later in this chapter. You might also want to find out whether all threads in a multithreaded process are active during bottlenecks. The benefit of adding processors depends on whether you have a lot of active ** threads. You could find, as a result of monitoring, that threads in a process are inactive most of the time, so adding a processor to handle these inactive threads is a waste of money and capacity.

For more information about the benefits of adding processors to manage a larger workload (called scaling) and how to determine whether scaling is appropriate, see "Measuring Multiprocessor System Activity" in this book.