NWA-PCUG Newsletter Article, May 2009
Computer Speed, RAM and Virtual Memory
Written by Brian K. Lewis, Ph.D.,
a member of the Sarasota Personal Computer Users Group, Inc., FL

http://www.spcug.org
bwsail at yahoo.com (click to email author)

This article has been obtained from APCUG with the author's permission for publication by APCUG member groups; all other uses require the permission of the author `(see e-mail address above).

One of the more frequent questions raised is: "will adding more physical memory (RAM), speed up my computer"? The answer is a qualified "maybe". The first thing you need to be aware of are the built-in bottlenecks that can slow down your computer. Programs and data move through your computer at different speeds in different locations. The central processor (CPU) is usually the fastest data handler in the system. The hard drive is the slowest and everything else, including the RAM, is intermediate in data handling speed. The speed of processing data in RAM is measured in billionths of a second, or nanoseconds, and the speed of accessing data on the hard disk is measured in thousandths of a second, or milliseconds. So, ideally, you want all the processing to go from RAM to the CPU and back to RAM. Unfortunately, that’s not always possible even if your system has the maximum amount of RAM installed.

Every computer running Windows, from several generations back, uses "virtual memory" in addition to RAM. The definition of "virtual memory" is based on redefining the address space to "trick" programs into thinking they are using large blocks of contiguous memory. Virtual memory is a space on the hard drive, frequently called a "swap file" or "page file". This is a block that is mapped for temporary storage of programs, data, and operating system essentials. This technique gives an application program the impression that it has contiguous working memory (address space), while in fact it may be physically fragmented.

Virtual memory was designed at a time when RAM was much more expensive than space on a hard drive. Even though RAM is now much less expensive, the latest versions of Windows (XP & Vista) still depend on virtual memory. In fact, much of the operating system kernel ends up in virtual memory. This kernel memory also controls the allocation of data to virtual memory. Consequently, it is not really possible to eliminate virtual memory when you are running Windows XP or Vista. If you do disable virtual memory, Windows becomes unstable.

In a 32 bit computer running Windows, the maximum memory that can be accessed by the CPU is 4 gigabytes (232). It can not access addresses beyond 4 gigabytes (GB). (A gigabyte is a billion bytes.) Not every computer can accept 4 GB of RAM. Some older computers are limited to 512 megabytes (MB) and still run Windows XP quite successfully. However, if you have a newer computer whose motherboard can accept 4 GB of RAM, you may not be able to fully access all of that RAM. In some cases, RAM is shared with the graphics system. This is usually referred to as an "integrated graphics card". In such a case, up to 1 GB of your RAM may be used by the graphics leaving only 3 GB for the rest of the system. Then Windows takes 2 GB of space leaving only 1 GB for user space (programs and data). Even if some of this is placed in Virtual memory, the CPU still has only 4 GB of addresses. If you have a graphics card with its own memory, Windows will allocate 2 GB to kernel memory and 2 GB to user memory. Since some of the kernel memory will be in virtual memory, your total memory will be a combination of physical memory (RAM) and virtual memory (hard drive), but the total will not exceed 4 GB in a 32 bit computer. Remember, the 4 GB limit applies to the number of addresses that can be accessed by the CPU. Those addresses can be on the graphics card, the hard drive or in physical memory (RAM).

Windows sets up the memory system by dividing memory into pages. The most recently accessed pages are in RAM. Any pages that have not been referenced in a while are written to the file on the hard drive. According to Microsoft the paging file in a 32 bit system can be a maximum of 16 terabytes (one terabyte equals 1000 gigabytes). So the total virtual memory pagefile system can exceed the 4 GB limit by a considerable amount. However, no more than the 4 GB can be actively handled at time. The inactive pages are stored on the hard drive.

Virtual memory not only operates at the speed of the hard disk data access, it also requires special handling before it can be used by the CPU or sent to the video screen. Pages on the hard disk have to be read into RAM to be used. That also means that the space they will take in RAM must be vacated. If there was data there, it must be written to the hard drive, before the new pages can be read into RAM. This paging process must also be managed. Some memory is used just to keep track of which pages are in RAM and which are in virtual memory. This is the role of the Virtual Memory Manager. All of these processes of reading and writing to and from RAM require time. As a result, virtual memory use does slow the computer more than the amount that is just due to the slower speed of disk access.

Before you decide that you need 4 GB of RAM to solve your speed problem, you need to determine how much RAM your computer is designed to accept. Computers in today’s market are sold with anywhere from 1- 4 GB of RAM. However, only a few years ago, computers were designed to accept a maximum of 1 GB of RAM or less. So you need to check your owners manual to see what the maximum RAM is for your computer. Then, if you don’t know how much is installed in your computer, bring up the the device manager window from the control panel. The first page will tell you how much physical memory you have in your system. You can also see the distribution of physical memory and virtual memory by bringing up the task manager (Ctrl-Alt-Del) and clicking on the Performance tab.

There are several other possible solutions to this problem. One is to look at your hard drive. If you have an older computer with an IDE drive, replacing it with a drive that has a SATA interface will speed up the data handling in virtual memory. Another change would be to purchase a graphics card with 256 – 512 MB of RAM and install it in place of the integrated video. That would release the RAM that was being shared with the video card.

The best, and most expensive, alternative for speeding up your computer is to replace your 32 bit computer with a 64 bit system. The 64 bit computers can access 16 exabytes of RAM (264). That is 16 million GB of RAM. Most of the 64 bit computers in todays market do limit physical RAM to anywhere from 8 to 256 terabytes. Not that we’re getting into any really large numbers here, but the amount of RAM in a 64 bit machine is more than adequate to reduce virtual memory to a bare minimum. The catch is that 64 bit machines have other problems, especially with the limited availability of 64 bit software and drivers for peripheral devices. So before you decide to switch to 64 bit computing you need to check out whether or not drivers are available for your peripherals.

Finally, if your hard drive is heavily fragmented, this will also slow down data reading and writing. Simply defragmenting your drive will speed up the drive input and output. It may also improve the computer’s boot time. As you can see, there are a number of things to consider if you need to speed up your computer.

Dr. Lewis is a former university and medical school professor of physiology. He has been working with personal computers for over thirty years, developing software and assembling systems.

Click here to return to top



==================================================================