4 minute read

Physical Computer Memory and Virtual Memory

Physical and virtual memory are forms of memory (internal storage of data). Physical memory exists on chips (RAM memory) and on storage devices such as hard disks. Before a process can be executed, it must first load into RAM physical memory (also termed main memory).

Virtual memory is a process whereby data (e.g., programming code,) can be rapidly exchanged between physical memory storage locations and RAM memory. The rapid interchanges of data are seamless and transparent to the user. The use of virtual memory allows the use of larger programs and enables those programs to run faster.

In modern operating systems, data can be constantly exchanged between the hard disk and RAM memory via virtual memory. A process termed swapping is used to exchange data via virtual memory. The use of virtual memory makes it appear that a computer has a greater RAM capacity because virtual memory allows the emulation of the transfer of whole blocks of data, enabling programs to run smoothly and efficiently. Instead of trying to put data into often-limited volatile RAM memory, data is actually written onto the hard disk. Accordingly, the size of virtual memory is limited only by the size of the hard disk, or the space allocated to virtual memory on the hard disk. When information is needed in RAM, the exchanges system rapidly swaps blocks of memory (also often termed pages of memory) between RAM and the hard disk.

Modern virtual-memory systems replace earlier forms of physical file swapping and fragmentation of programs.

In a sense, virtual memory is a specialized secondary type of data storage, and a portion of the hard drive is dedicated to the storage of specialized virtual-memory files (also termed pages). The area of the hard drive dedicated to storing blocks of data to be swapped via virtual memory interface is termed the page file. In most operating systems, there is a preset size for the page file area of the hard disk, and page files can exist on multiple disk drives. Users of most modern operating systems can, however, vary the size of the page file to meet specific performance requirements. As with the page file size, although the actual size of the pages is preset, modern operating systems usually allow the user to vary the size of the page. Virtual memory pages range in size from a thousand bites to many megabytes.

The use of virtual memory allows an entire block of data or programming (e.g., an application process) to reside in virtual memory, while only the part of the code being executed is in physical memory. Accordingly, the use of virtual memory allows operating systems to run many programs and thus, increase the degree of multiprogramming within an operating system.

Virtual memory integration is accomplished through either a process termed demand-segmentation or through another process termed demand-paging. Demand-paging is more common because it is simpler in design. Demand-paging virtual-memory processes do not transfer data from disk to RAM until the program calls for the page. There are also anticipatory paging processes utilized by operating systems that attempt to read ahead and execute the transfer of data before the data is actually required to be in RAM. After data is paged, paging processes track memory usage and constantly call data back and forth between RAM and the hard disk. Page states (valid or invalid, available or unavailable to the CPU) are registered in the virtual page table. When applications attempt to access invalid pages, a virtual-memory manager that initiates memory swapping intercepts the page fault message. Rapid translation of virtual addresses into a real physical address is via a process termed mapping. Mapping is a critical concept to the virtual-memory process. Virtual-memory mapping works by linking real hardware addresses (a physical storage address) for a block or page of stored data to a virtual address maintained by the virtual-memory process. The registry of virtual address allows for the selective and randomized translation of data from otherwise serial reading drives. In essence, virtual-memory processes supply alternate memory addresses for data, and programs can rapidly utilize data by using these virtual addresses instead of the physical address of the data page.

Virtual memory is a part of many operating systems, including Windows, but is not a feature of DOS. In addition to increasing the speed of execution and operational size of programs (lines of code), the use of virtual memory systems provide a valuable economic benefit. Harddisk memory is currently far less expensive than RAM memory. Accordingly, the use of virtual memory allows the design of high-capacity computing systems at a relatively low cost.

Although swaps of pages of data (specific lengths of data or clocks of data) via virtual-memory swaps between the hard drive and RAM memory are very fast,an over-reliance upon virtual-memory swaps can slow overall system performance. If the amount of the hard drive dedicated to storing page files is insufficient to meet the demands of a system that relies heavily on the exchange of data via virtual memory, it is possible for users to receive "OUT OF MEMORY" messages and faults, even though they have large amounts of unused hard disk space.

By early 2003, personal computers with RAM capacities of 1024 MB (1 mega byte = 1,000,000 bytes) were widely available in the United States and many brands of personal computers boasted hard disk capacities of 60 GB (1 giga byte equals 1 billion bytes). The relative limits of both hard disk capacity and RAM memory capacity improve steadily with advances in microchip technology.

Additional topics

Science EncyclopediaScience & Philosophy: Cluster compound to Concupiscence