freePCtech (click here to return to the first page) Search the
    siteHelp on using this siteHome

    Articles / Reviews

Maximize Performance with a permanent swap file in Windows

by Frank Suszka

Maximize performance
with a permanent swap file

by Frank Suszka

As reported in ZD Journals
Inside Microsoft Windows 98
February 2000

What is the swap file or virtual memory?
Basically the swap file or virtual memory as it is sometimes called is a tool that Windows uses to simulate more RAM than your system has. The term swap file and virtual memory are used interchangeably. Microsoft prefers to call it "virtual memory" however "swap file" is more accurate for the action it takes. You can find this file on your hard drive in the root directory named, Win386.swp or in the Windows folder.

When you boot your system or launch a program, Windows loads the applications in RAM. The applications you open all have to share the same RAM. As you know, the more you open the more RAM you need. The fact is your system may not have enough to support all of the applications you have opened. As you have guessed, your system comes to a screeching halt and won't budge. Well, that's been my experience… All is running well and all of a sudden…

In order to manage the situation, Windows monitors each application and will remove inactive sections of a program to the swap file and recall it back into RAM when the program needs it. This "swapping" process is continuous when you use several programs or applications at the same time.

The dynamic problem:
Windows uses a "dynamic management scheme" to keep up with the ever-changing needs of applications or programs. This means that Windows can enlarge or shrink the swap file according to changing needs of the applications. This "dynamic system" has three main problems:

  1. It isn't really necessary any more.

  2. It carries a lot of extra overhead

  3. It causes the swap file to become fragmented.

Hard Drive space:
In the old days when Windows first came out and hard drives were limited in size, Rather than set aside a large chunk of space specifically for the swap file, Windows would set it according to the system needs and the amount of space on the hard drive. This would allow you to open more applications and store more data.

Today, this doesn't matter due to the fact hard drives are large and space isn't as important as it used to be. Using the dynamic approach to the swap file for all intents a purpose can be considered unnecessary today.

As I indicated earlier, the swapping process is continuous when you have several applications running at the same time. On the down side, Winds is spending a lot of valuable time just tending to the duties of expanding and contracting the swap file. What this means is, Windows as I said earlier, puts unused sections in the swap file and retrieves them when an application needs them. As more space is needed, Windows will expand the swap file to hold more information.

With the dynamic swap file scheme, in addition to constantly moving chunks of information, Windows spends a lot of time trying to figure out the "ideal" size of the swap file and resizing it. All the time that Windows spends on the swap file keeps the CPU busy and prevents it from performing other necessary tasks. Resizing also keeps the hard drive tied up, which can prevent efficient use of the disk cache.

Considering that the Dynamic scheme is actually unnecessary due to the increased size of hard drives, the overhead produced by this method can be eliminated and would contribute to better overall system performance.

The other problem with the "Dynamic scheme" is how disk space is allocated. As you know, the swap file grows and Windows has to find space for it. If that space isn't close by, Windows will put it where it wants to even if it means at the end of the hard drive.

The fragmentation process can get out of hand. Have you ever done a "defrag" and found there were unmovable things? You know, those little boxes with the red in them? That is your swap file for all it's worth. Scattered all over you hard drive. Wow, can you imagine how frustrating that can be? While you have limited resources, Windows is tying up your system… Not a nice thing to have happen.

All the while this is going on, Windows is placing these little nuggets where it thinks they should go. Once the swap file becomes fragmented… Look out. For? Performance. Ever think about why your system took a dump? Have you ever thought about why when you do a clean install things run nicely? In some cases the swap file defragmentation may be the problem. Besides the fact that Windows has to spend more time processing this information, you have to wait for the system to stabilize. Sounds like a "crash" and 'blue screen" to me.

This is further aggravated by the fact that the "defragmentation tool in Windows is incapable of defragmenting the swap file. On the other hand, if you're using a utility such as "Norton System Works" or "Norton Utilities", you know that "speed Disk" can and will defrag the swap file. While this can help to some extent, it isn't the complete answer. It is a known fact that Windows requires a swap file in order to work. What's the solution? Say tuned, more will follow.

A permanent solution:
You may be able to avoid the problems associated with the "Dynamic scheme". How? By using a "permanent swap file" instead. Why? Using a permanent swap file will increase your overall system performance. Besides, it's easy to do. Controversy? Yep, here we go. Now it's time to get dicey.

Hard Disk:
You can specify the location of the swap file. In addition to this it shows the amount of available space on the drive.

Normally, you can use the default setting and get by. If you have an additional hard drive of equal or greater speed, you're in like Flint. Remember him? LOL Frankly Frank's rule of thumb, place the swap file on the drive with the fastest speed. If you have Norton Utilities or some such thing, run the utility so it will place the swap file at the beginning of the fastest drive. This way you will maximize the performance of the swap file. If you only have one drive, place the swap file at the beginning. Again, it will improve performance.

When it comes to setting the amount of hard drive space to devote to the swap file we enter into another area where leaving Pandora's box closed may me the safest way for some folks. I'm gutsy and will try for maximum operability and efficiency. I mean after all, if you build systems for clients, you have to anticipate what may run amuck. Then again, what may run amuck may not and what… You understand I'm sure.

Everyone uses a different set of applications and or programs. Therefore there are many options. Did I cover my? I think so. At this point, it is difficult to say what might or will work for the general populace. What may work for me may not work for you or vice versa. This article is meant to present you with some options and suggestions that may work for you. On this subject, I have my own opinion and rule of thumb that I have been following since the days of Windows 3X. One set of applications may require more of less swap file to function optimally. Oh, oh here he goes. Frankly Frank is going to put his foot in his mouth yet. Well, could be. The key, in my opinion is to try and find the smallest swap file to allow the system to function optimally. Yep, he said it.

What is the rule of thumb? Ah hem; on a system with 32MB of RAM, one might want to set the minimum swap file to 80MB. On a system with 64MB set it to 128MB and so on.

What is the rule of thumb?
If you have 8MB (shiver and/or cringe) to 32MB of RAM, use a multiplier of 2.5, if your memory is between 32MB and 64MB use a multiplier of 2. If you have 64MB or more, use 1. What does this mean? If your system has 8MB to 32MB, you would take that figure and multiply it by 2.5. 32MB of RAM multiplied by 2.5 = 80. This means that I would set my swap file to a minimum of 80MB and a maximum of 80. As you can see, this is a base or a starting point. It can be adjusted up or down as needed. I have 128MB of RAM. Norton System Works indicated that I needed to increase my value to 255MB. Do I have a bunch running in the background? Not that I know of. I have suspended in one-way shape or form what I didn't need or want running in the background as a TSR.

I have, 256MB of SDRAM. I set the minimum and maximum swap file to 255MB. I don't let Windows operate it. The only thing I have to remember is, when I want to rip my drive apart and want some a semblance of order, the first thing I will do is let Windows manage the swap file back on the original drive. I run two drives and my file is on my backup or "D" drive.

As stated in the paragraph above, setting the maximum is as dicey as setting the minimum. There are those in either camp that will go toe to toe with you on this subject. However, according to ZD Journals issue they stated that, the debate centers on the fragmentation issue. This side says you should not set the maximum so that as the need arises, Windows can size the file as needed. However, the other side or the debate team says that allowing Window to size the swap file means it will become fragmented and performance will decrease. This side recommends that setting the maximum to the same value as the minimum or just a little more. Doing this will lock Windows in to a fixed size for the file and if the need arises, it can't expand. Nor will it become fragmented as is the case when one allows Windows to do the job on it's own. The other side retorts by saying if you set the minimum at a decent level, you won't have to worry because the swap file is unlikely to grow beyond that value on a regular basis so growth and fragmentation is or will be rare.

From the days of Windows 3X, I have learned to set the swap file to a set size, place it at the front of the drive for easy access by Windows and the system run. Today, I use Norton System Works with Norton Utilities and the "Speed Disk" feature does a wonderful job of putting the swap file in the front and keeping it from getting fragmented.

I realize that this post is lengthy but I feel that all concerned should have the best explanation possible on the subject.


Frank Suszka
NetTek Computers



Articles / Reviews



Free PC Tech

Copyright The NOSPIN Group, Inc. 1991-2006.  All rights reserved.