Managing The Swap File In Windows XP

By Team Digit Published Date
01 - Feb - 2005
| Last Updated
01 - Feb - 2005
Managing The Swap File In Windows XP
When an application finds that the amount of physical RAM on a computer is not enough for it to run, it uses hard disk space to compensate for the deficit in the amount of RAM needed by it. Windows XP allocates some amount of space for this by creating a page file named pagefile.sys, which is a hidden and system file on the system drive (the drive where Windows is installed). The page file is set by default to a minimum of 1.5 times and a maximum of twice the amount of physical RAM. This way, even on a machine with 128 MB of physical RAM, an application may utilise 4 GB of memory using the page file. Since the page file is present on the hard disk, it is, of course, much slower than physical RAM.

Step 1. Optimising Sysytem Performance
Virtual memory has to cater to programs as well as the system cache. Hence, system performance can be improved by setting the virtual memory to allocate more memory for programs and less to system cache if you are using your machine as a workstation, and vice-versa if you are using your machine as a server.

Use the Disk Defragmenter to compact scattered date to the beginning of the hard disk

Usually, the page file size is set to give you the best performance, but you may improve performance by altering some of its settings. Set the page file to reside on a drive other than the one where Windows is installed, and to a drive where files are least accessed.

Before doing this, though, it is advisable to defragment that drive. Also, if possible, this drive should be on another hard drive, preferably on a different controller. Keep in mind that this drive should not be on fault-tolerant systems like a RAID-7 configuration or on a mirrored drive, as this will reduce performance (also, the page file does not require fault tolerance). You may set both the minimum and the maximum size of the page file to twice the amount of RAM that you have installed. Keeping the page file size fixed will greatly improve system performance because the page file size will not have to be dynamically adjusted and hence it will not get fragmented. We shall see how this is implemented in detail in the following steps:

Step 2. Placing The Page File Efficiently

Defragmenting The Drive
As data is written to and read from a drive, it gets scattered over the drive over a period of time. A drive in this state is said to be fragmented and becomes slower to access. The 'Disk Defragmenter' is a utility which defragments or compacts all the scattered data to the beginning of the drive so that it becomes faster to access. After you choose the drive on which you wish to place your page file, you need to defragment it.

Click Start>All Programs>Accessories>System Tools>Disk Defragmenter to launch the utility. In the list shown, click on the selected drive. Click on 'Action' and then 'Defragment'.

This will start the defragmentation process.

Step 3. Accessing Virtual Memory Settings
Open the Control Panel by clicking Start>Control Panel. Double click on the 'System' icon if your control panel has the classic view. If it has the category view, click on 'Performance and Maintenance' and then on the 'System' icon. Now click on the 'Advanced' tab. Click on 'Settings' in the 'Performance' section.

The 'Advanced' tab in 'Systems Properties'

Next, choose the 'Advanced' tab. Select the drive where the page file is currently present, select 'No Paging File' and click on 'Set'.

'Advanced' setting in the 'Performance' menu

Now select the drive where you wish to place your page file, and select 'Custom size'. Enter a number that is twice the size of your installed RAM in the initial as well as maximum size dialog boxes and click on 'Set'. Now click OK thrice and restart the computer for the settings to take effect.

Final Words
Since no two computers behave the same, you need to experiment

In 'Virtual Memory' set the page file size

with the virtual memory settings to try and find what works best for you. Your PC will be the fastest in the neighbour-hood in no time.

Team DigitTeam Digit

All of us are better than one of us.