Managing Memory and Disk Storage

A program is a set of executable instructions associated with a set of data. While a program is executing, the instructions and data are held in main memory (RAM-random access memory) where the CPU accesses them individually. In addition to reading data in memory, the CPU writes data to memory as the result of executing an instruction. The CPU gets instructions and data by referencing memory locations or addresses. It also returns data to specific memory locations.

On a conventional machine, the entire program must reside in memory before the program begins to execute. On some of those machines, the entire set of data must also be in memory. Thus the amount of memory on a system can limit the size of a program.

The mvBase environment is designed to overcome the limitations imposed by physical (RAM) memory. It is a disk-operated environment that uses the hard disk drive to expand the amount of addressable memory available to the environment. Because of virtual memory, the entire program or data does not need to be in memory; multiple user processes and processors can co-exist. Implementation of virtual memory is based on a map of the virtual memory storage files located on the hard disk drive, which is divided into directly addressable units called frames.

A frame is a fixed-length unit of storage containing instructions and data. A program or file might consist of several frames. Each frame has a unique address—a positive integer known as the frame ID or FID. (The maximum frame ID is dependent upon the amount of RAM and the size of the hard disk drive.) A reference to a memory location, or address, consists of the frame ID and the displacement from the beginning of the frame.

Through the host Windows operating system, mvBase manages the transfer of frames between RAM and the hard disk drive. First, the monitor function within mvBase must ensure that a frame is in RAM as it is needed. When a particular frame is referenced, the monitor function checks to see if that frame is already in RAM. If it is not in RAM, the monitor initiates the transfer of the frame from the disk drive.

In addition, the monitor must also make sure that frames are moved out of RAM if space is needed for new frames. If there is not enough space in RAM to bring in a new frame, then the monitor moves out least-recently used frames. In other words, when forced to move a frame out, the monitor selects the frame that has been in RAM the longest without being used. Periodically, when the system is idle, the monitor also flushes memory, writing frames back to the disk drive.

The virtual memory architecture of the mvBase environment is especially important for good performance in a time-sharing environment. At any given time, frames for several processes are in memory as they take turns executing on the CPU. Individual frames may have been transferred out, but it is unlikely that all frames associated with the process have been transferred back to disk.

Because of virtual memory, the mvBase environment and the host Windows operating system do not limit the size of programs or files based on the amount of RAM available in the system. Virtual memory also allows the mvBase environment to handle multiple processes efficiently with a smaller amount of physical memory.

See Also

Managing the mvBase System

Managing Users

Managing Peripheral Devices

Central Processor Scheduling

Managing Files