What is virtual memory?
Virtual memory is a technique used in
computers to access and save information in "abstract"
locations, rather than exclusively in RAM. This level of
abstraction is provided by the Operating System in
coordination with Hardware, and provides great flexibility
over a wider variety of computer configurations. In
specific, using virtual memory you can often accomplish more
with less RAM.
The whole issue starts with the fact that
computer programs can only operate from, and save and
retrieve working information directly to and from, "real
physical RAM". Though information and programs are stored on
your hard disk, they must be copied into RAM to be
Traditionally, when computer programs
used memory they would read & write information directly
to & from each "real physical RAM" location. For
example, if the "user name" was at memory location
"00001230", then it was actually at "00001230" in the
physical RAM computer chip.
In recent years, most operating systems
provide a new method called "Virtual Addressing". When
"Virtual Addressing" is enabled, each time a program
accesses memory the operating system "looks up" the "real
physical RAM" location corresponding to the "Virtual Memory"
location - then the program can save and retrieve
information to and from the appropriate "real physical RAM"
location. In this case, if the "user name" was at memory
location "00001230", then it may actually be at "00408740"
in the physical RAM computer chip (any RAM location).
Obviously, there is some overhead for the extra level of
processing when using Virtual
Memory. However, this extra level allows the operating
system to play tricks with "infromation stored" which may
provide more benefit than speed degradation. For example,
the size of Virtual Memory can be set larger than the real
Physical RAM, and hard disk memory can be used to store
information that will not fit in the RAM. In such a case,
the Hard Disk is called "backing
On the negative side, when the "information" stored at a "Virtual
Address" is not already in "real physical RAM", instead
being in "backing storage", then normal computer operation
must be suspended. At this time, called a "page fault", room is
made in "real physical RAM" (perhaps swapping information
out to backing storage), and the information is restored
into "real physical RAM" (swapping information in
from backing storage). "Thrashing" is a term often used to
refer to a computer when its memory is full enough, or the
virtual system is bad enough, that the "swapping" causes speed
degradation which is noticable. This often appears to users
as "jerky pauses without apparent cause".
On the positive side, computers perform the "Virtual Address" to "real
physical RAM" lookup in hardware, which can be extremely
fast. In the case where the information is already in
"physical RAM", the lookup has no speed penalty. This is why
you need at least a 68030 generation of computer hardware to
use Virtual Memory - it is simply too slow to "lookup" in
software, without the Memory Management Unit (MMU) hardware
only available in more recent processors. Wihtout an MMU,
every memory lookup, somthing that happens constantly, would
require significant extra work.
It is the objective of the Vitual Memory
system to minimize the negative impact using intelligent
information location management, while providing as much
memory as possible. A "good" virtual memory system should
not slow down as long as you use less of your virtual memory
than you have physical memory. Even better, such systems
should be able to operate smoothly when you are using more
than your real RAM, since most of what you are "using" may
be "idle" and can be left in backing storage. However, no
matter how good the memory management, eventually all VM
systems will slow down your machine if you stress them far
enough that it is not possible to keep all frequently used
memory in RAM.
Early Apple VM
The early Virtual Memory implementation
from Apple provided the simple benefit that you could
specify a "larger" amount of virtual memory than you had
"real physical RAM". This would be accomplished by
"Swapping" some data to the hard disk when not in use,
"Swapping" it back in when needed ("Swapping" other data
out). Since only one spot in memory may be touched at once,
it is possible to have an unlimited amount of memory this
The drawback where is that the "Swap" to
and from disk can slow the computer down since hard disks
are thousands of times slower than "real physical RAM". So,
the objective is to keep infrequenlty used memory on the
hard disk, and frequently used memory in RAM. Unfortunately,
Apple's implementation was very poor, even up to recent Mac
OS versions, and virtual memory slowdowns were noticable
under all conditions.
Drawbacks of traditional Apple
- Slow down resulting from poor
- Required reserved disk space equal to
What new innovations have there
First along came Connectix Virtual,
which was able to operate without reserved disk space equal
to VM size. Though this may have required some extra
processing, the advantage was obvious back in the days of
expensive disks. This product also supported some third
party accelerators that Apple VM did not support.
Next came Connectix RAM Doubler virtual
memory, whose main addition was
that it reserved some of your "real physical RAM" for use
"Swapping compressed data" in place of the "disk" backing
storage - since even compressing into RAM
may be much faster than using the disk. Though the result
here is that you have less "real physical RAM", since some
was in use by RAM Doubler for its own "compressed backing
storage" purposes, the product appeared to be faster than
traditional implementation. It is not clear where the speed
up came from, since undoubtedly a number of other invisible
optimizations were added as well. Moreover, the speedup was
never measured in any testing we are aware of.
Since then, a number of innovations,
mapping and others, have been added to Apple VM and RAM Doubler VM.
Most of the enhancements are optimizations on the
implementation and we are not aware of the details.