18 Sep 2010

Do I have enough memory for Windows?

RAM sticks in a motherboard

Recently I was tasked with resolving a performance issue on some PCs in the office.  They weren’t that old but seemed to get progressively slower after switching on until they were practically unusable.  Like many package PCs on the market, they had a decent CPU speed but were quite anaemic in the memory department. The solution? More RAM of course! Here’s a closer look why…

The fundamentals of memory management

Virtual Memory is not the Page File!

A common misconception is that Virtual Memory is just another name for the Page File, and thus the use of Virtual Memory is slow and undesirable. In fact every process running in Windows uses Virtual Memory except for a few low level kernel processes! Virtual Memory is a mediator of sorts between the running processes and the physical memory or Page File. Physical memory (the sticks of RAM installed in your computer) is a limited resource, while Virtual Memory is virtually unlimited.

If the memory load of the computer exceeds the available physical memory, Windows will make more space by shifting blocks of memory (pages) from the physical memory to the computer hard drive to a file called the page file. While physical memory is very fast to read and write, Page file memory is relatively very slow. This is because reading and writing to a hard drive is slow, especially in fragmented pieces and especially on a typical magnetic hard drive (something solid-state memory chips aren’t so fussed with).

Symptoms and diagnosis

It’s not lupus, so what are the symptoms to look out for?

Excessive hard drive activity.  High hard drive activity is normal during Windows start-up but if your PC is grinding to a halt and the hard drive light is going crazy chances are Windows is paging memory and the speed of the hard drive is the performance bottleneck. The solution isn’t a faster hard drive of course, but to avoid paging altogether by installing more physical memory.

Another guide to see if your system has been paging is to check the peak memory usage (in Windows XP) and ensure that it doesn’t exceed the physical memory size. This can be somewhat misleading however as peak memory usage could have been for just a moment or for a while.  If it’s only momentary, then it may not be an issue.  So use peak memory usage as a guide only.  You may also want to run this straight after Windows starts, and also with your typical applications open to see the memory load under different circumstances.

In Windows Vista and Windows 7 look at the Physical Memory Usage and ensure it’s not too high. If it is, you applications you’re running really need more physical memory, so it would be a good idea to upgrade the RAM.

The cure

RAM is cheap these days. It doesn’t hurt to play it safe and throw in a bit more. I would recommend you check your motherboard documentation for the type of RAM required (DDR, DDR2, DDR3), the speed, the maximum amount each slot can take, and the maximum the the system can take all up.  I’m not going to go into to detail on RAM timing and latency, but I would suggest two matching smaller sticks instead of one big stick (for example 2 x 2GB is better than 1 x 4GB). Modern motherboards can then read and write to the memory in dual-channel mode which is potentially faster by allowing greater throughput between the RAM and CPU.

Setting the size of the Page File is a touchy subject with many misconceptions. Some say set it to 1.5X the physical RAM, but this only works for older PCs with less RAM. I would suggest letting Windows manage the Page File and only manually setting this if really required.

Further reading

I found a great information page on the subject by Bruce Sanderson called RAM, Virtual Memory, PageFile and all that stuff if you’d like a more detailed explanation of the inner workings of Windows memory management.

About the Author:

Hardware and software engineer with experience in product development and building automation. Product Manager at NEX Data Management Systems, based out of Brisbane, Australia.

Leave a Reply