While you obviously want a high level of performance when booting or resuming from hibernation and standby, the major part of your user experience will stem from the system performance you get when Windows® XP is in its “steady state.”
Two areas where you’ll see performance improvements in Windows XP are application startup time and resource management.
You can launch applications in Windows XP up to 50 percent faster—particularly for those applications that take the longest time using earlier versions of Windows. One of the reasons for this is that Windows XP uses many of the same mechanisms to streamline application startup as it does to achieve a more efficient fast boot.
Application startup requires the operating system to find sufficient memory resources for the new program and program code, and for data to be read in from the disk. Windows XP watches each launch of the application so that it will know how much memory will be required and what will be needed from the disk. The mechanism is the same as that used to achieve fast boot and logon. The speed with which an application is launched will usually depend on the amount of I/O necessary and the efficiency with which the I/O is handled.
Predicting the I/O Required
In ordinary demand paging, small amounts of text or data are fetched from all over the disk. Poorly organized I/O causes a lot of time to be lost due to disk seeks and rotations. By watching each launch, Windows XP is able to accurately predict the I/O that will be needed and issue hundreds of requests at a time. These requests are sorted, allowing them to be processed without extra seeks and rotations. With the required code and data already in memory, the application can start without having to wait for the next missing piece to arrive from the disk.
File access patterns in the application launch are used to periodically optimize the layout of files on the disk; improved layout decreases seek time and provides for even faster launch and faster continuing use.
Resource management—which includes memory management, the CPU, and I/O—is one of the primary tasks of an operating system. Good resource management—and the avoidance of costly or unnecessary activities that interfere with a computer’s responsiveness—is the key to good performance. Windows XP is built on the Microsoft Windows NT® kernel and shares much of its approach to resource management with previous versions of Windows.
The following improvements have been made upon this strong foundation:
Windows XP does a better job in resource management by taking advantage of idle times to perform system activities. Rather than relying on timers that may startup while you’re using system resources to get work done, Windows XP manages resources so that the system does its work when you’re not doing yours. Improved idle detection thus helps you enjoy the benefits of Windows XP without being slowed down by system activities at random times. Idle time activities include optimizing the layout of files and directories on the hard drive. Other system and service cleanup activities can also take place at this time.
There are many services provided by Windows XP that provide you with valuable capabilities. For example, System Restore provides you with the ability to roll back faulty application and driver installations and undo damage to the system, while Help and Support simplify the process of troubleshooting the system.
When active, services may use significant system resources, but their impact on Windows XP performance is much reduced compared, for example, to the impact many of the same services have using Windows Me. This improvement in service performance is attributable to better implementations that use fewer resources when inactive—and when active, schedule their activities to periods when the computer is otherwise idle.
Windows XP is tuned to take better advantage of today’s hardware. In many cases Windows XP is able to adapt itself, thereby implementing a greater degree of self-tuning. This lets you enjoy better performance with less administrative overhead.
While Windows XP inherits much of its resource management infrastructure from Windows 2000, there are several areas where it achieves a higher degree of self-tuning than previous versions of Windows. For example: In addition to prefetching, consider how Windows XP attempts to match the visual effects in the user interface to the capabilities of individual computers. There are a number of effects, such as animations, drop shadowing, and menu fading that have the potential to interfere with response time if they cannot be rendered fast enough on a particular computer. To avoid this problem, Windows XP gauges the capabilities of the system during installation and adjusts the user interface settings accordingly.
As illustrated earlier in the Application Startup section of this document, the Windows XP self-tuning process effectively manages the layout of files and directories on disk, and takes this process one step further by reorganizing the layout of file metadata so that the footprint in memory is smaller. The benefit of this layout optimization is quite pronounced for today’s large capacity disks.
Windows XP, like most modern operating systems, uses virtual memory. Virtual memory is created by extending the physical memory assigned to an application by providing additional computing space on the computer’s hard drive. The operating system may assign some memory to an application, but not necessarily enough to satisfy that application’s every memory access. Instead, some accesses will be detected by hardware, which will reorganize some of the memory structure. By correctly anticipating the patterns of use of a set of applications, the operating system allows a computer to operate with far less physical memory by figuring out what combination of physical and virtual memory will be needed to satisfy the memory requirements of that set of applications.
This is like a juggler juggling several balls. Although the juggler has only two hands, he or she makes sure that a hand is always ready when a ball comes down. A juggler with five balls doesn’t require five hands, nor does a computer need a megabyte of physical RAM for each megabyte accessed by an application.
Windows XP—like Windows 2000—regularly checks that the memory assigned to a particular application is actually in use, and maintains an estimate for each application indicating the amount of memory that could reasonably be taken away without affecting performance. A reserve of memory is kept on hand to be used as needed. When this reserve sinks too low it is replenished by trimming working sets. These estimates are used as a guideline to determine where memory should be taken from.
The Cost of Virtual Memory
Implementing virtual memory has a cost. When the operating system fails to correctly anticipate the needs of an application, the “bit of memory reorganization” mentioned earlier will usually include a bit of I/O to or from disk. Any disk I/O is expensive.
Typical desktop computer disks are often limited to 80 random I/Os to 100 random I/Os per second. Laptop disks are frequently even more limited. Each mistake in memory management counts against this limit. If enough mistakes are made, you will notice the extra time taken. With more physical memory installed, it is easier to avoid these mistakes; with less physical memory, mistakes become harder to avoid.
These virtual memory-related I/Os are typically the biggest impacts you’ll experience. Therefore, adding memory to a computer is typically the easiest and most effective way to improve its performance.
How Windows XP Handles Memory Management
Figure 3 below shows the virtual memory usage for a number of operations taken from a trace of a long-running workload running on Windows XP. The workload involves Office productivity applications and Web browsing. The operations include activities like starting applications, saving and printing documents, and opening files and Web pages. The virtual memory shown is the amount of memory available to hold all the code and data used in the operation, together with all the memory resources that are more or less permanently locked into a computer’s memory. This virtual memory is divided among the following:
The space taken by applications. This can vary from very little, for operations that depend almost entirely on system services, such as opening a Web page, to substantial, as when an application starts and must initialize itself.
The space taken by driver code. This is relatively constant, because much of the code for drivers is locked in memory or is in regular use.
The allocated and mapped data used by the system.This includes registry data, many system data structures, and files accessed by the operating system.
The space used by the system itself. This includes the space used by the shell and all the system’s service processes.
Figure 3 Virtual memory requirements for 25 operations selected from an hour-long trace
Allocating Memory for Applications Under Windows XP
The operations illustrated in Figure 3 each take from 20 MB to 55 MB of virtual space. It is up to the operating system to assign physical memory to map this virtual space. The individual operations will easily fit in 64 MB of RAM, but as you proceed from operation to operation, some of the memory content will have to be replaced. In the course of the workload’s hour-long run, a total of 256 MB of distinct pages were touched. If successive operations overlap substantially in the virtual space they touch, each new operation will require little or no I/O.
Switching between applications is likely to involve a larger change in the contents of the virtual space. When working with 64 MB of RAM, this may require larger amounts of I/O. With 128 MB of RAM, there is enough room to spare so that much of the virtual memory needed is likely to still be in memory. Consequently, switching applications is likely to be faster with 128 MB or more.
Balancing Memory Resources
As we can see from the preceding example, there is no unique “memory requirement” for an application or for the system. When physical memory is scarce, you will pay frequent I/O penalties as you go from operation to operation. When physical memory is abundant, the system will use the memory to forestall these I/O penalties.
The operating system is constantly assessing the current situation and choosing which pages to keep and which to get rid of. Thus, the number of pages in use alone does not represent a measure of memory required. The number of pages in use can be quite misleading, if taken in isolation. An application’s working set, the number of pages it has in memory, can at times be quite large simply because there is no competition for the memory from other running applications. Conversely, the working set may be quite small, simply because all of the physical memory resources have been given over to other applications.
Keeping in mind what you’ve just read about memory management and how Windows XP handles memory management, consider the various RAM requirements and recommendations for Windows XP.
64 MB—Windows XP Minimum RAM Requirement
A computer with 64 MB of RAM will have sufficient resources to run Windows® XP and a few applications with moderate memory requirements. Office productivity applications and Web browsers fall into this category of applications. This is shown in our example, where individual operations from this sort of workload usually take between 20 MB and 40 MB of virtual space.
With less than 64 MB of memory, very little could be retained from operation to operation, but with the minimum memory requirement, the system was still usable. In fact, because of improved I/O—in comparison to Windows Me—it was shown that the user experience on this minimum configuration was generally comparable or superior to that of Windows Me running on the same computer.
Some UI features will be turned off with limited memory, and features like fast user switching will be turned off by default. The computer will also be slower to boot and resume.
128 MB—Windows XP Minimum Recommended RAM
Microsoft recommends that Windows XP be run with at least 128 MB of RAM. With that amount of memory Windows XP is superior to Windows 2000 and all other versions of Windows: it boots and resumes quickly, and is very responsive when switching applications, starting new applications, and running a wide variety of workloads. For many types of workloads, the system will have plenty of memory available to hold code files and data for possible future use.
Greater Than 128 MB—More Demanding Applications
With 128 MB of RAM, it is still necessary to match memory resources to an application’s needs and penalties—small delays for I/O must sometimes be paid. Adding additional memory resources can eliminate more and more of these penalties, and can provide a definite improvement in responsiveness for applications that handle large amounts of data, such as many multimedia applications and games. Additional resources will also let you use fast user switching—a situation where applications left running on other users’ sessions may compete for resources with your applications.
The performance differences seen when adding memory above 128 MB are subtler and more workload-dependent than those seen when going from 64 MB to 128 MB. This is referred to as finding the “knee of the curve,” where the gains from adding additional resources rapidly diminish. For most workloads this point falls between 64 MB and 128 MB; but for some workloads, you may find that it is worth adding more memory to obtain additional gains in performance.
When evaluating Windows XP and its performance, the following issues are important to keep in mind:
I/O performance is strongly influenced by the layout of files on disk. Files and directories that are heavily fragmented or dispersed across the disk will hurt performance. While Windows XP will automatically reposition some files to improve performance, this will generally be done infrequently and will usually include only a small fraction of the files on the disk. Therefore, it is a good idea to defragment the disk following an installation.
Once every three days, by default, Windows XP will perform a partial defragmentation and adjust the layout of the disk based upon current use. The files to be moved are written in the file Layout.ini (found in the Prefetch directory under the System Root directory).
Upgrade vs. Fresh Installation
A fresh installation of Windows XP will generally have a performance advantage over an upgrade, because it can exert greater control over the placement of files and file metadata on the disk. Disk partitions converted from file allocation table (FAT) to the NTFS file system may have suboptimal cluster sizes as well.
Microsoft provides only some of the drivers used by the system. System performance is often dependent upon the quality of those drivers. In particular, as was pointed out earlier, while Windows XP enables drivers to initialize devices in parallel, some drivers can take substantial periods of time to complete. Thus, boot and resume can take substantially longer on some hardware. Manufacturers have addressed this concern for a wide array of hardware, but you may still encounter problems on some devices.
The video hardware that you use, along with the quality of the video driver, can have a pronounced impact upon Windows XP performance and responsiveness. The new Windows XP UI makes heavier demands upon video memory compared to the Windows 2000 UI. If the video hardware provides little or no memory, system memory will be used for bitmaps and other graphic data structures. This will reduce the memory available for use by the operating system and applications.
The Advanced tab of the System Properties dialog box allows you to select particular features to enable or disable. A simple pair of buttons can be used to switch the system between “best appearance” and “best performance.” Windows XP attempts to automatically choose an appropriate subset of the appearance features, but this choice does not necessarily provide optimal performance.
If your system has limited video capability, or if repainting appears to be a problem for the computer, you can investigate performance changes by turning off additional appearance features and eliminate the desktop bitmap.
First Boot vs. Subsequent Boots
When the system is first installed and booted, the operating system observes the system behavior. It begins a process of optimization that quickly speeds up booting. Similarly, the first launch of an application is likely to be slower than subsequent optimized launches. It is important to recognize that this optimization is taking place and allow a sufficient number of reboots and launches to train the system before running benchmarks or otherwise evaluating the system.
Windows XP provides excellent overall performance—this includes dramatically faster boot and resume times, along with highly responsive applications. For most computers that meet Microsoft’s minimum recommended hardware requirements, Windows XP is the best-performing Windows operating system ever created. Microsoft strongly recommends that computers running Windows XP have at least 128 MB of RAM installed.
When evaluating the performance of Windows XP, additional issues that need to be taken into account include: the fragmentation level of your hard drive, whether you’ve done an upgrade or a fresh installation, the quality of the other drivers you’re using, the capabilities of your video system, and whether you've allowed a sufficient number of launches and reboots to enable the system to adapt to your usage patterns.
For More Information
For the latest information on Windows XP, check out the Web site at http://www.microsoft.com/windowsxp.
To learn more about how Microsoft and its OEM partners are working to speed boot and resume times, read the Fast Boot/Fast Resume for the Windows Platform white paper.