Basic Hardware Issues
Basic Hardware Issues
Main memory and the registers built into the processor itself are
the only general-purpose storage that the CPU can access directly.
There are machine instructions that take memory addresses as
arguments, but none that take disk addresses.
Therefore, any instructions in execution, and any data being used
by the instructions, must be in one of these direct-access storage
devices. If the data are not in memory, they must be moved there
before the CPU can operate on them. Registers that are built into
the CPU are generally accessible within one cycle of the CPU clock.
Basic Hardware Issues
For example, if the base register holds 300040 and the limit
register is 120900, then the program can legally access all
addresses from 300040 through 420939 (inclusive). Protection of
memory space is accomplished by having the CPU hardware
compare every address generated in user mode with the registers.
Any attempt by a program executing in user mode to access
operating-system memory or other users’ memory results in a trap
to the operating system, which treats the attempt as a fatal error.
The base and limit registers can be loaded only by the operating
system, which uses a special privileged instruction.
Address Binding
A program resides on a disk as a binary executable file. To be
executed, the program must be brought into memory and placed
within a process. Depending on the memory management in use,
the process may be moved between disk and memory during its
execution. The processes on the disk that are waiting to be brought
into memory for execution form the input queue.
The normal single-tasking procedure is to select one of the
processes in the input queue and to load that process into
memory. As the process is executed, it accesses instructions and
data from memory. Eventually, the process terminates, and its
memory space is declared available.
Address Binding
Addresses may be represented in different ways during these
steps. Addresses in the source program are generally symbolic
(such as the variable count). A compiler typically binds these
symbolic addresses to relocatable addresses (such as “14 bytes
from the beginning of this module”). The linkage editor or loader
in turn binds the relocatable addresses to absolute addresses (such
as 74014). Each binding is a mapping from one address space to
another.
Address Binding
Compile time: If you know at compile time where the process will
reside in memory, then absolute code can be generated. For
example, if you know that a user process will reside starting at
location R, then the generated compiler code will start at that
location and extend up from there.
Load time: If it is not known at compile time where the process will
reside in memory, then the compiler must generate relocatable
code.
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, as will be discussed Most general-purpose
operating systems use this method
Address Binding
Multistep processing of a user program.
Logical Vs Physical Address Space
An address generated by the CPU is commonly referred to as a
logical address.
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.
Logical Vs Physical Address Space