|PC911 > How-To > Windows > Managing the Windows Swap File|
- Grogan -
Download this article as a self-extracting text file
View this article in printer-friendly plain-text format
E-mail this article to a friend
What is the Swap File?
To execute a program in Windows, it first needs to be loaded into memory (RAM). Windows lets you run multiple programs simultaneously and chances are that they won't all fit into memory at the same time. For that purpose, Windows uses what is called Virtual Memory to simulate RAM, pretending it has more memory than what is actually build into the PC. It does this by moving data from real memory to a special file on the hard drive, called the swap file in Windows 95/98 or page file in Windows NT. This, in effect, allows Windows to address more memory than the amount of physical RAM installed. Without it, we would not be able to run windows on machines with limited RAM. For example, think back to when Windows 95 first came out, the average computer had 8 to 16 Mb of Ram. It would not have been possible to run Win95 and applications without using virtual memory. Program code and data are moved in pages (memory allocated in 4K or 16K segments within a 64K page frame) from physical memory to the swap file. As the information is needed by a process, it is paged back into physical memory on demand and, if necessary, windows may page other code or data to the swap file in its place.
The Windows Managed Swap File Grows and Shrinks
By default, windows manages the swap file dynamically, meaning that Windows increases and decreases its size as needed. For most users it is recommended to let Windows manage it to ensure that there is always sufficient memory addressing for applications and processes. The advantage of a dynamic swap file is that it does not permanently make hard disk space unavailable, it can only grow if there is sufficient disk space. When you shut down, the swap file is being deleted. It is re-created again when Windows is started. The disadvantage of a Windows managed swap file is that it becomes fragmented, and performance can be lost due to frequent resizing as your computer is performing memory intensive tasks. Fortunately, educated users of Windows can specify their own virtual memory settings if they deem it necessary.
Specify Your Own Virtual Memory Settings
You access these settings from within the System Control Panel applet. The easiest way to get to that from the Desktop is to right-click on the My Computer icon and choose Properties from the menu. Another way is to click Start/Settings/Control Panel/System. Click the Performance tab and click the Virtual Memory button.
If you see this for the first time, the option Let Windows Manage my virtual memory is probably selected and the other fields are grayed out. Click the Let me specify my own... and choose the drive you want to put your swap file on by clicking the drop list in the Hard Disk field and state the minimum and maximum swap file size in the appropriate fields.