HOME
TOPICS
SEARCH
ABOUT ME
MAIL

 
  technofile
Al Fasoldt's reviews and commentaries, continuously available online since 1983

Speed up Windows by taming Vcache and the swap file


By Al Fasoldt
   Copyright © 1998, Al Fasoldt
   Both modern versions of Windows (95 and 98) are hobbled by two major flaws in the way the operating system handles file and data caching. The flaws are easy to fix. This article tells you how to do it.
   Before we go any further, please understand that I will not be responsible for any problems you might have with your PC. This is a simple change, and you're not likely to have any difficulty, but please pay attention to the instructions. When you voluntarily change the way your PC works, you have to be careful, no matter how big or small the change is.
   Flaw No. 1: The vicious Vcache.
   Vcache ("virtual cache," a name that makes no sense, since there's nothing "virtual" about it) is the system Windows uses to store recently used data. It's a disk cache with fancy features added. It works very well for the first few minutes. It works very badly after that.
   The reason? By default, Vcache grows as large as possible. If your PC has 64 megabytes of RAM, Vcache will quickly balloon and take up 30 to 40 megabytes of RAM. (The rest of the memory probably will be claimed by system functions, your browser and so on.)
   By itself, that's not bad. A big disk cache is wonderful, and one that uses otherwise unclaimed memory is even better. But that's where the problem comes in. If you use any memory or system-reporting utility to examine free memory in Windows 95 or 98, you'll notice that it's nearly always just a few kilobytes. That means nearly all available memory is used either by programs (including Windows itself) or by the disk-and-file cache.
   And that means any other programs can't possibly run -- they can't get any RAM -- until Vcache frees up enough memory for the programs you're trying to launch. You'd think that Microsoft would have designed Vcache to quickly unload all the RAM needed by new programs, but it didn't. Vcache groans and argues a bit, frees up a little memory, goes to sleep, wakes up and frees up some more, nods off again, and then ... well, you get the point. (All of this somnolence is readily visible if you monitor both free memory and the cache size.)
   At this point, you can't make Vcache release memory faster. (Anyone who comes up with such a real fix will win the hearts and minds of millions of Windows fans, I'm sure.) But you can make Vcache stop hogging all available RAM by limiting it to both a minimum and maximum size. In other words, you make Vcache stay the same size all the time.
   To fix Vcache, you need to add a few lines for the Windows Vcache settings to a file called SYSTEM.INI. Click the Start button and then click Run. Type "sysedit" and press Enter. Choose SYSTEM.INI from the windows that appear. Look for the word "vcache" (all lower case) surrounded by square brackets, like this: [vcache]. If you don't see it -- chances are you won't, unless you or someone else has already tweaked your PC -- you need to add it. (If you do see it, but nothing is listed in the [vcache] section, leave it there and add the lines described next.)
   You need to put a [vcache] section into SYSTEM.INI. You can put it anywhere (at the end of the file, or, as is common practice, right after the end of the [386enh] section). Hit Enter to create a blank line, then type [vcache] on a line by itself.
   The next two lines tell Windows how much memory, in bytes, to set aside for Vcache. I can't give you numbers that work for every PC because the amount depends on how much RAM the PC has. In general, if your PC has 16 to 32 megabytes, try 4096. Use 6144 if your PC has more memory. (If your PC has less than 16 megabytes, add memory. In the meantime, use 2048 or 3072.)
   Here's what the lines look like: [vcache]
MinFileCache=4096
MaxFileCache=4096

   Type them exactly as shown, substituting your own numbers if necessary. The save the SYSTEM.INI file and reboot.
   Flaw No. 2: The swamp file. Er, swap file.
   What happens when your PC runs out of RAM (or, as you can imagine, when Vcache hogs the RAM your PC desperately needs for programs)? Windows pretends real RAM exists in what it calls a swap file. (Technically, Windows is using a function of the processor chip along with some very clever code in the operating system.) Program sections that aren't doing anything are shunted off to the disk file, and the new program gets the real RAM.
   A swap file is better than a computer that stops running properly when it runs out of RAM. But swap files are very slow. They're even slower if Windows has to make the swap file larger or smaller, based on what the Vcache is doing and what programs are trying to run.
   And -- you guessed it -- that's just what happens by default in Windows 95 and 98. The swap file is tiny to start with, then grows as needed. This slows everything down.
   Microsoft did it this way because hard drives were expensive when Windows 95 was under development. They're very cheap now. A big swap file -- one that stays the same size all the time -- is practically essential if you want to get the most out of Windows.
   So here's how to make the swap file stay the same size.
   Right click My Computer and choose Properties, then Performance. Click the Virtual Memory button. Click "Let me specify my own virtual memory settings" and enter the same number in the "Minimum" and "Maximum" lines. The number is expressed in megabytes. If your PC has 64 megabytes of RAM or less, enter 64 on both lines. Enter 96 if your PC has more RAM than that. Then click all the OK buttons that you see and reboot.
   A variation on these instructions could be helpful if you have a second (or third) hard drive that is faster than your primary drive (the C: drive). When you are changing the size of the swap file, change its location to the fastest drive on your system. Some users even create a small partition at the outside of one of their drives and place nothing there except the swap file. You could make a 128-megabyte partition and use it that way. I've tried it, and it works very well.