Visit >> My New BLOG!!!!

Sunday, August 12, 2007

Accelerate Windows Virtual Memory

The following tricks I will share to you can surely lessen hassle in your computer! As a look around on tip sites, I found a lot of myths and harebrained theories about optimizing virtual memory -- a few of them even very useful to me. This time I went to experiment Microsoft-approved ways to set Windows' memory management to full steam ahead.

Virtual Memory is an "imaginary memory area" supported by some operating systems (Windows but not DOS) in conjunction with the hardware. You can think of virtual memory as an alternate set of memory addresses. Programs use these virtual addresses rather than real addresses to store instructions and data. When the program is actually executed, the virtual addresses are converted into real memory addresses.

The purpose of this virtual memory is to enlarge the address space, the set of addresses a program can utilize. For example, virtual memory might contain twice as many addresses as main memory. A program using all of virtual memory would not be able to fit in main memory all at once. Nevertheless, the computer could execute such a program by copying into main memory those portions of the program needed at any given point during execution.

To facilitate copying virtual memory into real memory, the operating system divides virtual memory into pages, each of which contains a fixed number of addresses. Each page is stored on a disk until it is needed. When the page is needed, the operating system copies it from disk to main memory, translating the virtual addresses into real addresses. This process of converting virtual addresses into real addresses is called "mapping" and the process of copying of virtual pages from disk to main memory is known as paging or swapping.


How to Tweak Windows' Virtual Memory:

If you have only one hard drive, just leave well enough alone. But if you have two or more internal or external hard drives (not just disk partitions), your PC will be peppier if you keep the default paging file (what Microsoft calls the virtual memory disk space) on your boot drive (the one that holds Windows) and add a paging file to the second drive.

To do so, log in to Windows as an Administrator and verify that you have more than one hard drive in your computer: Click Start, Run, type "diskmgmt.msc", and press [Enter] to open the Disk Management utility (click Continue in the User Account Control, if necessary). The bottom pane shows each disk on your system and the drive letter that corresponds with each partition. To have only one new paging file, choose the fastest drive you have. Remember that an internal drive will be faster than an external drive in most cases. Note the drive letter(s) you'll use.

Now right-click My Computer and choose Properties. Select the Advanced tab. In the Performance section, click Settings and then the Advanced tab. Under Virtual Memory, click Change. You'll see a paging file size already listed on your Windows drive; leave it alone, or Windows won't be able to create a memory dump file with debugging info in the event of a particular type of system error.

Next, in the drive list select a partition on a different drive where you want to add another paging file. Select Custom Size if you want to set the size yourself and type in the initial and maximum size; Microsoft's rule is to make the file 1.5 times the amount of RAM in your system, or select System Managed Size to let Windows determine the size. Click Set, then OK.

If the partition you selected contains another installation of Windows, you'll receive an error message warning that the file pagefile.sys already exists there. As long as the two operating systems are not running at the same time using virtualization software, it's safe for you to overwrite or delete pagefile.sys, since Windows will re-create the file automatically the next time you boot that partition's Windows installation.

You'll see a reminder that the changes will take effect the next time you restart your system. Windows will most often use the paging file on the least-busy drive, which means your new paging file will do most of the work.

    This process was accidentally discovered by me when I experimented on My Computer and turned out to be CORRECT! Don't be afraid to experiment on your OWN computer. It's not dangerous as long as you know how to read and understand commands. =)

1 comment:

lmiller7 said...

I am amazed, someone who actually has some idea of what virtual memory is all about. Doing as the author suggests isn't a bad idea, but don't expect much from it. Most modern systems have enough RAM that the pagefile isn't accesed enough to make a real difference. Do not be mislead by the field "PF Usage" in XP's Task Manager. This is not actual pagefile usage but potential usage. The portion of the pagefile that is actually in use will usually be much smaller. Adding more RAM will do far more for performance than anything you could possibly do with the pagefile.

Larry Miler
Microsoft MCSA