Thursday, January 15, 2009

Optimize your Virtual Memory

The way virtual memory is configured tremendously affects Windows performance. This is true for all versions of Windows, including the now-obsolete Windows 3.1. The swap file is what Windows uses to store temporary data when it runs out of RAM. Thus, your working is not limited by the amount of RAM on your machine. However, for a program to be able to use this data, it must be transferred back to the RAM. The data that is not immediately required is moved to a part of the hard disk and recalled when required. However, since hard disks are nowhere as fast as RAM, swapping data back and forth drastically reduces speed. No matter how much RAM you have, Windows will always use the swap file for some infrequently used parts of the OS (read the next tip to see how to avoid this).

By default, Windows uses a variable swap file that is created on boot up and where the size is dynamically modified when required. Though this works just fine, it is not the most optimal. You can never get the speed of RAM from the hard disk, but you can make it slightly faster. The best way to configure the swap file is to have a permanent swap file, preferably on a dedicated partition. This minimizes the effect of disk fragmentation and increases seek time. Another practice that a few power users have adopted is to place the swap file on the first partition and the operating system on the following partition. Data closer to the center of the drive is read slightly faster than data at the periphery. This is especially useful for PCs with only 64 or 128 MB of RAM where data would frequently be swapped to the hard disk and can be easily done with BIOSes that allow booting from the D drive.

To change the swap file settings, open Control Panel > System > Performance and click Virtual Memory. Choose 'Let me specify my own virtual memory settings' and select the drive for the swap file. Note that no matter what partition you boot from, it will always appear as the C drive from DOS and Windows 98, and the first partition that is recognized as C by the BIOS will be assigned a higher drive letter. Set the minimum and maximum size for the swap file. Both these numbers should be identical to set a permanent (non-variable) swap file. Ideally, it should be two-and-a-half times the amount of RAM on your system, but if you have a separate partition for it, you may not want it to be less than 512 MB-if it is lower, it will have to be a FAT16 partition, not FAT32.