About Virtual Memory
About Virtual Memory
Virtual memory is the part of system 7.0 that allows any Macintosh computer
equipped with an MMU to extend the available amount of memory beyond the
limits of physical RAM. Virtual memory extends the logical address space by
using part of the available secondary storage (such as a hard disk) to hold
portions of programs and data that are not currently in use. When an
application needs to operate on portions of memory that have been transferred
to disk, the Operating System loads those portions back into physical memory
by making them trade places with other, unused segments of memory. This
process of shuttling portions (or pages) of memory between physical RAM and
the hard disk is called paging.
For the most part, virtual memory operates invisibly to applications and to
the user. Most applications do not need to know whether virtual memory is
installed unless they have critical timing requirements, execute code at
interrupt time, or perform debugging operations. The only time that users
need to know about virtual memory is when they configure it in the Memory
control panel. One visible cost of this extra memory is the use of an equivalent
amount of storage on a backing device, such as a SCSI hard disk. Another cost of
using virtual memory is a possible loss of speed as paged-out segments of
memory are pulled back into physical memory. Performance degradation when
using virtual memory ranges from unnoticeable to severe, depending on the
ratio of virtual to physical RAM and the behavior of the actual applications
running.
The principal benefit of using virtual memory is that users can run more
applications at once and work with larger amounts of data than would be
possible if the logical address space were limited to the available RAM. Instead
of equipping a machine with amounts of RAM large enough to handle all possible
needs, a user can install only enough RAM to meet average needs. Then, when
more memory is occasionally needed for large tasks or many applications,
virtual memory can provide the extra amount of memory required. When
virtual memory is present, the perceived amount of RAM can be extended to as
much as 14 MB on systems with 24-bit addressing and as much as 1 GB on
systems with 32-bit addressing.
There are two main requirements for running virtual memory. First, the
Macintosh must be running system 7.0 or later. Second, the Macintosh must be
equipped with an MMU or PMMU. Apple's 68030-based machines have an
MMU built into the CPU and are ready to run virtual memory with only a
software upgrade to system 7.0; no additional hardware is needed. A Macintosh
II (68020-based) can take advantage of virtual memory if it has the 68851
PMMU co processor on its main logic board in place of the standard address
management unit. (The PMMU is the same co processor needed to run A/UX.)
Apple's 68000-based machines cannot take advantage of the virtual memory
capability of system 7.0, even though they can run system 7.0 if they have at
least 2 MB of RAM.
Users control and configure virtual memory through the Memory control
panel. Controls in this panel allow the user to turn virtual memory on or off,
set the size of virtual memory, and set the volume on which resides the
invisible backing-store file (the file that the Operating System uses to store
the contents of non-resident portions of memory). Other memory-related
user controls are combined in this control panel. These include settings for the
disk cache and for 24-bit or 32-bit Memory Manager addressing. If users
change the virtual memory, addressing, or disk cache settings, they must
restart the machine in order for the changes to take effect.
Note that the amount of virtual memory that users select in the control panel
is the total amount of memory that is to be available to the system (and not
simply the amount of memory to be added to available RAM). Also, the
backing-store file is as large as the amount of virtual memory. This
backing-store file might be located on any HFS volume that allows block-level
access. (This volume is known as the paging device or backing volume.)
Because the paging device must support block-level access, users cannot select
as the paging device a volume that they mount using AppleShare. Also, users
cannot select removable disks, including floppy disks, as paging devices.