Virtual Memory

A computer's operating system coordinates a mapping between a 'virtual address space', which is used by a program, and a physical address space, which addresses physical memory locations.

Tables 1 and 2, show that the program's virtual addresses in the range 0x00000000 to 0x00000016 are mapped to the physical address range 0x01AB0000 to 0x01AB0016; whereas the next six continguous memory positions 0x00000020 to 0x00000040 are mapped to the physical address range 0x994D0000 to 0x994D0020. The intent of these tables is to show that the continguous virtual address space is mapped to non-contigous regions of physical memory.

Using virtual memory provides the following key benefits:

An important aspect of virtual memory is that, whether or not it is used, it is transparent to the program running. From the program's perspective, it just has full access to all of addressable memory - whether the address a program accesses is the same as the physical address is irrelevant to the program.

Table 1. - Virtual Address Space
Virtual Address
0x0000 0000
0x0000 0004
0x0000 0008
0x0000 0012
0x0000 0016
0x0000 0020
0x0000 0024
0x0000 0028
0x0000 0032
0x0000 0036
0x0000 0040
...
0xFFFF FFF0
0xFFFF FFF4
0xFFFF FFF8
0xFFFF FFFC
Table 2. - Physical addresses mapped to
Physical Address Value stored at address
0x01AB 00000000 1001 1010 0000 0000 0000 0000 0000
0x01AB 00040000 1010 1010 0000 0000 0000 0000 0000
0x01AB 00080000 1001 0010 0000 0000 0000 0001 0000
0x01AB 00120000 1101 0001 0000 0000 0000 0000 0000
0x01AB 00160011 0101 0111 1100 1110 0010 0110 0110
0x994D 00000000 1001 1010 0000 0000 0000 0000 0000
0x994D 00040000 1010 1010 0000 0000 0000 0000 0000
0x994D 00080000 1001 0010 0000 0000 0000 0001 0000
0x994D 00120000 1101 0001 0000 0000 0000 0000 0000
0x994D 00160011 0101 0111 1100 1110 0010 0110 0110
0x994D 00200011 0101 0111 1100 1110 0010 0110 0110
...
0x039C 00000000 1001 1010 0000 0000 0000 0000 0000
0x039C 00040000 1010 1010 0000 0000 0000 0000 0000
0x039C 00080000 1001 0010 0000 0000 0000 0001 0000
0x039C 000C0000 1101 0001 0000 0000 0000 0000 0000

References