Analyzing Processor Activity

Previous Topic Next Topic

Determining and Tuning Priority

If a system has high rate of CPU utilization, 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 some threads are consistently unable to get processor time, you can adjust the thread's priority to allow them 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 covers elevating 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 Resource Kit companion CD include several utilities for monitoring the base priority of processes and threads and the dynamic priority of threads. They include:


warning-icon

Warning

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:

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

Figure 7.18    Processes and Their Base Priorities
Enlarge figure

Figure 7.18 Processes and Their Base Priorities

Figure 7.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 14, but drops to 8 when other processes need to run.

Figure 7.19    Processes Showing Base and Current Priorities
Enlarge figure

Figure 7.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 changed with Task Manager are effective only as long as the process runs. For more information, see Task Manager online Help or see "Overview of Performance Monitoring" in this book.


important-icon

Important

In order to make this change, your user account must have permission to increase scheduling priority. By default, only user accounts in the Domain Admins or Administrator groups in Windows 2000 Server or 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. 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 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 cause severe degradation of performance of other tasks. Note also that setting a processor-bound application to Real Time priority could cause the computer to stop responding.

© 1985-2000 Microsoft Corporation. All rights reserved.