Analyzing Processor Activity

If a system has a high rate of CPU use, it is generally best to add processing power by upgrading to a faster processor or to add a processor for symmetric multiprocessing (SMP). However, if you find that a thread is consistently unable to get processor time, you can adjust its priority to allow it to run temporarily. Adjusting thread priority is not recommended as a long-term solution but is a useful illustration of the effect of thread priority on thread activity. Although this section explains how to elevate a priority to allow a process to run, you can also lower the priority of a process if you want it to run in the background while nothing else is running.

Windows 2000 and the Windows 2000 Support Tools include several utilities for monitoring the base priority of processes and threads and the dynamic priority of threads. They include:

  • In Windows 2000: System Monitor and Task Manager.

  • In Support Tools, which is on the Windows 2000 operating system CD: Pviewer.
    caution-icon
    Caution
    Changing priorities might destabilize the system. Increasing the priority of a process might prevent other processes, including system services, from running. Decreasing the priority of a process might prevent it from running, not merely force it to run less frequently. In addition, lowering priority does not necessarily reduce the amount of processor time a thread receives; this happens only if it is no longer the highest-priority thread.

System Monitor

System Monitor lets you watch and record—but not change—the base and dynamic priorities of threads and processes. System Monitor has priority counters on the Process and Thread objects:

  • Process\ Priority Base

  • Thread\ Priority Base

  • Thread\ Priority Current

Figure 29.18 is a chart of the base priorities of several processes. The Idle process (the white line at the bottom of the chart) runs at a priority of Idle (0), so it never interrupts another process.

Cc958303.fned21(en-us,TechNet.10).gif

Figure 29.18 Processes and Their Base Priorities

Figure 29.19 is a chart of the dynamic priority of the single thread in the Paintbrush utility (Mspaint.exe) as it changes in response to user actions. The base priority of the thread is 8 (Foreground Normal). During this period of foreground use, the dynamic priority of the thread is 12, but drops to 8 when other processes need to run.

Cc958303.fned98(en-us,TechNet.10).gif

Figure 29.19 Processes Showing Base and Current Priorities

Task Manager

Task Manager presents and lets you change the base priority of a process, but it does not monitor threads. Base priorities that you change with Task Manager are effective only as long as the process runs. For more information, see Task Manager Help or see Overview of Performance Monitoring in this book.

important-icon

Important

To make this change, your user account must have permission to increase scheduling priority. By default, only user accounts in the Power User groups in Windows 2000 Professional have this permission.

To change the base priority of a process

  1. In Task Manager, click the Processes tab.

  2. Right-click a process name and its menu appears.

  3. Click Set Priority , and then click a new base priority.
    caution-icon
    Caution
    Problems can arise if multiple processes are running at the High priority class level. Avoid setting more than one process to run at this level.

The change in priority is effective at the next Task Manager update; you need not restart the process.

Process Viewer

Process Viewer (Pviewer.exe), one of the Support Tools on the Windows 2000 operating system CD, lets you monitor process and thread priority and change the base priority class of a process. 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.

Start Command

When you begin processes from a command prompt by using the start command, you can specify a base priority for the processes for that run. To see all of the start options, type start /? at the command prompt.

You can change the priority class of a process to Real Time by using start/realtime at the command prompt or by using Task Manager. Note that changing the priority from /normal to /high or to /realtime can severely degrade the performance of other tasks.

caution-icon

Caution

Setting a processor-bound application to Real Time priority could cause the computer to stop responding.