[ Home ] [ Site Map ] [ Site Search ] [ Back to last page ]
This white paper discusses virtual memory, also known as the swap file. I'll explain what it does, what the default setting is, and how to change it for IMHO (In My Humble Opinion) better performance.
From the Windows 95 Resource kit:
"Windows 95 uses a special file on your hard disk called a virtual memory swap file (or paging file). With virtual memory under Windows 95, some of the program code and other information are kept in random access memory (RAM), while other information is swapped temporarily to virtual memory. When that information is required again, Windows 95 pulls it back into RAM and, if necessary, swaps other information to virtual memory. This activity is invisible, although you might notice that your hard disk is working. The resulting benefit is that you can run more programs at one time than the computers RAM would usually allow.
The Windows 95 swap file is dynamic, so it can shrink or grow based on the operations performed on the system and based on available disk space. A dynamic swap file is usually the most efficient use of resources. It can also occupy a fragmented region of the hard disk with no substantial performance penalty.
Tip
The single best way you can ensure high swap file performance is to make sure that the disk containing the swap file has ample free space so that the swap file size can shrink and grow as needed.
The Windows 95 swap file (Win386.swp) is not a permanent file. However, Windows 95 can also use a permanent Windows 3.1 swap file. In this case, the file cannot shrink below the permanent size set for it in Windows 3.1, although the file can grow bigger if required.
Under Windows 95, the swap file can reside on a compressed drive if a protected-mode driver (that is, Drvspace.vxd) controls the compressed drive. DriveSpace marks the swap file as uncompressible and places the swap file as the last file in the sector heap (to reduce the risk of fragmentation), allowing room for the swap file to grow.
Although the system defaults usually provide the best performance, you can adjust the parameters used to define the swap file. For example, to optimize swap file performance on a computer with multiple hard disk drives, you might want to override the default location of the Windows 95 swap file. The swap file should be placed on the drive with the fastest performance, unless that disk is overused. If a user usually loads all software from the same drive in a computer that has multiple drives, performance might be boosted by placing the swap file on one of the drives that is not as busy.
Caution
Completely disabling virtual memory might cause the computer to stop operating properly. You might not be able to restart the computer, or system performance might be degraded. Do not disable virtual memory unless instructed to do so by a product support representative.
To adjust the virtual memory swap file
In Control Panel, double-click System, click the Performance tab, and then click Virtual Memory.
To specify a different hard disk, click the Let me specify my own virtual memory settings option. Then specify the new disk in the Hard disk box. Or type values (in kilobytes) in the Minimum or Maximum box. Then click OK
If you set the maximum swap file size in the Virtual Memory dialog box to the amount of free space currently on a drive, Windows 95 assumes that it can increase the swap file beyond that size if more free disk space becomes available. If you want to impose a fixed limit on the swap file size, make sure that the limit you choose is less than the current maximum."
Let's say you have 64 megs of ram in your 'puter. After Win95 loads you probably have 44 megs of ram (or less) free. As you start (load) programs more ram is used. It's quite possible to have only 3 or 4 programs running and run out of available memory. This means no more programs could start till you close the open programs.
It gets worse. Some programs use more memory as you use them. In this case, running out of free memory could cause a crash, or worse, lost data! Some programs when closed don't give back all the memory they used right away, and some not at all.
Let's say you're creating a document in Word. Since Word holds the document in memory, the larger the file gets, the more memory is used. Now picture this, you're a slow typist (like me), and you've been working on a resume for the last couple of hours. For some reason (you're brain-dead) you haven't saved it as you've been working on it. Suddenly you run out of free memory and Word crashes! Gee, Windows would never do that.
Here's where virtual memory comes in. Windows will pretend that your hard drive is memory (ram). As that resume gets larger and you run out of memory Windows takes either (or both) a running program that's idle (not currently doing anything), or part of the OS (Operating System) that's not in use and swaps it out of memory and writes it to the hard drive (virtual memory). This will free memory for the program that needs it.
This will keep you from crashing. There is a penalty here though, your hard drive is much slower than ram (memory)! Plus it takes more CPU (processor) to read and write to the hard drive than to read and write to ram. Most people see an average performance loss of around 10-15 percent when Windows is actively swapping to the hard drive.
The best solution is to buy more memory than you'll ever use (ya, right). My laptop has 96 megs of ram, and my main 'puter at home has 256 megs of ram. And I still hit the swap file from time to time!
The other option is to create a permanent swap file of a fixed size. Here's the value of doing so...
The first time virtual memory is needed after starting Windows the OS has to take the time to create the swap file. This takes CPU away from the program(s) you're running. If more has to go into the swap file Windows must again take CPU time to enlarge the swap file. There is also a greater possibility of the swap file being fragmented, which will slow down both the reading and the writing to the file.
By creating a permanent swap file of a fixed size these problems don't exist anymore. Since hard drive space is cheap, losing a couple hundred megs of free space is a very small price to pay for the performance increase.
The only risk here is if you don't create a large enough swap file. It would be just like running out of memory, crashes, lost data, etc...
There has been a lot of discussion, arguments, and flame wars about what is a good size to make the swap file. The best rule of thumb is to make it 2.5 times system memory. So if you have 32 megs of ram, you should make the swap file 80 megs in size. I tend to add a lower limit as well as an upper limit here too. I always make the swap file at least 150 megs and no more than 300 megs in size. Call me paranoid! Too much won't hurt anything, while too little will.
After a number of emails from Ron Martell (Microsoft MVP), I've decided to add more info here so you can make a better choice for your self. This has always been an item of great discussion and heated debate. But Ron sums it up quite nicely.
He states that by setting only the minimum size of the swap file (leave the maximum size alone) you will get all of the benefits but none of the risks.
I have always set both the MIN and the MAX to the same size. Ron does have a point here. If you set both the MIN and MAX and Windows finds a need for a larger swap file all sorts of nasty things *might* happen...out of memory errors, program crashes, and so on. My desire is to keep Windows from dynamically resizing the swap file...Ron points out that if you set the MIN size high enough, you won't get the performance hit UNTIL Windows needs a larger swap file...good point.
So if you choose to only set the MIN size setting, you might want to use a good sized number like 200 megs or greater. Yes, this could waste some hard drive space, but hard drives are truly cheap today, and most teachers have more than enough free space.
FYI...on my desktop I set the MIN to 400 megs and on my laptop I set the MIN to 200 megs of disk space.
Now you can decide for yourself :-)
First, re-boot the 'puter. Then close any running programs, better safe than sorry. Then open the control panel by going to start | settings | control panel. Then double-click on System, when the new window opens, click on the Performance tab.
Here's what you'll see. Now, click on the Virtual Memory button.
The default setting here is to Let Windows manage my virtual memory settings.
First you'll click the radio button to Let me specify my own virtual memory settings.
Next, you need to chose which hard drive to put the swap file on, if you only have a C drive ignore this part. The fastest drive is the best choice. Another choice is to use a drive that doesn't have much activity on it. Note: I'm talking real hard drives here, not partitions. If you only have one hard drive put the swap file on the C drive.
Next you set the Minimum and Maximum sizes. Some people like to set the minimum but leave the maximum open. This defeats at least half the benefit of doing this. The swap file can still fragment, and if the swap file needs to grow above the minimum size Windows will have to take CPU time to increase it.
Now you click ok.
This window will pop up. While it sounds scary, you don't need to worry.
This would only be a problem if you had (as an example) 8 meg of ram, set the minimum and maximum to 24 megs, and had a lot of programs loading on bootup. In that case you'd get some out of memory error messages and some programs wouldn't start or Windows would crash, or both.
In that event you'd simply boot into safe mode and change it again. So just say yes (grin)! Then click close on the main window.
Then this window will pop up. Click yes here and your 'puter will re-boot.
You did close all running programs, didn't you? The change will take affect when Windows restarts.
[ Home ] [ Site Map ] [ Site Search ] [ Back to last page ]