Main Memory and Virtual Memory

The effective memory capacity of a system consists of the following two components:

  • Main memory

    This is the total amount of memory that is physically present.

  • Virtual memory

    This is an additional amount of memory whose existence is simulated by temporarily copying segments of main memory out to disk. The use of virtual memory enables the system to handle more processes than can fit into main memory at the same time.

To facilitate memory management, the system classifies each of the segments of main memory into one of the following three categories:

  • Available memory

    This is memory that is not assigned to an in-use process. The system is free to allocate this memory as the need arises.

  • Overlayable memory

    This is memory that is assigned to in-use processes, but which can nevertheless be overwritten if necessary. For data segments, the system must copy the data to a different location in main memory or to an overlay disk file before reusing the memory segment. For code segments, the system can simply overwrite the code segment with other code or data. The system can read the code segment back in from the object code file the next time it is needed.

  • Save memory

    Save memory consists of structures that, for performance reasons, must be kept in main memory at all times. The system never copies these segments out to disk, nor does it move them around in main memory except for stack stretches. (Refer to Preventing Stack Stretches later in this section.)

    When the processes in the mix require far more memory than exists as main memory, the processor is forced to spend a lot of time performing overlays. When the time spent performing overlays begins to significantly impair system performance, the situation is called thrashing.