Wednesday, October 21, 2009

Virtual Memory, Pagefiles and RAM

Back when Microsoft started out as a DOS based system any program you wanted to run had to be done one at a time. Compared to today's standards it was a very archaic, slow and inefficient way to get anything accomplished. With the advent of Microsoft Windows 3.0 a user could now do more than one thing at a time on their computer. The only limitations were the computer hardware abilities, which still weren't much to speak of.  But hey, you could run a game of solitaire and and your write program at the same time!
As Microsoft "improved" on its Windows product, hard drive space and physical RAM became more and more important. People needed to be able to run multiple programs at a time for peak efficiency. Most computer systems are limited in the amount of physical ram that can be installed in them. The limitations of physical ram won't stop Microsoft though, so they started utilizing virtual memory. Virtual memory uses extra storage space on your hard drive to simulate physical memory. This is why it's always a good idea to have lots of extra hard drive space. If you have ever used your hard drive space until it was almost all gone, you may have noticed that your computer runs a lot slower. This is because Windows no longer has that space to use for memory and storing information it needs beyond your computers physical ram. The physical ram holds portions of the operating system and programs currently in use or often used for easy and quick access. To free up space in the physical ram storage your hard drive space gets used for data that is not immediately needed, but should be readily available for efficiency. When you open many programs at once your physical ram can get used up quickly. This is when Windows swaps data from your hard drive (virtual ram/pagefile) back to your physical ram as needed.
As programs become larger and more complex with better graphics and more features, hard drive space has also increased as well as the amounts of physical ram your computer can have installed in it. Your pagefile, or virtual memory, expands the physical ram of your computer so you can do more faster. Any phycical ram overflow to space on your hard drive is called swap space. Generally your swap space should be twice the size of the physical ram installed into your computer. Swap space is divided into segments, called pages. These pages each have a unique address that can be referenced when needed. When an address is referenced, the page can be swapped into memory. This page is returned to your hard drive when no longer needed and other pages are then called.
Since your computer typically moves only as fast as its slowest component, it is always a good idea to create your pagefile, or virtual ram, on a second hard drive. While this is not always possible, it's the best practice since your main computer hard drive is used frequently and most activity occurs on it. A second hard drive would typically have less data traffic and increase the speed of your computers access to the virtual memory you have set up. Another best practice is to typically let Windows adjust your virtual memory for you, unless you know what you are doing. If you adjust your pagefile, or virtual memory, too low or too high, you may encounter problems running some software programs.