Address Binding The concept of a logical address space that is bound to a separate physical address space is central to proper memory management Address binding of instructions and data to memory addresses can happen at three different stages 1.Compile time: If memory location known a priori,absolute code 对代码)can be generated; Must recompile code if starting location changes; Example:MS-DOS.COM-format programs 2.Load time: Must generate relocatable code(可重定位代码)if memory location is not known at compile time 3.Execution time: Binding delayed until run time if the process can be moved during its execution from one memory segment to another.Need hardware support for address maps(e.g.,base and limit registers) 主Q0
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Address Binding ▶ The concept of a logical address space that is bound to a separate physical address space is central to proper memory management ▶ Address binding of instructions and data to memory addresses can happen at three different stages 1. Compile time: If memory location known a priori, absolute code (绝 对代码) can be generated; Must recompile code if starting location changes; Example: MS-DOS .COM-format programs 2. Load time: Must generate relocatable code (可重定位代码) if memory location is not known at compile time 3. Execution time: Binding delayed until run time if the process can be moved during its execution from one memory segment to another. Need hardware support for address maps (e.g., base and limit registers)
Address Binding 1.In compile-time and load-time address-binding schemes: Logical addr physical addr CPU Logical address Physical address MM LAS PAS 4口”484在4色,主月QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Address Binding 1. In compile-time and load-time address-binding schemes: ▶ Logical addr = physical addr LAS CPU Logical address PAS MM Physical address
Address Binding 2.In execution-time address-binding scheme: Logical addr physical addr; need MMU Logical address Physical address CPU MMU MM LAS PAS 口”484在4色”主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Address Binding 2. In execution-time address-binding scheme: ▶ Logical addr ̸= physical addr; ▶ need MMU LAS CPU Logical address PAS MM Physical address MMU
Memory-Management Unit(MMU) MMU:Hardware device that maps virtual to physical address Example:dynamic relocation using 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 relocatio register 14000 logical physical address address CPU memory 346 14346 MMU The user program deals with logical addresses [0, MAX); it never sees the real physical addresses [R+0, R+MAX) 290
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Memory-Management Unit (MMU) ▶ MMU: Hardware device that maps virtual to physical address ▶ Example: dynamic relocation using 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 CPU relocation register MMU 14000 ✚✙ ✛✘+ logical address ✲ 346 physical address ✲ 14346 memory ▶ The user program deals with logical addresses [0, MAX); it never sees the real physical addresses [R+0, R+MAX)
Program loading linking Shall we put the entire program data of a process in physical memory before the process can be executed? For better memory space utilization 1.Dynamic loading 2.Dynamic linking 3.Overlays 4.Swapping 5.… 4口”4814在,4色,主)QC
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Program loading & linking Shall we put the entire program & data of a process in physical memory before the process can be executed? ▶ For better memory space utilization 1. Dynamic loading 2. Dynamic linking 3. Overlays 4. Swapping 5. …