Jump Development Banner

RC Icon

RAM Charger 8 For Macintosh
Home | Search | Support | Contact | Download | Order

 



Virtual memory (Apple VM & RAM Doubler VM)...


 

(Tech0008A -- 03/03/98)


What is virtual memory?

Virtual memory (VM) is the computer technique of saving and accessing information via "abstract" locations, rather than using "fixed" physical locations. It is a system wide abstraction that is provided in coordination with hardware. Using VM provides great flexibility over a wider variety of computer configurations. This flexibility helps accomplish more with less Random Access Memory (RAM).

The whole issue starts with the fact that computer programs can only operate within "real physical RAM". This is because all other storage hardware is much too slow for regular operation. As a result, information and programs stored on your hard disk must be copied into RAM to be used (this is why opening an application or document takes time, noisily spinning your hard disk).

Before VM, when computer programs used memory they would read and write information directly to & from each "real physical RAM" location. For example, if the name "George" was at memory location "00001230", then "George" was actually at "00001230" in the physical RAM computer chip. This "pre-VM" technique wasted valuable RAM when could not be packed efficiently; it also precluded use of slower and cheaper storage locations for information rarely used.

However, in more recent years most operating systems provide a new method called "Virtual Addressing". When "Virtual Addressing" is enabled, the information at a memory location may actually be stored anywhere - the operating system "looks up" the "real physical RAM" location corresponding to the "Virtual Memory" location when required. For example, though "George" was in VM location "00001230" it may actually be stored at "00408740" in the physical RAM computer chip. The VM abstraction provides opportunity for more efficient and creative storage.

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 "information 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 storage can be used for information that will not fit in the RAM. In such a case, the Hard Disk is called "backing storage".

On the negative side, when required "information" stored at a "Virtual Address" is 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 required information is moved into "real physical RAM" (swapping information in from backing storage). "Thrashing" occurs when memory is full enough, or the virtual system is bad enough, that the "swapping" causes speed degradation which is noticeable. 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 required 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 in more recent processors. Without an MMU, every memory lookup would require significant extra work which might slow down the computer by multiple factors.

It is the objective of the Virtual 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 way.

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 infrequently 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 noticeable under all conditions.

Drawbacks of traditional Apple VM

  • Slow down resulting from poor implementation
  • Required reserved disk space equal to VM size

What new innovations have there been?

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, including file 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.

 

See Also



Home | Search | Support | Contact | Download | Order
Translate to: Français | Deutsch | Italiano | Português | Español

Please direct corrections and comment to RAMCharger (at) RAMCharger.com

Copyright © 1995-98 Jump Development Group, Inc. All rights reserved. Jump, OptiMem, RAM Charger, and More About This Mac are trademarks of Jump Development Group, Inc. Apple and Macintosh are registered trademarks of Apple Computer, Inc. All other trademarks are the property of their respective holders.