Page 157 - DCAP103_Principle of operating system
P. 157
Principles of Operating Systems
Notes time. If the starting address changes, we need only to reload the user code to incorporate
this changed value.
4. Execution Time: If the process can be moved during its execution from one memory
segment to another, then binding must be delayed until run time. Special hardware must
be available for this scheme to work. Most general-purpose operating systems use this
method. A major portion of this unit is devoted to showing how these various bindings can
be implemented effectively in a computer system and to discussing appropriate hardware
support.
5.2 Logical versus Physical-Address Space
An address generated by the CPU is commonly referred to as a logical address, whereas an
address seen by the memory unit—that is, the one loaded into the memory-address register of
the memory is commonly referred to as a physical address.
The compile-time and load-time address-binding methods generate identical logical and physical
addresses. However, the execution-time address binding scheme results in differing logical and
physical addresses. In this case, we usually refer to the logical address as a virtual address.
We use logical address and virtual address interchangeably in this text. The set of all logical
addresses generated by a program is a logical-address space; the set of all physical addresses
corresponding to these logical addresses is a physical-address space. Thus, in the execution-time
address-binding scheme, the logical- and physical-address spaces differ.
The run-time mapping from virtual to physical addresses is done by a hardware device called
the memory-management unit (MMU).
This method requires hardware support slightly different from the hardware configuration. The
base register is now called a relocation register. The value in the relocation register is added to
every address generated by a user process at the time it is sent to memory. For example, if the
base is at 14000, then an attempt by the user to address location 0 is dynamically relocated to
location 14000; an access to location 346 is mapped to location 14346. The MS-DOS operating
system running on the Intel 80x86 family of processors uses four relocation registers when
loading and running processes.
The user program never sees the real physical addresses. The program can create a pointer
to location 346, store it in memory, manipulate it, compare it to other addresses-all as the
number 346. Only when it is used as a memory address (in an indirect load or store, perhaps)
is it relocated relative to the base register. The user program deals with logical addresses. The
memory-mapping hardware converts logical addresses into physical addresses. This form of
execution-time binding was discussed in section given above. The final location of a referenced
memory address is not determined until the reference is made.
We now have two different types of addresses: logical addresses (in the range 0 to max) and
physical addresses (in the range R + 0 to R + max for a bas value R). The user generates only
logical addresses and thinks that the process runs in locations 0 to max. The user program supplies
logical addresses; these logical addresses must be mapped to physical addresses before they are
used. The concept of a logical-address space that is bound to a separate physical address space
is central to proper memory management.
150 LOVELY PROFESSIONAL UNIVERSITY