If you've been using Windows for any length of time, you're very familiar with the terms virtual memory and paging file. In the past we all spent lots of time tweaking virtual memory settings in order to make the paging file as efficient as possible on our poor memory deprived systems.
Then, the price of RAM came down to a much more affordable range and instead of tweaking virtual memory, we could afford to improve system performance simply by adding more RAM. Although the operating system still makes use of virtual memory, having more RAM in the system reduces the operating system's dependence on virtual memory.
Nowadays, it isn't uncommon to have systems sporting 512MB or even 1GB of RAM. So chances are that you haven't thought about virtual memory as much as you used to.
However, that's about to change with Windows Vista, which sports a new memory performance enhancement system called SuperFetch and a new way to extend the virtual memory by way of External Memory Devices (EMD). In this edition of the Windows Vista Report, I'll take a more in-depth look at SuperFetch and EMD.
Let's begin with a little refresher of virtual memory. To begin with, it's important to reiterate that Windows operating systems, Vista included, will always make use of virtual memory, even when the memory required by all running processes does not exceed the amount of RAM installed on the system. In fact, each and every process that's running on the system is automatically assigned a virtual memory address when it's loaded by the operating system.
When the memory in use by all the running processes exceeds the amount of RAM available, the operating system will begin moving pages of memory space in RAM out to virtual address spaces to the hard disk, thus freeing that RAM for other uses. These pages are then stored in a file called Pagefile.sys in the root of a partition.
When a running process that has been temporarily moved to virtual memory is needed, the operating system locates the virtual memory containing the process and returns it to RAM. As it does so, the operating system will have to move other pages of memory out of RAM to the page file in order to make room for the process that it just returned to RAM. This moving of memory pages is referred to as swapping and the paging file is often referred to as the swap file. This swapping requires a lot of overhead.
Windows Vista's SuperFetch builds on a technology introduced in Windows XP called Prefetch, so let's talk a little bit about it as well before we move on to SuperFetch and EMD. To begin with, prefetching is a process in which the operating system loads key pieces of data and code from disk into memory before it's actually needed. With this in mind, let's take a general look at how prefetching works.
In order for this prefetching operation to actually improve performance, the Windows XP Cache Manager monitors the data being moved between the disk and RAM and between RAM and virtual memory when the system is booting up as well as when various applications are loaded. As the Cache Manager monitors these occurrences, it constructs maps of the directories and all of the files that were referenced for each application or process. These maps are then saved to files with a .pf extension in the \Windows\Prefetch folder.
Once these map files have been created, the Cache Manager will use them to improve efficiency when the system boots up as well as when loading applications. More specifically, the Cache Manager will intercept every process or application that is about to be loaded and will check the \Windows\Prefetch folder to see if there is a corresponding map. If there is, the Cache Manager will call on the file system to immediately access the directory and files referenced in the map. The Cache Manager will then alert the Memory Manager and tell it to use the information in the map file to load data and code into memory. Once this prefetch operation is complete, the Cache Manager will allow the application or process to continue loading. As the application or process does so, it will find the majority of the files and data that it needs already available in memory, thus reducing the amount of disk access and allowing the application or process to load or respond faster.
In order to further improve the efficiency of this prefetching operation, Windows XP will regularly analyze the contents of the map files, compile a list of the directories and files, organize them in the order in which they are loaded, and save this information in a file called Layout.ini in the \Windows\Prefetch folder. It will then schedule disk defragmenter to run on a regular basis and use the information in the Layout.ini file to relocate all of the directories and files listed to a contiguous area of the disk.
Now that you know how Windows XP's Prefetch technology works, you have a good idea of how about 70 percent of Windows Vista's SuperFetch technology works. As the next version of Windows XP's Prefetch, SuperFetch does everything that Prefetch does and more.
To begin with, SuperFetch overcomes one of the big drawbacks in Windows XP's Prefetch technology. As I've explained, Prefetch improves efficiency by loading the majority of the files and data needed by an application or process into memory so that they can be accessed very quickly when needed. However, because these files and data exist in memory, they are subject to the laws governing virtual memory. In other words, when other applications need access to memory, any prefetched data is moved out to the page file on the hard disk. When it is needed again, it then must be moved back from the page file to memory, which of course offsets the performance enhancement.
SuperFetch goes one step further to ensure that you get the most out of the performance enhancement. In addition to constructing the map files I described earlier, SuperFetch also constructs profiles of the applications you use that include information about how often and when you use them. SuperFetch then will keep track of the applications in your profile and note when any prefetched data is moved out to the page file. SuperFetch will then monitor the progress of the application that caused the prefetched data to be moved out to the page file and, as soon as that application is done, it will pull the prefetched data back into memory. So when you go to access the application, the prefetched data will again be available in memory and the application will be very responsive.
External memory devices
As I've mentioned, the Windows operating system will always make use of virtual memory, no matter how much physical RAM is installed in the system. I've also told you that one of the enhancements in SuperFetch is that is will retrieve prefetched data from the virtual memory page file to physical memory as soon as possible to ensure the continuity of the performance enhancement. However, because the page file exists on the hard disk, which is less responsive than physical memory, SuperFetch is still going to be hindered by the time that it takes the hard disk to respond to its retrieval operation.
To improve SuperFetch's retrieval operation, Microsoft decided to take advantage of the fact that large capacity USB 2.0 memory sticks/flash drives are widely available, relatively inexpensive, and very efficient—not as efficient as physical memory, but much faster than a hard disk. When you insert a USB 2.0 memory stick into a Windows Vista system, SuperFetch will be able to redirect any prefetched data that is being sent to virtual memory to the USB drive rather than the hard disk. As such, when it comes time to retrieve the data and return it to memory, the retrieval operation will be much quicker.
When you insert a USB 2.0 memory stick into a system running Windows Vista, you'll see an AutoPlay dialog box like the one shown in Figure A. (Keep in mind that chances are good that not all USB 2.0 memory sticks/flash drives will be compatible with SuperFetch.)
|Windows Vista SuperFetch can use USB 2.0 memory sticks/flash drives as virtual memory.|
You'll then be prompted to specify the amount of storage space that you want to designate to SuperFetch, as shown in Figure B. As you can see, Windows Vista will automatically set aside the recommended amount of space, but you can use the slider to increase the amount of space.
|Windows Vista will automatically set aside a recommended amount of space for use with SuperFetch.|
According to Microsoft, you can remove the memory stick any time you want without losing data and still use it to store other files. Microsoft has also stated that any SuperFetch data stored on the memory stick will be encrypted so that it's not accessible when the memory stick is used in another computer.
Bogus SuperFetch rumors
There are rumors spreading around the Internet that Windows XP has a SuperFetch component built into it that has been disabled by default. The rumor goes on to say that you can enable SuperFetch in Windows XP by making a small tweak in the registry. This is bogus information, so don't waste your time and effort with it. Adding the tweak to the registry probably won't do any harm to your system, but it won't do any good either.
Keep in mind that even though Windows Vista's official release date is slated for the 2006 holiday season, some of the information presented here may change between now and then. I'll continue to investigate SuperFetch and will cover it again as the new operating system evolves. As always, if you have comments or information to share about SuperFetch and Extended Memory Devices, please take a moment to drop by the Discussion area and tell us about it.
Greg Shultz is a freelance Technical Writer. Previously, he has worked as Documentation Specialist in the software industry, a Technical Support Specialist in educational industry, and a Technical Journalist in the computer publishing industry.