Virtual Memory ("VM") refers to how the MacOS can use hard drive space to simulate extra memory. If the OS tries to access
a memory address that's currently not really in RAM, it needs to load it from the hard drive, then continue accessing it
as usual. Since hard drive accesses are much slower than RAM accesses (that's why a RAM disk is so interesting, after all)
those occasional accesses when a "page fault" occurs are much slower than accesses where everything is already in physical RAM.
An interesting dilemma arises when you have virtual memory enabled while using a RAM disk.
Should the RAM disk honor VM and allow itself to be paged out to a hard drive? Or should it force its contents to stay resident
in RAM?
If it forces itself to stay resident in RAM (ie, does not honor VM), that provides the fastest performance — for the RAM disk
itself. But it ensures that other programs will be paged to disk more frequently. So overall system performance will likely suffer.
We had a tough decision when we faced this issue. The answer we came to was this: if the user has turned on virtual memory, then
clearly the user accepts the performance-for-memory penalty inherent in using virtual memory. That's why ramBunctious honors VM:
because it's more clearly what the user wants.
Of course, ramBunctious's performance is maximized when virtual memory is turned off. The people who have typically found
ramBunctious RAM disks to be the most useful have been people with lots of RAM available; this leads us to recommend that for best
ramBunctious performance, virtual memory should be turned off.
|