Logical Address
It is a virtual address generated by the CPU while a program is running. It is referred to as a virtual address because it does not exist physically. Using this address, the CPU access the actual address or physical address inside the memory, and data is fetched from there.
The hardware device called Memory Management Unit (MMU) is used for mapping this logical address to the physical address. The set of all logical addresses generated by the CPU for a program is called the logical address space.
Physical Address
Physical Address is the actual address of the data inside the memory. The logical address is a virtual address and the program needs physical memory for its execution. The user never deals with the Physical Address. The user program generates the logical address and is mapped to the physical address by the Memory Management Unit(MMU).
The set of all physical addresses corresponding to the logical addresses in the logical address space is called the physical address space.
.png)
Differences between Logical Address and Physical Address :
- The Logical Address is generated by the CPU while the program is running and the Physical Address is the location inside the main memory.
- The Logical Address is Virtual and the Physical Address is the actual address of the memory.
- The Logical Address is generated by the CPU and the Physical Address is calculated by MMU.
- Users can't view the Logical Address of a program whereas the Physical Address is visible to the user.
- The set of all logical addresses generated by the CPU in reference to a program is called the Logical Address Space and the set of all physical addresses corresponding to the logical addresses in the Logical Address Space is called the Physical Address Space.
Comparison between Logical Address and Physical Address
| Logical Address | Physical Address |
|---|---|
|
|
|
|
|
|
|
|
|
|