Revision on Virtual Memory
By James Dolphin 10G
What is Virtual Memory?
If your computer lacks the random access memory (RAM) needed to run a program or operation, Windows uses virtual memory to make up for it.
Virtual memory combines your computer’s RAM with temporary space on your hard disk. When RAM runs low, virtual memory moves data from RAM to a space called a paging file. Moving data to and from the paging file frees up RAM to complete its work.
The more RAM your computer has, the faster your programs will generally run. If a lack of RAM is slowing your computer, you might be tempted to increase virtual memory to compensate. However, your computer can read data from RAM much more quickly than from a hard disk, so adding RAM is a better solution.
How does it extend memory?
For example, if you load the operating system, an e-mail program, a Web browser and word processor into RAM simultaneously, 32 megabytes is not enough to hold it all. If there were no such thing as virtual memory, then once you filled up the available RAM your computer would have to say, "Sorry, you can not load any more applications. Please close another application to load a new one." With virtual memory, what the computer can do is look at RAM for areas that have not been used recently and copy them onto the hard disk. This frees up space in RAM to load the new application.
What are the benefits?
Virtual memory is a memory management scheme that allows the execution of processes even without loading them into the main memory. Where there is virtual memory in use, there is no need to load the entire process into the expensive main memory. The virtual memory concept also frees the programmer. The programmer no longer needs to worry about the size constraints of the physical memory on every computer his or her program is going to be used. He or she can better concentrate on the logic of the program. Programs do not always execute all parts or every statement of their code during a typical run. A large part of the code may be skipped on some condition check and may never be executed.
What are the drawbacks?
- Applications run slower
- It takes more time to switch between applications
- Less hard drive space for your use
The disadvantage is that Virtual Memory systems tend to be slow and require additional support from the system's hardware for address translations. It can be said that the execution speed of a process in a Virtual Memory system can equal, but never exceed, the execution speed of the same process with Virtual Memory turned off. Hence, we do not have an advantage with respect to the execution speed of the process.