The memory binding could be static or dynamic. In dynamic binding system, user-generated virtual addresses are mapped to physical addresses. This leads to better memory utilization.
The address generated by CPU is called a logical address, and the address seen by the memory unit is called a physical address. The physical address is loaded into the memory-address register of the memory.
Logical vs. Physical Address
The compile-time and load-time address binding generate identical logical and physical address due to static binding techniques.
The logical address and physical address are part of the runtime address binding technique. They are different from each other. The logical address is also known as a virtual address. The virtual addresses are pages of fixed or variable size and the physical address are called frames that are part of memory hardware (RAM).
Memory Relocation and Address Spaces
Set of all logical addresses by a program is called its logical address space. Set of all physical addresses corresponding to physical address is called physical address space. The run-time mapping is done by hardware called the memory-management unit (MMU).
A simple MMU scheme is to change base register to relocation register. The value in the relocation register is added to every address generated by a user process (virtual address).
For example, if base = 15000, then access to location 540 is mapped to 15540 (physical address). MS-DOS with an intel 8086 used 4 such relocation registers to run processes.
The program uses the logical address to do all memory operations using virtual address e.g 540 without knowing the physical address e.g 15540.
Only when used as a memory address, it is relocated using relocation register and reference is completed by fetching physical memory address. The final location of the referenced memory address is not known until a reference is made.
So now, when user programs run, each program thinks that it has 0 to 2^N memory, but it must be mapped to (R+0) to (R + 2^N) with a base register value of R.
This logical address space binding to physical address space is the main concept of memory management.
References
- Abraham Silberschatz, Peter B. Galvin, Greg Gagne (July 29, 2008) Operating System Concepts, 8 edn., : Wiley.
- Ramez Elmasri, A Carrick, David Levine (February 11, 2009) Operating Systems: A Spiral Approach, 1st edn., : McGraw-Hill Education.
- Tanenbaum, Andrew S. (March 3, 2001) Modern Operating Systems, 2nd edn., : Prentice Hall.