Tuning Windows 7`s Performance

Tuning Windows 7`s Performance
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
CHAPTER
6
Tuning Windows 7’s
Performance
IN THIS CHAPTER
. Monitoring Performance
. Optimizing Startup
. Optimizing Applications
. Optimizing the Hard Disk
. Optimizing Virtual Memory
Now, here, you see, it takes all the running you can do, to stay in
the same place. If you want to get somewhere else, you must run
at least twice as fast as that!
—Lewis Carroll, Through the Looking Glass
We often wonder why our workaday computer chores
seem to take just as long as they ever did, despite the fact
that hardware is generally more reliable and more powerful
than ever. The answer to this apparent riddle comes in the
form of McFedries’ law of computing codependence: The
increase in software system requirements is directly proportional
to the increase in hardware system capabilities. For example,
imagine that a slick new chip is released that promises a
10% speed boost; software designers, seeing the new chip
gain wide acceptance, add 10% more features to their
already bloated code to take advantage of the higher performance level. Then another new chip is released, followed
by another software upgrade—and the cycle continues ad
nauseum as these twin engines of computer progress lurch
codependently into the future.
So, how do you break out of the performance deadlock
created by the immovable object of software code bloat
meeting the irresistible force of hardware advancement? By
optimizing your system to minimize the effects of overgrown applications and to maximize the native capabilities
of your hardware. Of course, it helps if your operating
system gives you a good set of tools to improve and monitor
performance, diagnose problems, and keep your data safe.
Windows XP came with a decent set of client tools, Vista
improved on them (although not with anything radically
new or earth shattering), and Windows 7 stays the course.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
112
CHAPTER 6
Tuning Windows 7’s Performance
Monitoring Performance
Performance optimization is a bit of a black art in that every user has different needs,
every configuration has different operating parameters, and every system can react in a
unique and unpredictable way to performance tweaks. That means if you want to optimize your system, you have to get to know how it works, what it needs, and how it reacts
to changes. You can do this by just using the system and paying attention to how things
look and feel, but a more rigorous approach is often called for. To that end, the next few
sections take you on a brief tour of Windows 7’s performance monitoring capabilities.
Viewing Your Computer’s Performance Rating
Like Windows Vista, Windows 7 tailors certain aspects of itself to the capabilities of the
system on which you’re installing it. For example, the Windows 7 interface changes
depending on the graphics hardware on the machine, with low-end machines getting the
Windows 7 Basic theme, and high-end GPUs getting the full Aero treatment.
But Windows 7 also scales other aspects up or down to suit its hardware home. With
games, for example, Windows 7 enables certain features only if the hardware can support
them. Other features scaled for the computer’s hardware are TV recording (for example,
how many channels can it record at once?) and video playback (for example, what is the
optimal playback size and frame rate that doesn’t result in dropped frames?).
The tool that handles all of this, not only for Windows 7 itself but also for third-party
programs, is the Windows System Assessment Tool, or WinSAT. This tool runs during
setup, and again whenever you make major performance-related hardware changes to
your system. It focuses on four aspects of your system performance: graphics, memory,
processor, and storage. For each of these subsystems, WinSAT maintains a set of metrics
stored as an assessment in XML format. Windows 7 needs to examine only the latest
assessment to see what features the computer can support. Note, too, that third-party
programs can use an application programming interface that gives them access to the
assessments, so developers can tune program features depending on the WinSAT metrics.
Five metrics are used:
. Processor—This metric determines how fast the system can process data. The
Processor metric measures calculations per second processed.
. Memory (RAM)—This metric determines how quickly the system can move large
objects through memory. The Memory metric measures memory operations per
second.
. Graphics—This metric determines the computer’s capability to run a composited
desktop like the one created by the Desktop Window Manager. The Graphics metric
expresses frames per second.
. Gaming Graphics—This metric determines the computer’s capability to render 3D
graphics, particularly those used in gaming. The Gaming Graphics metric expresses
effective frames per second.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Monitoring Performance
113
. Primary Hard Disk—This metric determines how fast the computer can write to
and read from the hard disk. The Primary Hard Disk storage metric measures
megabytes per second.
In addition to WinSAT, Windows 7 comes with the Performance Rating tool that rates
your system based on its processor, RAM, hard disk, regular graphics, and gaming graphics. The result is the Windows Experience Index base score.
To launch this tool, select Start, type performance, and then click Performance
Information and Tools in the search results. In the Performance Information and Tools
window, if you see a button named Rate this Computer, click that button to run the initial
assessment.
As you can see in Figure 6.1, Windows 7 supplies a subscore for each of the five categories
and calculates an overall base score. You can get a new rating (for example, if you change
performance-related hardware) by clicking the Re-run the Assessment link.
6
FIGURE 6.1 Windows 7 calculates a Windows System Performance Rating based on five
categories.
Interpreting the ratings is a bit of a black art, but I can tell you the following:
. In general, the higher the rating, the better the performance.
. The lowest possible value is 1.0.
. The highest possible value is 7.9 (up from 5.9 in Windows Vista, which is a reflection of hardware improvements over the past few years).
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
114
CHAPTER 6
Tuning Windows 7’s Performance
. The base score takes a weakest-link-in-the-chain approach. That is, you could have
nothing but 5.0 scores for everything else, but if you get just 1.0 because your notebook can’t do gaming graphics, your base score will be 1.0.
Monitoring Performance with Task Manager
The Task Manager utility is excellent for getting a quick overview of the current state of
the system. To get it onscreen, press Ctrl+Alt+Delete to open the Windows Security screen
and then click the Start Task Manager link.
TIP
To bypass the Windows Security screen, either press Ctrl+Shift+Esc, or right-click an
empty section of the taskbar and click Start Task Manager.
The Processes tab, shown in Figure 6.2, displays a list of the programs, services, and
system components currently running on your system. (By default, Windows 7 shows just
the process you have started. To see all the running processes, click Show Processes from
All Users.) The processes display in the order in which they were started, but you can
change the order by clicking the column headings. (To return to the original, chronological order, you must shut down and restart Task Manager.)
FIGURE 6.2 The Processes tab lists your system’s running programs and services.
In addition to the image name of each process, the user who started the process, and a
description of the process, you see two performance measures:
. CPU—The values in this column tell you the percentage of CPU resources that each
process is using. If your system seems sluggish, look for a process consuming all or
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Monitoring Performance
115
nearly all the resources of the CPU. Most programs will monopolize the CPU occasionally for short periods, but a program that is stuck at 100 (percent) for a long
time most likely has some kind of problem. In that case, try shutting down the
program. If that doesn’t work, click the program’s process and then click End
Process. Click the Yes button when Windows 7 asks whether you’re sure that you
want to do this.
. Memory—This value tells you approximately how much memory a process is using.
This value is less useful because a process might genuinely require a lot of memory
to operate. However, if this value is steadily increasing for a process that you’re not
using, it could indicate a problem and you should shut down the process.
TIP
The four default columns in the Processes tab aren’t the only data available to you.
Select the View, Select Columns command to see a list of more than two dozen items
that you can add to the Processes tab.
The Performance tab, shown in Figure 6.3, offers a more substantial collection of performance data, particularly for that all-important component, your system’s memory.
6
FIGURE 6.3 The Performance tab lists various numbers related to your system’s memory
components.
The graphs show you both the current value and the values over time for the CPU usage
(the total percentage of CPU resources that your running processes are using) and the
physical memory usage. Below the graphs are various numbers. Here’s what they mean:
. Physical Memory Total—The total amount of physical RAM in your system.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
116
CHAPTER 6
Tuning Windows 7’s Performance
. Physical Memory Cached—The amount of physical RAM that Windows 7 has set
aside to store recently used programs and documents.
. Physical Memory Free—The amount of physical RAM that Windows 7 has available for your programs. Note that Windows 7 does not include the system cache
(refer to the previous item) in this total.
. Kernel Memory Paged—The amount of kernel memory mapped to pages in
virtual memory.
. Kernel Memory Nonpaged—The amount of kernel memory that cannot map to
pages in virtual memory.
. System Handles—The number of object handles used by all running processes. A
handle is a pointer to a resource. For example, if a process wants to use a particular
service offered by a particular object, the process asks the object for a handle to that
service.
. System Threads—The number of threads used by all running processes. A thread is
a single processor task executed by a process, and most processes can use two or
more threads at the same time to speed up execution.
. System Processes—The number of processes currently running (that is, the
number of items you see in the Processes tab if you activate the Show Processes from
All Users control).
. System Up Time—The number of days, hours, minutes, and seconds that you have
been logged on to Windows 7 in the current session.
. System Commit (MB)—The minimum and maximum values of the page file.
What is a page file? Your computer can address memory beyond the amount physically installed on the system. This nonphysical memory is virtual memory implemented by setting up a piece of your hard disk to emulate physical memory. This
hard disk storage is actually a single file called a page file (or sometimes a paging file
or a swap file). When physical memory is full, Windows 7 makes room for new data
by taking some data that’s currently in memory and swapping it out to the page file.
Here are two notes related to these values that will help you monitor memory-related
performance issues:
. If the Physical Memory Free value approaches zero, it means your system is starving
for memory. You might have too many programs running or a large program is
using lots of memory.
. If the Physical Memory Cached value is much less than half the Physical Memory
Total value, it means your system isn’t operating as efficiently as it could because
Windows 7 can’t store enough recently used data in memory. Because Windows 7
gives up some of the system cache when it needs RAM, close down programs you
don’t need.
In all of these situations, the quickest solution is to reduce the system’s memory footprint
by closing either documents or applications. For the latter, use the Processes tab to determine
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Monitoring Performance
117
which applications are using the most memory and shut down the ones you can live
without for now. The better, but more expensive, solution is to add more physical RAM to
your system. This decreases the likelihood that Windows 7 will need to use the paging file,
and it enables Windows 7 to increase the size of the system cache, which greatly improves
performance.
TIP
If you’re not sure which process corresponds to which program, display the Applications
tab, right-click a program, and then click Go to Process. Task Manager displays the
Processes tab and selects the process that corresponds to the program.
Using the Resource Monitor
Windows 7 comes with a new tool for monitoring your system yourself: the Resource
Monitor. (It’s actually a standalone (and revamped) version of the Resource Monitor
from Windows Vista.) You load this tool by selecting Start, typing monitor, and then
clicking Resource Monitor in the search results. Figure 6.4 shows the window that
appears.
6
FIGURE 6.4 The new Resource Monitor enables you to monitor various aspects of your
system.
The Resource Monitor is divided into five tabs:
. Overview—This section shows a couple of basic metrics in four categories: CPU,
Disk, Network, and Memory, as well as graphs that show current activity in each of
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
118
CHAPTER 6
Tuning Windows 7’s Performance
these categories. To see more data about a category (as with the CPU category in
Figure 6.4), click the downward-pointing arrow on the right side of the category
header.
. CPU—This section (see Figure 6.5) shows the CPU resources that your system is
using. In two lists named Processes and Services, you see for each item the current
status (such as Running), the number of threads used, the CPU percentage currently
being used, and the average CPU percentage. You also get graphs for overall CPU
usage, service CPU usage, and CPU usage by processor (or by core).
FIGURE 6.5 The CPU tab breaks down CPU usage by processes and by services.
. Memory—This tab displays a list of processes and for each one it shows the average
number of hard memory faults per minute, the total memory committed to the
process, the working set (the number of kilobytes resident in memory), the amount of
shareable memory (memory that other processes can use if needed), and the amount
of private memory (memory that is dedicated to the process and cannot be shared).
NOTE
A memory fault does not refer to a physical problem. Instead, it means that the system
could not find the data it needed in the file system cache. If it finds the data elsewhere
in memory, it is a soft fault; if the system has to go to the hard disk to retrieve the
data, it is a hard fault.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Monitoring Performance
119
. Disk—This tab shows the total hard disk I/O transfer rate (disk reads and writes in
bytes per minute), as well as separate read and write transfer rates.
. Network—This tab shows the total network data transfer rate (data sent and received
in bytes per minute).
Using the Performance Monitor
The Performance Monitor provides you with real-time reports on how various system
settings and components are performing. You load it by selecting Start, typing
performance, and then pressing Enter to choose Performance Monitor in the search
results. In the Performance Monitor window, open the Monitoring Tools branch and click
Performance Monitor.
Performance Monitor displays real-time data using performance counters, which are
measurements of system activity or the current system state. For each counter,
Performance Monitor displays a graph of recent values over a time space (the default time
space is 100 seconds), as well as statistics such as the average, maximum, and minimum
values over that span.
By default, Performance Monitor doesn’t show any counters. To add one to the
Performance Monitor window, follow these steps:
2. To use the Available Counters list, click the downward-pointing arrow beside a
counter category (such as Memory, Paging File, or Processor). A list of available
counters appears.
3. Select the counter you want to use. (If you need more information about the item,
activate the Show Description check box.)
4. If the counter has multiple instances, they appear in the Instances of Selected Object
list. Click the instance you want to use.
5. Click Add.
6. Repeat steps 2–5 to add any other counters you want to monitor.
7. Click OK.
The counter appears at the bottom of the window (see Figure 6.6). A different-colored line
represents each counter, and that color corresponds to the colored lines shown in the
graph. Note, too, that you can get specific numbers for a counter—the most recent value,
the average, the minimum, and the maximum—by clicking a counter and reading the
boxes just below the graphs. The idea is that you should configure Performance Monitor
to show the processes you’re interested in (page file size, free memory, and so on) and
then keep it running while you perform your normal chores. By examining the
Performance Monitor readouts from time to time, you gain an appreciation of what is
typical on your system. If you run into performance problems, you can check Performance
Monitor to see whether you’ve run into any bottlenecks or anomalies.
6
1. Right-click anywhere inside the Performance Monitor and then click Add Counters.
The Add Counters dialog box appears.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
120
CHAPTER 6
Tuning Windows 7’s Performance
FIGURE 6.6 Use Performance Monitor to keep an eye on various system settings and components.
Performance Monitor has a few new features that make it easier to use and a more powerful diagnostics tool:
. If you’re using a counter with a significantly different scale, you can scale the output
so that the counter appears within the graph. For example, the graph’s vertical axis
runs from 0 to 100; if you’re displaying a percentage counter, the Scale value is 1.0,
which means the graph numbers correspond directly to the percentages (50 on the
graph corresponds to 50%). If you’re also showing, say, the Commit Limit counter,
which shows values in bytes, the numbers can run in the billions. The Commit
Limit counter’s Scale value is 0.00000001, so the value 20 on the graph corresponds
to 2 billion bytes.
. You can save the current graph as a GIF image file: right-click the graph and then
click Save Image As.
. You can toggle the display of individual counters on and off. You do this by toggling
the check boxes in the Show column.
. You can change the duration of the sample (the number of seconds of data that
appear on the chart). Right-click the chart, click Properties, click the General tab, and
then modify the Duration value. You can specify a value between 2 and 1,000 seconds.
. You can see individual data points by hovering the mouse over a counter. After a
second or two, Performance Monitor displays the counter name, the time and date
of the sample, and the counter value at that time (refer to Figure 6.6).
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Optimizing Startup
121
Data Collector Sets
A data collector is a custom set of performance counters, event traces, and system-configuration data that you define and save so that you can run and view the results any time
you need them. You can configure a data collector set to run for a preset length of time or
until the set reaches a specified size. You can also configure a data collector to run on a
schedule. For example, you could run the data collector every hour for 15 minutes from 9
a.m. to 5 p.m. This enables you to benchmark performance and analyze the results not
only intraday (to compare performance at different times of the day) but also interday (to
see whether performance is slowing over time).
Reports
This section holds the reports created by each data collector set. These are .blg files, and
you can see the results by clicking the report and then switching to Sysmon view (click
the Chart icon in the toolbar). Alternatively, open the folder that contains the report file
in Windows Explorer (the default save location is %SystemDrive%\perflogs) and doubleclick the report file.
Optimizing Startup
In the end, I believe the overall boot time is what usually determines which of these
camps you belong to. If your startup time is unbearably long, you’ll certainly be more
inclined to leave your computer running all the time. Fortunately, Windows 7 has made
great strides on improving startup times, which now routinely clock in at well under a
minute (instead of the multiminute startups of yesteryear). However, if you’re convinced
that turning off the computer is a sensible move but you hate waiting even for Windows
7’s faster startup process, the next few sections provide a few tips for improving startup
performance even more.
Reducing or Eliminating BIOS Checks
Many computers run through one or more diagnostic checks at system startup. For
example, it’s common for machines to check the integrity of the system memory chips.
That seems like a good idea, but it can take an interminable amount of time to complete
on a system with a great deal of memory. Access your system’s BIOS settings and turn off
these checks to reduce the overall time of the computer’s power-on self test (POST).
6
One of the longest-running debates in computer circles involves the question of whether
to turn off the computer when you’re not using it. The “off” camp believes that shutting
down the computer reduces hard disk wear and tear (because the disk’s platters spin full
time, even when the computer is idle), prevents damage from power surges or power failures that occur while the machine is off, and saves energy. The “on” camp believes that
cold starts are hard on many computer components, that energy can be saved by taking
advantage of power-saving features, and that leaving the computer running is more
productive because it avoids the lengthy startup process.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
122
CHAPTER 6
Tuning Windows 7’s Performance
NOTE
How you access your computer’s BIOS settings (also called the CMOS setup) depends
on the manufacturer. You usually have to press a function key (normally F1, F2, or F10),
a key such as Delete or Esc, or a key combination. During the POST, you should see
some text on the screen that tells you what key or key combination to press.
Reducing the OS Choices Menu Timeout
If you have two or more operating systems on your computer, you see Windows 7’s OS
Choices menu at startup. If you’re paying attention to the startup, you can press the Enter
key as soon as this menu appears and your system will boot the default operating system.
If your mind is elsewhere, however, the startup process waits 30 seconds until it automatically selects the default choice. If this happens to you frequently, you can reduce that 30second timeout to speed up the startup. There are three ways to do this:
. Select Start, type system, and then press Enter to select System Configuration in the
search results. In the System Configuration window, display the Boot tab and then
modify the value in the Timeout text box.
. Select Start, type advanced system, and then press Enter to select View Advanced
System Settings in the search results. This opens the System Properties dialog box
and displays the Advanced tab. In the Startup and Recovery group, click Settings and
then adjust the value of the Time to Display List of Operating Systems spin box.
. Select Start, type command, right-click Command Prompt in the search results, click
Run as Administrator, and then enter your UAC credentials. At the Command
Prompt, enter the following command (replace ss with the number of seconds you
want to use for the timeout):
BCDEDIT /timeout ss
Turning Off the Startup Splash Screen
You can prevent the Windows 7 splash screen from appearing, which will shave a small
amount of time from the startup. Select Start, type system, and then press Enter to select
System Configuration in the search results. In the System Configuration window, display
the Boot tab and then activate the No GUI Boot check box.
CAUTION
Activating the No GUI Boot option means that you won’t see any startup blue-screen
errors. In other words, if a problem occurs, all you’ll know for sure is that your system
has hung, but you won’t know why. For this reason, the small performance improvement
represented by activating the No GUI Boot option is likely not enough to offset the lack
of startup error messages.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Optimizing Applications
123
Upgrading Your Device Drivers
Device drivers designed to work with Windows 7 will generally load faster than older
drivers. Therefore, you should check each of your device drivers to see whether a Windows
7–compatible version exists. If one is available, upgrade to that driver as described in
Chapter 22, “Troubleshooting Devices.”
. See “Updating a Device Driver,” p. 466.
Using an Automatic Logon
One of the best ways to reduce startup time frustration is to ignore the startup altogether
by doing something else (such as getting a cup of coffee) while the boot chores occur.
However, this strategy fails if the logon process interrupts the startup. If you’re the only
person who uses your computer, you can overcome this problem by setting up Windows 7
to log you on automatically. I discussed this in Chapter 4, “Customizing Startup and
Shutdown.”
. See “Setting Up an Automatic Logon,” p. 79.
Configuring the Prefetcher
HKLM\SYSTEM\CurrentControlSet\Control\SessionManager\Memory Management\
➥PrefetchParameters\EnablePrefetcher
There’s also a SuperFetch setting:
HKLM\SYSTEM\CurrentControlSet\Control\SessionManager\Memory Management\
➥PrefetchParameters\EnableSuperfetch
In both cases, set the value to 1 for application-only fetching, 2 for boot-only fetching, or
3 for both application and boot fetching (this is the default for both settings). You can try
experimenting with boot-only fetching to see whether it improves your startup times, but
my own testing shows only minimal startup improvements. The more programs you run
at startup, the more your startup performance should improve with boot-only fetching.
Optimizing Applications
Running applications is the reason we use Windows 7, so it’s a rare user who doesn’t want
his applications to run as fast as possible. The next few sections offer some pointers for
improving the performance of applications under Windows 7.
6
Prefetching is a Windows 7 performance feature that analyzes disk usage and then reads
into memory the data that you or your system accesses most frequently. The prefetcher
can speed up booting, application launching, or both. You configure the prefetcher using
the following Registry setting (open the Registry Editor by selecting Start, typing regedit,
and then pressing Enter; see Chapter 12, “Tweaking the Windows 7 Registry,” for more
information):
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
124
CHAPTER 6
Tuning Windows 7’s Performance
Adding More Memory
All applications run in RAM, of course, so the more RAM you have, the less likely it is that
Windows 7 will have to store excess program or document data in the page file on the
hard disk, which is a real performance killer. Use one of the following Windows 7 monitoring tools to watch the available memory value:
. Task Manager—Display the Performance tab and watch the Physical Memory:
Available value.
. Resource Monitor—Display the Memory tab and watch the Available to
Programs value.
. Performance Monitor—Start a new counter, open the Memory category, and then
select the Available Mbytes counter.
If the amount of available memory starts to get low, you should consider adding RAM to
your system.
Installing to the Fastest Hard Drive
If your system has multiple hard drives that have different performance ratings, install
your applications on the fastest drive. (See “Examining Hard Drive Performance
Specifications” later in this chapter.) This enables Windows 7 to access the application’s
data and documents faster.
Optimizing Application Launching
As I mentioned earlier in this chapter (see “Configuring the Prefetcher”), Windows 7’s
fetching components can optimize disk files for booting, application launching, or both.
It probably won’t make much difference, but experiment with setting the Registry’s
EnablePrefetcher and EnableSuperfetch values to 1 to optimize application launching.
Getting the Latest Device Drivers
If your application works with a device, check with the manufacturer or Windows Update
to see whether a newer version of the device driver is available. In general, the newer the
driver, the faster its performance. I show you how to update device drivers in Chapter 22.
. See “Updating a Device Driver,” p. 466.
Optimizing Windows 7 for Programs
You can set up Windows 7 so that it’s optimized to run programs. This involves adjusting
the processor scheduling, which determines how much time the processor allocates to the
computer’s activities. In particular, processor scheduling differentiates between the
foreground program (the program in which you are currently working) and background
programs (programs that perform tasks, such as printing or backing up, while you work in
another program).
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Optimizing Applications
125
Optimizing programs means configuring Windows 7 so that it gives more CPU time to
your programs. This is the default in Windows 7, but it’s worth your time to make sure
that this default configuration is still the case on your system. Here are the steps to follow:
1. Select Start, type advanced system, and then press Enter to select View Advanced
System Settings in the search results. This opens the System Properties dialog box
with the Advanced tab displayed.
2. In the Performance group, click Settings to display the Performance Options dialog
box.
3. Display the Advanced tab, shown in Figure 6.7.
6
FIGURE 6.7 In the Performance Options dialog box, use the Advanced tab to optimize
Windows 7 for programs.
4. In the Processor Scheduling group, activate the Programs option.
5. Click OK.
6. When Windows 7 tells you the changes require a restart, click OK to return to the
System Properties dialog box.
7. Click OK. Windows 7 asks whether you want to restart your system.
8. Click Yes.
Setting the Program Priority in Task Manager
You can improve the performance of a program by adjusting the priority given to the
program by your computer’s processor. The processor enables programs to run by doling
out thin slivers of its computing time to each program. These time slivers are called cycles
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
126
CHAPTER 6
Tuning Windows 7’s Performance
because they are given to programs cyclically. For example, if you have three programs
running—A, B, and C—the processor gives a cycle to A, one to B, another to C, and then
another to A again. This cycling happens quickly, appearing seamless when you work with
each program.
The base priority is the ranking that determines the relative frequency with which a
program gets processor cycles. A program given a higher frequency gets more cycles,
which improves the program’s performance. For example, suppose that you raise the priority of program A. The processor might give a cycle to A, one to B, another to A, one to C,
another to A, and so on.
Follow these steps to change a program’s priority:
1. Launch the program you want to work with.
2. Open Task Manager, as described earlier in this chapter (refer to “Monitoring
Performance with Task Manager”).
3. Display the Processes tab.
4. Right-click your application’s process to display its shortcut menu.
5. Click Set Priority, and then click (from highest priority to lowest) Realtime, High, or
AboveNormal.
TIP
After you’ve changed the priority of one or more programs, you might forget the values
that you have assigned to each one. To help, you can view the priority for all the items
in the Processes tab. Click View and then click Select Columns to display the Select
Columns dialog box. Activate the Base Priority check box and click OK. This adds a
Base Priority column to the Processes list.
Optimizing the Hard Disk
Windows 7 uses the hard disk to fetch application data and documents as well as to store
data in the page file temporarily. Therefore, optimizing your hard disk can greatly improve
Windows 7’s overall performance, as described in the next few sections.
Examining Hard Drive Performance Specifications
If you’re looking to add another drive to your system, your starting point should be the
drive itself: specifically, its theoretical performance specifications. There are three things to
consider: the hard drive speed, the size of the hard drive cache, and the hard drive seek time.
The Hard Drive Speed
The hard drive speed is a measure of how fast the drive’s internal platters spin, measured in
revolutions per minute (rpm). In general, the higher the rpm value, the better the drive’s
performance. Most hard drives spin at 7,200rpm, although some older drives spin at
5,400rpm. You should avoid these older drives because the performance hit is substantial,
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Optimizing the Hard Disk
127
and they’re not that much cheaper than the equivalent 7,200rpm drive. If money is no
object, drives are available that spin at 10,000rpm, which offers a substantial performance
boost.
The Hard Drive Cache
The hard drive cache refers to a RAM memory area embedded in the hard drive. This
memory is used as a holding place for frequently used bits of data. If the CPU finds the
data it needs in the hard drive cache, it saves time because it can load that data directly
into memory instead of asking the hard drive to fetch it from the disk. The bigger the
hard drive cache, the more data it can hold, so the more likely the CPU is to find the data
it needs, and thus the better the overall performance of the hard drive.
Inexpensive hard drives usually come with just a 2MB cache, whereas most mainstream
drives come with either an 8MB or a 16MB cache. Some high-end drives come with a
whopping 32MB cache.
The Hard Drive Seek Time
There are four measures of hard disk read/write performance:
. Seek time—The time it takes the hard drive’s actuator arm to move the read/write
head over the track that contains the sector that will be read or written to.
. Write time—The time it takes the writing mechanism on the read/write head to
write data to the sector.
. Read time—The time it takes the reading mechanism on the read/write head to
read data from the sector.
In all cases, the lower the time, the faster the drive’s performance.
Of these, the seek time is the most important—or, at least, it’s the one that’s most often
quoted in hard drive ads and descriptions. The seek time is usually an average because
sometimes the read/write head has to travel a relatively long distance along the arm and
sometimes a relatively short distance. The seek time, similar to the latency, write, and read
time, is measured in milliseconds. For a low-end drive, the average seek time is usually
12ms or higher; for a mainstream drive, the average seek time is usually around 10ms; and
for a high-end drive, the average seek time is usually under 9ms. (For comparison, note
that most of the 10,000rpm drives on the market now boast average seek times around
4.6ms, which is blazingly fast.)
Performing Hard Drive Maintenance
For an existing drive, optimization is the same as maintenance, so you should implement
the maintenance plan I discuss in Chapter 7, “Maintaining Your Windows 7 System.” For
a hard disk, this means doing the following:
6
. Latency—The time it takes the hard drive to rotate the disk so that the sector is
directly under the read/write head (so this value is sometimes called the rotational
latency).
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
128
CHAPTER 6
Tuning Windows 7’s Performance
. Keeping an eye on the disk’s free space to make sure that it doesn’t get too low
. Periodically cleaning out any unnecessary files on the disk
. Uninstalling any programs or devices you no longer use
. Checking all partitions for errors frequently
. Defragmenting partitions on a regular schedule
Disabling Compression and Encryption
If you use NTFS on a partition, Windows 7 enables you to compress files to save space, as
well as to encrypt files for security. (See “Converting FAT16 and FAT32 Partitions to NTFS”
later in this chapter.) From a performance point of view, however, you shouldn’t use
compression and encryption on a partition if you don’t have to. Both technologies slow
down disk accesses because of the overhead involved in the compression/decompression
and encryption/decryption processes.
Turning Off the Content Indexing
The Indexer is a Windows 7 background process that indexes the contents of a drive onthe-fly as you add or delete data. This greatly speeds up Windows 7’s search features
(including Instant Search) because Windows 7 knows the contents of each file. However,
you should consider turning off content indexing to improve overall performance, particularly on any drive where you don’t do much file searching. (You can still search based on
file properties.) To do this, follow these steps:
1. Select Start, Computer.
2. Right-click the drive you want to work with and then click Properties. Windows 7
display’s the drive’s property sheet.
3. On the General tab, deactivate the Allow Files on This Drive to Have Contents
Indexed in Addition to File Properties check box.
4. Click OK.
Enabling Write Caching
You should also make sure that your hard disk has write caching enabled. Write caching
means that Windows 7 doesn’t flush changed data to the disk until the system is idle,
which improves performance. The downside of write caching is that a power outage or
system crash means that the data never gets written, so the changes are lost. The chances
of this happening are minimal, so I recommend leaving write caching enabled, which is
the Windows 7 default. To make sure, follow these steps:
1. Select Start, type device, and then click Device Manager in the search results.
2. Open the Disk Drives branch.
3. Double-click your hard disk to display its property sheet.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Optimizing the Hard Disk
129
4. In the Policies tab, make sure that the Enable Write Caching on the Device check
box is activated.
5. For maximum performance, activate the Turn Off Windows Write-Cache Buffer
Flushing on the Device check box. (Note that this option is available only with
certain hard drives that support it.)
6. Click OK.
CAUTION
Activating the Turn Off Windows Write-Cache Buffer Flushing on the Device option tells
Windows 7 to use an even more aggressive write-caching algorithm. However, an
unscheduled power shutdown means you will almost certainly lose some data. Activate
this option only if your system is running off an uninterruptible power supply (UPS).
Converting FAT16 and FAT32 Partitions to NTFS
CONVERT volume /FS:NTFS [/V] [/CvtArea:filename] [/NoSecurity] [/X]
volume
Specifies the drive letter (followed by a colon) or volume name you
want to convert.
/FS:NTFS
Specifies that the file system is to be converted to NTFS.
/V
Uses verbose mode, which gives detailed information during the
conversion.
/CvtArea:filename Specifies a contiguous placeholder file in the root directory that will
be used to store the NTFS system files.
/NoSecurity
Specifies that the default NTFS permissions are not to be applied to
this volume. All the converted files and folders will be accessible by
everyone.
/X
Forces the volume to dismount first if it currently has open files.
For example, running the following command at the Command Prompt converts the D:
drive to NTFS:
convert d: /FS:NTFS
In some cases, you may see the following message:
6
The NTFS file system is your best choice if you want optimal hard disk performance
because, in most cases, NTFS outperforms both FAT16 and FAT32. (This is particularly true
with large partitions and with partitions that that have lots of files.) Note, however, that
for best NTFS performance you should format a partition as NTFS and then add files to it.
If this isn’t possible, Windows 7 offers the CONVERT utility for converting a FAT16 or FAT32
drive to NTFS:
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
130
CHAPTER 6
Tuning Windows 7’s Performance
Convert cannot gain exclusive access to the D: drive, so it cannot
convert it now. Would you like to schedule it to be converted the
next time the system restarts? <Y/N>
In this case, press Y to schedule the conversion.
If you make the move to NTFS, either via formatting a partition during setup or by using
the CONVERT utility, you can implement a couple of other tweaks to maximize NTFS performance. I cover these tweaks in the next two sections.
Turning Off 8.3 Filename Creation
To support legacy applications that don’t understand long filenames, for each file, NTFS
keeps track of a shorter name that conforms to the old 8.3 standard used by the original
DOS file systems. The overhead involved in tracking two names for one file isn’t much for
a small number of files, but it can become onerous if a folder has a huge number of files
(300,000 or more).
To disable the tracking of an 8.3 name for each file, enter the following statement at the
Command Prompt:
fsutil behavior set disable8dot3 1
Note, too, that you can do the same thing by changing the value of the following Registry
setting to 1. (Note that the default value is 2.)
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisable8dot3NameCreation
NOTE
The FSUTIL program requires Administrator account privileges. Click Start, type
command, right-click Command Prompt in the search results, click Run as Administrator,
and then enter your UAC credentials.
Disabling Last Access Timestamp
For each folder and file, NTFS stores an attribute called Last Access Time that tells you
when the user last accessed the folder or file. If you have folders that contain a large
number of files and if you use programs that frequently access those files, writing the Last
Access Time data can slow down NTFS. To disable writing of the Last Access Time
attribute, enter the following statement at the Command Prompt:
fsutil behavior set disablelastaccess 1
You can achieve the same effect by changing the value of the following Registry setting to
1 (although this now seems to be the default value in Windows 7):
HKLM\SYSTEM\CurrentControlSet\Control\FileSystem\NtfsDisableLastAccessUpdate
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Optimizing Virtual Memory
131
Optimizing Virtual Memory
No matter how much main memory your system boasts, Windows 7 still creates and uses
a page file for virtual memory. To maximize page file performance, you should make sure
that Windows 7 is working optimally with the page file. The next few sections present
some techniques that help you do just that.
Storing the Page File Optimally
The location of the page file can have a major impact on its performance. There are three
things you should consider:
. If you have multiple physical hard disks, store the page file on the hard
disk that has the fastest access time—You’ll see later in this section that you
can tell Windows 7 which hard disk to use for the page file.
. Store the page file on an uncompressed partition—Windows 7 is happy to
store the page file on a compressed NTFS partition. However, as with all file operations on a compressed partition, the performance of page file operations suffers
because of the compression and decompression required. Therefore, you should store
the page file on an uncompressed partition.
See “Changing the Paging File’s Location and Size,” later in this chapter, for the information about moving the page file.
Splitting the Page File
If you have two or more physical drives (not just two or more partitions on a single physical drive), splitting the page file over each drive can improve performance because it
means that Windows 7 can extract data from each drive’s page file simultaneously. For
example, if your current initial page file size is 384MB, you’d set up a page file on a drive
with a 192MB initial size, and another page file on a second drive with a 192MB initial
size.
See “Changing the Paging File’s Location and Size” to learn how to split the page file.
Customizing the Page File Size
By default, Windows 7 sets the initial size of the page file to 1.5 times the amount of RAM
in your system, and it sets the maximum size of the page file to 3 times the amount of
RAM. For example, on a system with 1GB RAM, the page file’s initial size will be 1.5GB
and its maximum size will be 3GB. The default values work well on most systems, but you
might want to customize these sizes to suit your own configuration. Here are some notes
about custom page file sizes:
6
. If you have multiple hard disks, store the page file on the hard disk that
has the most free space—Windows 7 expands and contracts the page file dynamically depending on the system’s needs. Storing the page file on the disk with the
most space gives Windows 7 the most flexibility.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
132
CHAPTER 6
Tuning Windows 7’s Performance
. The less RAM you have, the more likely it is that Windows 7 will use the page file, so
the Windows 7 default page file sizes make sense. If your computer has less than
1GB RAM, you should leave the page file sizes as is.
. The more RAM you have, the less likely it is that Windows 7 will use the page file.
Therefore, the default initial page file size is too large and the disk space reserved by
Windows 7 is wasted. On systems with 2GB RAM or more, you should set the initial
page file size to half the RAM size, but leave the maximum size at three times the
amount of RAM, just in case.
. If disk space is at a premium and you can’t move the page file to a drive with more
free space, set the initial page file size to 16MB (the minimum size supported by
Windows 7). This should eventually result in the smallest possible page file, but
you’ll see a bit of a performance drop because Windows 7 will often have to increase
the size the page file dynamically as you work with your programs.
. You might think that setting the initial size and the maximum size to the same relatively large value (say, two or three times RAM) would improve performance because
it would mean that Windows 7 would never resize the page file. In practice,
however, it has been shown that this trick does not improve performance, and in
some cases actually decreases performance.
. If you have a large amount of RAM (at least 2GB), you might think that Windows 7
would never need virtual memory, so it would be okay to turn off the page file. This
won’t work, however, because Windows 7 needs the page file anyway, and some programs might crash if no virtual memory is present.
See “Changing the Paging File’s Location and Size” to learn how to customize the page
file size.
Watching the Page File Size
Monitor the page file performance to get a feel for how it works under normal conditions,
where normal means while running your usual collection of applications and your usual
number of open windows and documents.
Start up all the programs you normally use (and perhaps a few extra, for good measure)
and then watch Performance Monitor’s Process\Page File Bytes and Process\Page File Bytes
Peak counters.
Changing the Paging File’s Location and Size
The page file is named Pagefile.sys and it’s stored in the root folder of the
%SystemDrive%. Here’s how to change the hard disk that Windows 7 uses to store the page
file as well as the page file sizes:
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
Optimizing Virtual Memory
133
NOTE
The Pagefile.sys file is a hidden system file. To see it, open any folder window and
select Organize, Folder and Search Options. In the Folder Options dialog box, click the
View tab, activate the Show Hidden Files and Folders option, and deactivate the Hide
Protected Operating System Files check box. When Windows 7 asks you to confirm the
display of protected operating system files, click Yes, and then click OK.
1. If necessary, defragment the hard disk that you’ll be using for the page file, as
described in Chapter 7.
. See “Defragmenting Your Hard Disk,” p. 145.
2. Select Start, type advanced system, and then press Enter to select View Advanced
System Settings in the search results. This opens the System Properties dialog box
with the Advanced tab displayed.
3. In the Performance group, click Settings to display the Performance Options dialog
box.
4. In the Advanced tab’s Virtual Memory group, click Change. Windows 7 displays the
Virtual Memory dialog box.
5. Deactivate the Automatically Manage Paging File Size for All Drives check box.
Windows 7 enables the rest of the dialog box controls, as shown in Figure 6.8.
6
FIGURE 6.8 Use the Virtual Memory dialog box to select a different hard disk to store the
page file.
Microsoft Windows 7 Unleashed, Paul McFedries, Sams Publishing, 0672330695, July, 201
134
CHAPTER 6
Tuning Windows 7’s Performance
6. Use the Drive list to select the hard drive you want to use.
7. Select a page file size option:
. Custom Size—Activate this option to set your own page file sizes using the
Initial Size (MB) and Maximum Size (MB) text boxes. Ensure that Windows 7 is
able to resize the page file dynamically, as needed, by entering a maximum size
that’s larger than the initial size.
. System Managed Size—Activate this option to let Windows 7 manage the
page file sizes for you.
. No Paging File—Activate this option to disable the page file on the selected
drive.
TIP
If you want to move the page file to another drive, first select the original drive and
then activate the No Paging File option to remove the page file from that drive. Select
the other drive and choose either Custom Size or System Managed Size to add a new
page file to that drive.
TIP
If you want to split the page file over a second drive, leave the original drive as is,
select the second drive, and choose either Custom Size or System Managed Size to
create a second page file on that drive.
8. Click Set.
Exit all the dialog boxes. If you changed the drive or decreased either the initial size or the
maximum size, you need to restart your computer to put the changes into effect.
Was this manual useful for you? yes no
Thank you for your participation!

* Your assessment is very important for improving the work of artificial intelligence, which forms the content of this project

Download PDF

advertising