Now that we've established a baseline performance
level for the hardware components and software that make up a Windows 7
PC and introduced the major diagnostic tools, it's time to look more
closely at techniques and settings that can improve performance. In this
section, we cover the following basic performance-enhancing strategies:
Ensuring that you have adequate RAM
Ensuring that you have an adequate virtual-memory configuration
Tuning and troubleshooting SuperFetch
Using ReadyBoost to compensate for a slow hard disk
Managing startup programs and services
Keeping your disks defragmented
Maintaining adequate free space on your disks
Avoiding tweaks of dubious value
1. Ensuring That You Have Adequate RAM
Random access memory
(RAM) is the vital stuff that keeps Windows running smoothly. Having
enough physical (main) memory helps reduce the operating system's
dependence on virtual memory, thereby maximizing the number of times
Windows is able to fetch information from fast memory chips and
minimizing the number of times it has to get data from your (relatively
slow) hard disk. How much memory do you need?
Microsoft's official hardware requirements for Windows 7 specify that a system must have at least 1 GB of RAM
to run 32-bit Windows, and 2 GB if you plan to install 64-bit Windows.
In our experience, doubling these minimums will provide a better ride
for most installations.
But don't assume that more memory
is always better. As it turns out, there is such a thing as too much
memory, especially if you're running a 32-bit Windows version. First,
there's the question of how much RAM (how many memory modules and in
what sizes) your computer will physically accommodate. And then there's a
hard mathematical limitation: because of the nature of address spaces,
32-bit versions of Windows can use no more than 3.5 GB of RAM, and often
considerably less. The exact amount varies depending on the hardware in
question; for more details see Knowledge Base article 929605, "The
system memory that is reported in the System Information dialog box in
Windows Vista is less than you expect if 4 GB of RAM is installed," at w7io.com/929605. (Although the title specifically refers to Windows Vista, the information applies equally to Windows 7.)
With a 64-bit version of
Windows 7, this limitation on physical memory vanishes, to be replaced
by limits that are defined differently for each edition of Windows. Table 1 has the details for all editions.
Table 1. Physical Memory Limitations in Windows 7
Windows 7 Edition | Limit in 32-Bit Windows | Limit in 64-Bit Windows |
---|
Starter | 4 GB | 8 GB |
Home Basic | 4 GB | 8 GB |
Home Premium | 4 GB | 16 GB |
Professional | 4 GB | 192 GB |
Enterprise/Ultimate | 4 GB | 192 GB |
A computer running a 32-bit (x86) version of Windows can
address a maximum of 3.5 GB of physical memory. In Windows 7, the System
Properties dialog box displays two values when it encounters a
discrepancy between the amount of addressable memory and the amount of
physical RAM installed. Thus, on a system with 4 GB of physical RAM, the
value reported under the System heading for Installed Memory (RAM) will
show 4.00 GB (3.50 GB Usable); the second value might be less,
depending on your hardware configuration.
|
Memory management is confusing, perhaps more so than any other aspect of PC performance.
If you scour the web for information on this topic, you will surely run
into misguided advice and technical errors. Knowing the meaning of the
following specialized memory-measurement terms helps you make sense of
it all:
Physical memory refers to actual RAM
chips or modules, typically installed on a computer's motherboard. The
amount of physical RAM available to Windows might be less than the total
physical amount if another system component is using that memory for
its own purposes, as is the case with "shared memory" video subsystems
on portable computers. Physical memory measurements (total and in use)
are reported on the Performance tab of Windows Task Manager and on the
Memory tab of Resource Monitor.
Virtual memory
consists of physical memory plus the amount of space in the page file,
which is stored on the hard disk. We discuss virtual memory in more
detail in the next section, Section 20.3.2 on Section 20.3.2.
Kernel memory is owned by Windows and is used to provide system services to applications. Paged memory can be backed up to the page file and replaced by application memory if necessary; nonpaged memory must remain in physical RAM at all times.
Cached memory
holds data or program code that has been fetched into memory during the
current session but is no longer in use now. If necessary, the Windows
memory manager will flush the contents of cached memory to make room for newly summoned data.
Free memory represents RAM that does not contain any data or program code and is free for use immediately.
Working Set
is the term that defines the amount of memory currently in use for a
process. Private Working Set is the amount of memory that is dedicated
to that process and will not be given up for other programs to use;
Shareable Working Set can be surrendered if physical RAM begins to run
scarce. Peak Working Set is the highest value recorded for the current
instance of this process.
Commit Charge (also called commit size)
is the total amount of virtual memory that a program has touched
(committed) in the current session, including memory that has been paged
out of physical memory to the disk-backed page file. The Memory and
Physical Memory counters on Task Manager's Performance tab represent the
sum of this value for all processes and the kernel. The Commit Charge
Limit is the total amount of physical RAM and page file available—in
other words, the maximum virtual memory.
Hard faults are also known as page faults.
Despite the negative connotation of the name, this is not an error
condition. Rather, it represents an instance where a block of memory
needed by the operating system or an application has to be fetched from
the page file on the hard disk instead of from physical memory. A
consistently high number of hard faults per second indicates a large—perhaps excessive—reliance on virtual memory, with consequent adverse performance effects.
The best way to gauge the adequacy of your currently installed RAM is to keep an eye on the Memory graph in Resource Monitor.
The green portion of the bar indicates the percentage of your physical
memory that's currently in use; shades of blue indicate cached memory
that is available on demand (Standby). It's also important to watch the
green line on the graphs to the right, which indicates the number of
hard faults per second your system is generating; if you see it spike
off the top of the graph for extended periods of time, you'll want to
take a closer look at how memory is being used.
Pay special attention to
these numbers when you're asking the most of your computer; you might
even consider performing a stress test by successively opening the
applications you use most often. Switch between programs, open and edit
some data files, browse a couple dozen webpages, and generally try to
use more system resources than you can imagine using at one time under
normal circumstances. If you find yourself bumping up against the
ceiling regularly, you might get a noticeable performance boost from additional RAM.
Don't get hung up
on mere percentages, though. If you routinely hit a maximum of 85
percent memory usage on a machine running 64-bit Windows 7 with 6 GB of
physical RAM, you have 900 MB of free RAM, which is plenty of headroom.
2. Ensuring That You Have an Adequate Virtual-Memory Configuration
Physical memory might be the
vital lubricant of a happily humming Windows machine, but Windows is not
designed to run on RAM chips alone, no matter how many of them you
have. In addition to using physical RAM to store programs and data,
Windows creates a hidden file on your primary hard disk and uses that
file to manage pages of data pulled from scattered sections of the hard
disk and used in physical memory when necessary. The page file acts as an extension of main memory—or, in other words, as virtual memory.
In olden days (especially
in the early to mid 1990s), the memory manager's disk-backed storage was
commonly called the "swap file," because its primary use was to
overcome physical memory shortages. Today, the page file is an integral
part of memory management, used by SuperFetch and the boot prefetcher to optimize your system for performance.
In Windows 7, Microsoft has chosen to deemphasize visible measurements of page file usage in common performance-monitoring tools. The Commit
fraction in the lower right corner of Windows Task Manager's
Performance tab is useful for helping you gauge the adequacy of your virtual
memory setup. Note, however, that while the numerator of the fraction
indicates how much virtual memory your system is currently using, the
denominator reports the sum of physical memory and current page-file
size.
In a default
installation, Windows creates the page file in the root folder on the
same drive that holds the Windows system files. The size
of the page file is determined by the amount of RAM in your system. By
default, the minimum size on a 32-bit (x86) system is 1.5 times the
amount of physical RAM if physical RAM is less than 1 GB, and equal to
the amount of physical RAM plus 300 MB if 1 GB or more is installed. The
default maximum size is three times the amount of RAM, regardless of
how much physical RAM is installed. On a PC with a processor that
supports Physical Address Extension (PAE)—which is to say, on any PC
that is capable of running Windows 7—the maximum size of the page file
is 16 TB. That amount of disk space will no doubt seem horribly
confining someday, perhaps even in our lifetimes, but for now it's more
than enough. You can see the page file in a Windows Explorer window if
you configure Windows to show hidden and system files; look for
Pagefile.sys in the root of your system drive.
To see the current
configuration of your system's virtual memory, open the System dialog
box in Control Panel and click the Advanced tab. (For an excellent,
undocumented shortcut to this dialog box, click Start, type systempropertiesadvanced
with no spaces, and press Enter.) Under the Performance heading, click
Settings. In the Performance Options dialog box, click the Advanced tab
and (finally!) under the Virtual Memory heading, click Change. Figure 1
shows the Virtual Memory dialog box, with default settings for a
machine with 2 GB of RAM (default, that is, except that we cleared the
Automatically Manage Paging File Size For All Drives check box to make
the rest of the dialog box easier to read).
By default, Windows
creates a single page file in the root folder on the same volume that
holds the Windows system files and manages its size for you. The
Currently Allocated number near the bottom of the dialog box shows you
how large the file is now. If conditions on your system change (you run
an unusually large assortment of memory-intensive applications, for
example), Windows might expand the page file. It might then return the
file to its original size (or a smaller size) if the demand subsides.
All this happens without intervention or notification if you leave the
Automatically Manage Paging File Size For All Drives check box selected.
If you don't want Windows to do this for you, you have the following options:
You can move the page file to a different volume if you have more than one.
If you have more than one volume, you can establish more than one page file.
For any page file, you can choose between System Managed Size and Custom Size.
If you choose Custom Size, you can specify an initial size and a maximum size.
You
can remove a paging file from a volume by selecting the volume and
choosing No Paging File. (You can even get rid of all paging files this
way, although doing so is not recommended, even on systems with a lot of
RAM.)
Should you get involved in page-file management, and, if so, how?
If you have more than
one physical disk, moving the page file to a fast drive that doesn't
contain your Windows system files is a good idea. Using multiple page
files split over two or more physical disks is an even better idea,
because your disk controller can process multiple requests to read or
write data concurrently. Don't make the mistake of creating two or more
page files using multiple volumes on a single physical disk, however. If
you have a single hard disk that contains C, D, and E volumes, for
example, and you split the page file over two or more of these, you
might actually make your computer run more slowly than before.
In that configuration, the heads on the physical disk have to do more
work, loading pages from different portions of the same disk
sequentially, rather than loading data from a single contiguous region
of the hard disk.
If you are short of hard
disk space, you might consider setting a smaller initial page file size.
Monitor peak usage levels over time; if the peak is well below the
current page file size, you can consider reducing the initial size to
save disk space. On the other hand, if you're not short of disk space,
there's nothing to be gained from doing this and you might occasionally
overload your custom settings, thereby degrading the performance of your system.
Should you enlarge your page
file? Most users won't need to do this. But you might want to keep an
eye on the green line in the Memory chart on the Overview tab of
Resource Monitor .
If that line is spiking off the top of the graph a great deal of the
time during your normal work, you might consider increasing the maximum
size of your page file. (Disregard page file spikes and disk activity in
general that takes place while you're not actually working. This is
likely to be the result of search indexing, defragmentation, or other
background processes and does not indicate a problem with your actual
work performance.)
Note:
For an extremely detailed discussion of virtual
memory page file management in Windows Vista, we recommend the blog
post "Pushing the Limits of Windows: Virtual Memory?" by Microsoft
Technical Fellow Mark Russinovich, at w7io.com/2004.