What Is logical Address?
A logical address also referred to as a virtual address, is an address of something generated by the central processing unit (CPU) while a program is running. Usually, the operating system or some other programs uses base addresses as a measure to find addresses. In this case the base address refers to the starting address of a memory block. In regard to the written program, the CPU generates an address; the very address is added with the base address so that it forms the physical address. In this case, the address generated by the CPU is referred to as Logical address.
The logical address is mapped to its correlating physical address by the memory management unit. Logical address usually ranges from zero to maximum. Load-time and compile-time address binding methods are used to create identical logical address and physical address.
What Is Physical Address?
Physical address is a location that exists in the memory; it allows accessing a particular storage cell in the main memory. It is used by both hardware and software for accessing data. Software however, does not use physical addresses directly instead, it accesses memory using a virtual address. A hardware component referred to as the Memory Management Unit (MMU) is responsible for translating a virtual address to a physical address.
The physical address is not directly accessible or viewed by the user program hence a logical address needs to be mapped to it to make it accessible with the aid of pointers which reveal location but not the code.
Key Difference
- Logical address is the address that is generated by the central processing unit (CPU) in perspective of a program. Logical address can also be referred to as a virtual address. Physical address on the other hand is a location that exists in the memory; it allows accessing a particular storage cell in the main memory.
- Logical address space is the set of all logical addresses generated by CPU for a program whereas physical address space is the set of all physical address mapped to corresponding logical addresses.
- The physical address is an accessible physical location existing within the memory whereas the logical address exist virtually and does not have a specific location to exist physically in memory unit hence it is also known as virtual address.
- The logical address is generated by the central processing unit (CPU) whereas physical address is computed by Memory Management Unit (MMU). MMU is a hardware device that maps virtual to physical address.
- Physical and logical addresses are same in compile-time and load-time addressing-binding schemes. The two only differ in the execution-time address-binding scheme.
- The physical address helps to identify a location in the main memory whereas the logical address helps to obtain the physical address.
- The logical address is flexible hence will keep changing with the system but the physical address of that object always remains constant. This explains why the logical address gets formatted when the system is rebooted while no change happens to the physical address.
- The user can use the logical address to access the physical address whereas the user can indirectly access physical address but not directly.
Also Read: Difference Between Paging And Segmentation
Logical Address Vs. Physical Address In Tabular Form
BASIS OF COMPARISON | LOGICAL ADRESS | PHYSICAL ADRESS |
Description | Logical address is the address that is generated by the central processing unit (CPU) in perspective of a program. Logical address can also be referred to as a virtual address. | Physical address is a location that exists in the memory; it allows accessing a particular storage cell in the main memory. |
Address Space | Logical address space is the set of all logical addresses generated by CPU for a program. | Physical address space is the set of all physical address mapped to corresponding logical addresses. |
Visibility | The logical address exists virtually and does not have a specific location to exist physically in memory unit hence it is also known as virtual address. | The physical address is an accessible physical location existing within the memory. |
Generation | The logical address is generated by the central processing unit (CPU). | Physical address is computed by Memory Management Unit (MMU). |
Use | The physical address helps to identify a location in the main memory. | The logical address helps to obtain the physical address. |
Flexibility | The logical address is flexible hence will keep changing with the system from time to time. | Physical address of the object always remains constant. |
User | The user program can use the logical address to access the physical address. | The user program does not have the ability to view the physical address directly. |
Rebooting | Logic address is erased when the system is rebooted. | Physical address is not affected when the system is rebooted. |