Hardware Reference
In-Depth Information
they need not correspond to memory locations 0 to 4095. We could, for example,
''tell'' the computer that henceforth whenever address 4096 is referenced, the
memory word at address 0 is to be used. Whenever address 4097 is referenced, the
memory word at address 1 is to be used; whenever address 8191 is referenced, the
memory word at address 4095 is to be used, and so forth. In other words, we have
defined a mapping from the address space onto the actual memory locations, as
shown in Fig. 6-2.
Address space
Address
4K Main
memory
Mapping
8191
4096
0
4095
0
Figure 6-2. A mapping in which virtual addresses 4096 to 8191 are mapped onto
main memory addresses 0 to 4095.
In terms of this picture of mapping addresses from the address space onto the
actual memory locations, a 4-KB machine without virtual memory simply has a
fixed mapping between the addresses 0 to 4095 and the 4096 words of memory.
An interesting question is: ''What happens if a program branches to an address be-
tween 8192 and 12287?'' On a machine that lacks virtual memory, the program
would cause an error trap that would print a suitably rude message, for example:
''Nonexistent memory referenced,'' and terminate the program. On a machine with
virtual memory, the following sequence of steps would occur:
1. The contents of main memory would be saved on disk.
2. Words 8192 to 12287 would be located on disk.
3. Words 8192 to 12287 would be loaded into main memory.
4. The address map would be changed to map addresses 8192 to 12287
onto memory locations 0 to 4095.
5. Execution would continue as though nothing unusual had happened.
This technique for automatic overlaying is called paging and the chunks of pro-
gram read in from disk are called pages .
A more sophisticated way of mapping addresses from the address space onto
the actual memory locations is certainly possible. To avoid confusion, we will call
the addresses that the program can refer to the virtual address space , and the ac-
tual, hardwired (physical) memory locations the physical address space .A mem-
ory map or page table specifies for each virtual address what the corresponding
 
 
Search WWH ::




Custom Search