Addresses that are used by programmers are known as virtual addresses, and the set of such addresses is known as the address space. Space or spot where the address is saved in the main memory is referred to as location or physical address and the set of such locations is known as the memory space.
Therefore, the address space is the set of addresses generated by programs as they reference instructions and data. The memory space holds the actual main memory locations that are directly addressable for processing.
Example − Consider, main-memory having a capacity of 32K words (K = 1024). 15 bits are required to define a physical address in memory since 32K = 215. Suppose that the computer has possible auxiliary memory for saving 220 = 1024K words. Therefore auxiliary memory has a storage capacity similar to the capacity of 32 main memories. If the address space is indicated by N and the memory space by M, we can have for this example N = 1024K and M = 32K.
In a multiprogramming computer system, programs and information are moved to and from auxiliary memory and main memory when needed by the CPU. Suppose Program1 is presently being implemented in the CPU, Program1 and an area of its related data are sent from auxiliary memory into main memory as displayed in the figure.
The associated programs and data require not to be in adjacent areas in the memory, because data is being transferred in and out, and null spaces can be distributed in the memory.
In a virtual memory system, programmers create to understand that they have the total address space for their use. It can also the address field of the instruction code has an efficient number of bits to determine all virtual addresses.
Suppose, the address field of an instruction code includes 20 bits, but physical memory addresses can only be defined with 15 bits. As a result, the CPU will reference instructions and information with a 20-bit address, because the information at this address should be taken from physical memory. After all, the approach to auxiliary storage for single words would be intensely high.
Therefore, a table is required to map a virtual address of say 20 bits to a physical address of say 15 bits. Mapping is an active procedure, which defines that each address is interpreted immediately as a word is referenced by the CPU.