19-2 Chapter 19 Monitoring and Optimizing System Performance Lesson 1: Using Task Manager provides information about the programs and processes running on your computer and the performance of your computer. You can use Task Manager to start programs, to stop programs and processes, and to see a current view of your com- puter’s performance.

After this lesson, you will be able to ■ Monitor programs by using Task Manager ■ Monitor processes by using Task Manager ■ Monitor system performance by using Task Manager ■ Monitor networking by using Task Manager Estimated lesson time: 25 minutes

How to Monitor Programs Task Manager allows you to monitor applications and processes that are currently run- ning on your computer. It also provides information about the processes, including the memory usage of each one. It provides statistics about the memory and processor per- formance and network usage. You start Task Manager in any of the following ways:

■ Press CTRL+SHIFT+ESC ■ Right-click the Windows , and then click Task Manager

■ Press CTRL+ALT+DELETE

Note Provided your computer running Windows XP Professional is in a domain environment, you can start Task Manager by pressing CTRL+ALT+DELETE. However, if your computer is in a workgroup environment, you might need to start Task Manager by selecting it, depending on how the logon and logoff options are configured.

The Task Manager dialog box shown in Figure 19-1 has four tabs: Applications, Pro- cesses, Performance, and Networking. Lesson 1 Using Task Manager 19-3

F19us01 Figure 19-1 The Applications tab shows running applications and lets you terminate them.

You can use the buttons on the Applications tab of the Task Manager dialog box to stop a program from running (End Task), to switch to a program and bring the pro- gram into the foreground (Switch To), and to start a program (New Task). At the bot- tom of the display, Task Manager shows you the number of processes that are currently running, the CPU usage, and the memory usage. How to Monitor Processes The Processes tab in the Task Manager dialog box (see Figure 19-2) lists each process that is currently running on your computer that runs in its own address space, including all applications and system services. Task Manager also allows you to end processes.

F19us02 Figure 19-2 You can select the columns that appear on the Processes tab. 19-4 Chapter 19 Monitoring and Optimizing System Performance

By default, the Processes tab shows you the processes, the users running each process, and the CPU and memory usage for each process that is running. You can add addi- tional performance measures to those that are shown by default on the Processes tab. To add performance measures, on the View menu, click Select Columns (refer to Fig- ure 19-2). Table 19-1 describes the columns that are displayed in Task Manager by default and some of the columns that can be added to the Processes tab.

Table 19-1 Processes Tab Columns

Column Description Image Name The name of the process, displayed by default. PID (Process Identifier) The numeric identifier assigned to the process while it is running. User Name The name of the user that the process is running under, displayed by default. CPU Usage The percentage of time the threads of the process used the processor since the last update, displayed by default. If a process is consuming a large amount of processor time over a long period (other than when an application is first starting or is performing a particularly intensive task), the process might be having trouble. Try closing the application (by using the Applications tab). CPU Time The total processor time (in seconds) used by the process since it was started. Memory Usage The amount of memory (in kilobytes) used by the process, displayed by default. This column is particularly useful for determining which applications are using memory because it displays the total amount of physical and used by an application. If an application seems to be using too much memory, there might be a problem with the application. Try closing the application and restarting it (or restarting your computer and then restarting the application). Base Priority The order in which threads are scheduled for the processor. The base priority is not set by the ; it is set by the code. You can use Task Manager to change the base priority of processes. To change the base priority of a process, right-click the process and click Set Priority. Non-paged Pool The amount of memory (in kilobytes) that is used by a process; oper- ating system memory that is never paged (moved from memory) to disk. Paged Pool The amount of system-allocated virtual memory (in kilobytes) used by a process; virtual memory that can be paged to disk. Paging is the moving of infrequently used data from RAM to the paging file on the hard disk. Lesson 1 Using Task Manager 19-5

Table 19-1 Processes Tab Columns

Column Description

Page Faults The number of times that data had to be retrieved from the page file on the hard disk for this process because it had been paged out of physical memory. Windows XP Professional uses a page file stored on the hard disk to augment physical memory. When the physical memory is full, Windows swaps older information in physical mem- ory to the swap file to make room for newer information. Too many page faults often indicate that you need more physical memory. Peak Memory Usage The maximum amount of physical memory resident in a process since it started. Thread Count The number of threads running in the process. This column can be useful for troubleshooting multithreaded applications.

! Exam Tip For the exam, remember that Task Manager can show real-time information about the CPU, RAM, and virtual memory, but the measurements are fairly limited. To collect more detailed information, use the Performance console. The Performance console also allows you to collect performance data over a longer period.

How to Change the Base Priority of a Running Process

Changing the base priority of a process determines how much processor time Win- dows XP Professional devotes to the process compared with other processes. By default, most processes run at a base priority of Normal. However, you can change the base priority for a process by using the following steps:

1. In Task Manager, on the Processes tab, click the View menu and then click Select Columns. 2. In the Select Columns dialog box, select Base Priority and then click OK. The Base Priority column now appears in the Task Manager window. 3. Right-click the process for which you would like to change the base priority. 4. On the shortcut menu that appears, point to Set Priority, and then select one of the following commands: ❑ Realtime ❑ High ❑ AboveNormal ❑ Normal ❑ BelowNormal ❑ Low 19-6 Chapter 19 Monitoring and Optimizing System Performance

Caution You should change the priority of processes only when there is a process that needs priority over (or is less important than) other running processes; even then, you should try to use only the AboveNormal, Normal, and BelowNormal levels. Setting a process at too high a base priority (such as RealTime) can consume enough system resources that other vital processes cannot function properly.

How to Set Processor Affinity

Windows XP Professional can support two processors running on the same computer. When two processors are installed, Windows XP Professional does a good job of assigning processes to processors based on need. However, you can assign a particular process to a specific processor. (This is referred to as assigning processor affinity to a process; of course, it is available only on computers with two processors or on com- puters with a hyperthreaded processor in which multiple processes can run simulta- neously on one processor.)

To assign a process to a processor, use the following steps:

1. In Task Manager, on the Processes tab, right-click a process and then click Set Affinity. 2. In the Processor Affinity dialog box, select the processors on which the process should be allowed to run. By default, both processors (CPU 0 and CPU 1) are selected for a processor.

Caution Controlling processor affinity can improve performance by reducing the number of processor cache flushes that occur as threads move from one processor to another. This might be a good option for dedicated file servers. However, be aware that dedicating a pro- gram to a particular processor might not allow other program threads to migrate to the least- busy processor.

How to Monitor System Performance You can use the Performance tab in the Task Manager dialog box (see Figure 19-3) to see a current overview of system performance that includes information about the CPU (or CPUs on a computer with two processors), physical memory, and virtual memory. Lesson 1 Using Task Manager 19-7

F19us03 Figure 19-3 The Performance tab provides real-time performance data about the CPU, RAM, and virtual memory.

Table 19-2 describes the fields that are displayed by default on the Performance tab in Task Manager.

Table 19-2 Performance Tab Fields

Field Description CPU Usage The percentage of time that the processor is busy. If this graph displays a high percentage continuously (and not when there is an obvious reason, such as a big application), your processor might be overloaded. If your computer has two processors, two graphs are shown. If this value runs continuously over 80 percent, you probably see a noticeable improve- ment in performance if you upgrade your processor. CPU Usage History The percentage of time that the processor is running a thread other than the idle thread shown over time. You can use the Update Speed com- mand on the View menu to specify how often the values are refreshed. The High value updates about twice per second; Normal value updates once every two seconds; Low value updates once every four seconds. You can also pause the updates and update the view manually by press- ing F5. This is a useful method if you want to monitor some specific activity. Note that Task Manager itself uses processor time. The more fre- quently you update the display, the more processor time it uses, which throws off the accuracy of whatever you are analyzing. PF Usage The amount of virtual memory used (in MB). Page File Usage The amount of virtual memory used, shown over time. Values set using History the Update Speed command affect this history as well. 19-8 Chapter 19 Monitoring and Optimizing System Performance

Table 19-2 Performance Tab Fields

Field Description

Total: Handles The number of object handles in the tables of all processes. A handle represents a specific input/output (I/O) instance of a thread. Threads The number of running threads, including one idle thread per processor. A thread is an object within a process that runs program instructions. Processes The number of active processes, including the idle process. A process can have multiple threads, each of which in turn can have multiple han- dles. Physical Memory (K): The amount of physical RAM installed in the computer. Total Available The amount of physical memory available to processes. System Cache The amount of physical memory released to the file cache on demand. Commit Charge: The size of virtual memory in use by all processes. Total Limit The amount of virtual memory that can be committed to all processes without enlarging the paging file. Peak The maximum amount of virtual memory used in the session. Paged The size of the paged pool allocated to the operating system. The paged pool is data in physical memory that can be written to the page file if Windows needs to make space in physical memory for other data. Nonpaged The size of the nonpaged pool allocated to the operating system. Win- dows cannot page all memory to a page file. In particular, many threads created by the Windows kernel cannot be paged. Kernel Memory (K): The sum of the paged and nonpaged memory. Total

Note When Task Manager is running, Windows XP Professional displays an accurate minia- ture CPU usage icon on the taskbar. If you point to the icon, Task Manager displays the per- centage of processor usage in text format.

How to Monitor Networking The Networking tab in Task Manager, shown in Figure 19-4, displays a visual interpre- tation of the current network traffic on various network connections on the computer. Although it is possible to get an idea about network performance from this tab, it is actually more useful for giving you a quick snapshot of network availability on each connection configured on your computer. Lesson 1 Using Task Manager 19-9

F19us04 Figure 19-4 The Networking tab of Task Manager shows current network activity.

By default, the graph of network activity for each connection scales dynamically to show how much network utilization there is when compared with the theoretical max- imum for the connection. For example, on a 100 Mbps connection, when there is no network activity on a connection, the vertical scale on the graph shows the values 0 percent, .5 percent, and 1 percent of the theoretical maximum. As network activity increases, the graph scales to show a greater percentage—up to 100 percent, indicating the full 100 Mbps potential. Because most use this tab not to measure the exact network throughput, but rather to see whether there is network throughput (and some- times what the maximum value is), this scale can be rather confusing. Fortunately, you have two options for controlling the way Task Manager displays the graph:

■ On the Options menu, click Show Scale to turn the vertical display of the scale on and off. ■ On the Options menu, click Auto Scale to turn the automatic scaling on and off. When the Auto Scale option is turned off, the graph always shows a range of 0 to 100 percent. This is usually a more useful view, unless you are trying to see very small amounts of network utilization.

The detailed information at the bottom of the tab displays current percent of network utilization and the theoretical link speed for each enabled adapter. When viewing the current percent of network utilization, you should keep the following in mind:

■ On wired Ethernet connections, you can usually expect to see a peak utilization value of 60 to 80 percent. ■ On wireless connections, you can expect to see peak utilizations of 30 to 50 per- cent, depending mostly on position of the wireless access point and structural interference (such as walls, heating ducts, or other devices). 19-10 Chapter 19 Monitoring and Optimizing System Performance

When viewing network utilization and trying to figure out whether your connection is living up to its capacity, do not expect to see 100 percent utilization, even on the best of connections. However, if you see utilization considerably below the peak values listed previously, you should investigate the connection for potential problems. Practice: Using Task Manager In this practice, you use Task Manager to monitor programs, processes, and system performance. You use Task Manager to start a program and to stop a program. Finally, you add new columns to the Processes tab.

1. If necessary, log on with a user account that is a member of the Administrators group. 2. Press Ctrl+Shift+Esc to launch Task Manager. 3. Click the Applications tab. Which programs are currently running on your computer?

4. Click New Task. Windows XP Professional displays a Create New Task dialog box. 5. In the Open text box, type .exe and click OK. WordPad should start and be listed as a running application. 6. Click the Processes tab. 7. How many processes are running?

8. On the View menu, click Select Columns. The Select Columns dialog box appears. 9. Click Peak Memory Usage, and then click Page Faults. Click OK. Two new columns, Peak Memory Usage and Page Faults, are added to the Pro- cesses tab display. You might need to maximize Task Manager to see all columns. 10. Click the Performance tab. 11. What percentage of your CPU’s capacity is being used?

12. Do you think that your CPU could be slowing down the performance on your computer?

13. Click the Applications tab. Lesson 1 Using Task Manager 19-11

14. Click WordPad, and then click End Task. WordPad closes and is removed from the list of running applications. 15. Close Task Manager. Lesson Review Use the following questions to help determine whether you have learned enough to move on to the next lesson. If you have difficulty answering these questions, review the material in this lesson before beginning the next lesson. You can find answers to these questions in the “Questions and Answers” section at the end of this chapter.

1. Which of the following methods can you use to start Task Manager? (Choose all that apply.)

a. Press CTRL+ALT+ESC b. Right-click the Desktop, and then click Task Manager

c. Press CTRL+SHIFT+ESC

d. Press CTRL+ALT+DELETE, and if necessary, click Task Manager 2. Which of the following tabs can be found in Task Manager? (Choose all that apply.) a. Networking tab b. Programs tab c. Processes tab d. General tab 3. What are page faults? Do you think a larger or smaller number of page faults indi- cates better system performance? Why?

4. What does CPU usage represent? In general, is system performance better with a high CPU usage value or a low value? 19-12 Chapter 19 Monitoring and Optimizing System Performance Lesson Summary ■ Use the Applications tab of Task Manager to stop a program, switch to a program, and start a program. ■ Use the Processes tab of Task Manager to view running processes. You can also end processes from the Processes tab. ■ Use the Performance tab of Task Manager to view real-time performance informa- tion about your CPU, RAM, and virtual memory. ■ Use the Networking tab of Task Manager to view current network traffic on vari- ous network connections on the computer.