Understand how SuperFetch uses RAM to enhance system performance

Microsoft Windows Vista uses an applet called SuperFetch to manage memory. Greg Shultz explains how SuperFetch works and what it does to enhance the performance of your system.

I recently received a phone call from a business associate who had just got a new laptop with Windows Vista Home Premium with 2GB of RAM and an ATI Radeon video card with 512MB. He was happy with the system's overall performance, but he was concerned about the amount of available RAM on his system.

He told me that at any given time while using the system under normal conditions, with very few applications running, he would access the Performance tab in Windows Task Manager and discover that the amount of free memory in the Physical Memory panel would read 10MB or less. He then went on to say that his old Windows XP system with 1GB of RAM typically would, under similar circumstances, have at least 500MB to 700MB of free memory showing in the Available memory section of the Physical Memory panel.

He was surprised that there would be such a huge difference between the two operating systems' use of memory and came to the conclusion that Vista was just a memory hog. He then asked me what would cause Vista to use all of the system's available memory?

My answer to him was that what he was witnessing was a Vista performance enhancement called SuperFetch and the fact that he had very little free memory available was a good thing -- not a bad thing.

Since other Vista users may have the same reaction as my friend, I thought that a detailed explanation of how SuperFetch works would make a good topic for the Windows Vista Report.

This blog post is also available in the PDF format as a TechRepublic Download.

Comparing Vista to XP

Let's start by comparing the Performance tabs on similarly equipped XP and Vista systems just to see the difference. On the left of Figure A is Windows XP and on the right is Vista.

Figure A

Comparing performance

Both systems have 1GB of RAM, but this can be obscured by the fact that XP measures in kilobytes while Vista measures in megabytes. However, if you convert both figures to gigabytes, it looks more equal.

XP:     982,380KB = 959.355MB = 0.936GB
Vista: 	1,022MB = 0.998GB

Both systems are running only Internet Explorer and Paint. But, if you look at the available memory in XP, it comes out to be about 589MB. Yet, the Vista system has only5 MB of available memory.

The reason for this difference is that Windows XP treats RAM as a resource to be used only when needed while Vista treats RAM as a cache and uses almost all of it as soon as it becomes available.

The SuperFetch advantage

In order to effectively use the available RAM as a cache, Vista employs the SuperFetch technology to efficiently manage the use of that RAM. The SuperFetch memory management scheme is multipronged.

To begin with, SuperFetch tracks the applications that you use most often. As it does so, it builds a database and constantly updates it as you work. Using this database as a reference, SuperFetch instructs Disk Defragmenter to make sure that those applications are strategically positioned on the hard disk where they can be loaded into memory very quickly with the least amount of physical movement of the hard disk's read-write heads.

Then, each time you turn on your system, SuperFetch preloads those applications that you use most often into memory. As such, when you actually go to run your favorite application, it loads up much more quickly from the RAM cache than if it had to be read from the hard disk and loaded into RAM.

While the process as I've described so far sounds like a complete system, it's only part of the picture -- SuperFetch has a much bigger role to play in order to keep this system as effective as possible over time.

Because RAM is a volatile environment and many applications are all vying for space at the same time, SuperFetch employs an I/O prioritization technology, in which applications are marked as either a low- or high-priority I/O application.

With this system, SuperFetch will temporarily sideline a low-priority I/O application when a high-priority I/O application takes precedence. As it does so, SuperFetch keeps track of the previous priority levels in order to ensure the system remains responsive over time.

For example, let's suppose that you're writing a document in Word and have been working on it steadily for a while. All the time that you're using it, Word is recognized as the high-priority I/O application and takes precedence. When you go to lunch, Word becomes inactive and other background tasks, such as Disk Defragmenter, realize that the system is idle and begin to go to work.

When that happens, Disk Defragmenter becomes the high-priority I/O application and Word becomes a low-priority I/O application, so SuperFetch moves Word out of RAM to the paging file to make room in RAM for Disk Defragmenter to do its job. Once Disk Defragmenter finishes, SuperFetch will reload Word back into RAM so that when you get back from lunch, Word is as responsive as it was when you left -- no waiting for Word to be reloaded into RAM.

What do you think?

Now that you know that Vista treats RAM as a cache rather than as a resource, you can understand why the amount of free memory in the Physical Memory panel on the Performance tab in Windows Task Manager is very small figure. If you have comments or information to share about Windows Vista's SuperFetch, please take a moment to drop by the Discussion area and let us hear.