- Created by: Jake Popple
- Created on: 04-05-12 09:25
Sometimes, computers don't have enough memory (RAM) to run all of the applications that they want to. When this happens, they can make use of something called 'virtual memory'.
Virtual memory is when the computer uses some of its hard disk space as if it were RAM. If you had open and were running ten applications at the same time (for example, the operating system, a word processor, a music program, a messenger program and so on), the amount of RAM these applications might need could add up to a total of 4.2 Gigabytes, for example. But imagine if your computer only had 4 Gigabytes.
Fortunately, it would still be able to run all 10 applications. It can find the extra 0.2 Gigabytes of memory it needs by using some of its hard disk space as if it were RAM. It is using the hard disk as it were 'pretend RAM'. This pretend RAM is known as 'virtual memory'.
- What the computer can do is to store all of the applications it possibly can in RAM.
- It then stores the last little bit of an application it needs on the hard disk.
- When the CPU needs to run the instructions that make up an application on the hard drive, it first of all frees up some space in RAM.
- It does this by moving some of the applications in RAM to the hard drive.
- Then it moves the application it needs from the hard drive to RAM and runs it.
In Windows, the area on the hard disk which is used for virtual memory is known as the 'swap file'.
There is a potential problem with using virtual memory. Secondary storage devices are much slower than RAM. If you spend a lot of time swapping parts of applications in and out of RAM to and from the hard disk, you may end up slowing the computer right down. This is known as 'disk threshing' (you will also see it called 'disk thrashing' in some books). Virtual memory works really well as long as you only need to use it to increase the total possible memory space in RAM by five per cent or so. Anymore, and you might have to sit there watching your computer, as it takes seconds or even minutes to swap applications out of the hard disk and into RAM.