Windows 98 and Windows Me are configured by default to use a dynamic swap file. Having a dynamic swap file allows the operating system to enlarge and shrink the swap file as the application’s needs change. This dynamic system has three main problems: it isn’t really necessary with the current size of hard disks, it carries a lot of unnecessary overhead, and it causes the swap file to quickly and easily become fragmented. The latter two problems can really affect the operating system’s performance. I always advocate using a permanent swap file in Windows 98 and Me.
I’ll describe in detail the inefficiencies that I’ve discovered with the dynamic swap file system. I’ll then show you how to improve Windows 98/Me’s overall performance by configuring the operating system to use a permanent swap file.
Large hard disks
One of the primary factors behind the invention of the dynamic swap file system was finding a better way to deal with the limited size of hard disks that were available when Windows 98 first came out. The idea was that since hard disk space was at a premium, it would be better to allow 98 to tailor the size of the swap file according to the system’s needs and the amount of available space on the hard disk. This setup would allow the use of more hard disk space for installing more applications and storing more data. Now, with the typical size of current hard disks in the multiple gigabytes, conserving hard disk space isn’t as important as it once was.
Even though the size of a typical hard disk has grown quite a bit since Windows 98 first came out, Microsoft decided to leave the dynamic swap file scheme in place when it released Windows Me. Windows NT, 2000, and XP all use a permanent swap file scheme.
Using the swap file means a lot of overhead. In fact, the swapping process is almost continuous when you simultaneously run multiple applications because Windows is constantly moving sections of program code back and forth between RAM and the swap file in order to give the active application all the attention that it requires.
Add to this regular work the tasks of analyzing the ideal size for the dynamic swap file and then resizing it, and you’ll begin to see the unnecessary overhead brought on by the dynamic swap file management scheme. The time that Windows spends managing the swap file keeps the CPU busy, limiting the amount of time the CPU can spend performing other necessary tasks. In addition, resizing the swap file keeps the hard disk tied up, which can prevent efficient use of the disk cache.
One of the biggest problems with the dynamic swap file scheme has to do with how disk space is allocated. When it comes time to expand the dynamic swap file, Windows must seek out available space on the hard disk on which to place the addition. Just like a regular data file, if the next available space isn’t adjacent to the last used space, the swap file will become fragmented. Since a dynamic swap file can expand and shrink many times during the course of a computing session, the fragmentation problem can very easily get out of hand. Once the swap file becomes fragmented, performance suffers dramatically because Windows must spend even more time managing the swap file.
Configuring a permanent swap file
Microsoft has provided the option to disable the dynamic swap file scheme and implement a permanent swap file instead. To do so, open Control Panel and double-click on the System icon. Then, select the Performance tab and click the Virtual Memory button near the bottom of the tab. You’ll see the Virtual Memory dialog box. Once you do, select the Let Me Specify My Own Virtual Memory Settings option. You’ll see that the settings below it become active, as shown in Figure A.
|You can disable the dynamic swap file scheme and then specify a permanent swap file.|
If you have more than one hard disk in your system, first decide where to put the swap file. If you only have one hard disk in the system, you don’t have a choice. If you have more than one hard disk, the Hard Disk drop-down list will show you both disks and list the amount of free space on each disk. If you have a second hard disk in your system, you’ll get even better performance out of the swap file if you place it on the second hard disk because this will better distribute the operating system’s hard disk access—one drive for the operating system and the other for the swap file.
Minimum setting strategy
When deciding on the value to configure as the Minimum setting, I stick to a rule of thumb that states that you multiply the amount of RAM in your system by a specific value that is dependent on the amount of RAM, and then adjust the Minimum setting accordingly. Doing so generally provides optimal results. Table A lists the values you should use depending on the amount of RAM in your system.
For example, if the system has 64 MB of RAM, you’ll multiply that by 2 and set the Minimum setting to 128 MB. If the system has 512 MB, you’ll multiply that by 1 and set the Minimum setting to 512 MB.
Maximum setting strategy
When it comes to setting the Maximum value, there is some controversy. I advocate that you leave the Maximum setting at its default, which is the total amount of free space on the hard disk. This will allow the operating system to expand the swap file beyond the Minimum value setting if, and only if, it needs to do so. My thinking here is that if you specify a sufficient value for the Minimum setting, the swap file is unlikely to grow beyond that value on a regular basis, so swap file growth and, subsequently, fragmentation will be rare occurrences.
Optional Maximum setting
As an alternative to the previous strategy, some of my colleagues advocate specifying a value for the Maximum setting that is equal to or slightly greater than the Minimum value setting. Doing so locks the swap file to a specific chunk of the hard disk and prevents it from ever becoming fragmented. Either Maximum setting works fine. After all, the real goal is to increase performance by disabling the dynamic swap and using a permanent swap file instead.
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.