The main difference between logical and physical address is that the logical address is the virtual address generated by the CPU while the physical address is an actual location in the main memory.
One component of a computer is the memory. Each memory location consists of an address to identify it uniquely. There are two types of address known as logical address and physical address. The CPU generates the logical address. It is also referred to as a virtual address. Physical address is an actual address in the memory unit. Accessing a program from the secondary memory consumes more time. Therefore, the program loads to the main memory at the time of execution. Then, the CPU generated logical address converts into a physical address to find the corresponding location in the main memory.
Key Areas Covered
Logical Address, Physical Address, Operating System
What is a Logical Address
A program is a set of instructions. Initially, it is stored in the secondary memory. CPU requires more time to access the secondary memory. Therefore, the program is placed into main memory at the time of execution. When executing the instructions, the CPU generates a logical address. It is also called a virtual address. This address converts into a physical address to access the instruction in the main memory. Set of all the logical addresses generated for a program is called the logical address space.
What is a Physical Address
A physical address is an address in the main memory. All physical addresses belonging to a program is called the physical address space. The logical address converts to a physical address at the time of execution. The following image explains this process.
Assume that there is a computer program with 100 instructions. It loads to the main memory location 500. The 100th instruction is in the location 600. The relocating register is a special CPU register. It keeps the base address of the program when it loads to the main memory for execution. In this scenario, the relocating register has the value 500. The CPU generates a logical address 60. The addition of this logical address and the value in the relocating address gives the physical address. It is the actual location in the main memory. Therefore, 560 is the corresponding physical address.
Difference Between Logical and Physical Address
A logical address is an address at which an item such as memory cell, storage element appears to reside from the perspective of an executing program. A physical address is a memory address that allows accessing a particular storage cell in the main memory.
The logical address space is the set of all the logical addresses generated for a program while the physical address space is the set of all physical addresses of a program.
Logical address helps to obtain the physical address. Physical address helps to identify a location in the main memory.
Method of Generation
The CPU generates logical addresses while the combination of the relocation register and the logical address provides the physical address.
The difference between Logical and physical address is that the logical address is the virtual address generated by the CPU while the physical address is an actual location in the main memory. The CPU generates the logical address or the virtual address. The summation of this logical address and the value from the relocating register gives the corresponding physical address in the main memory.
1. Logical Vs Physical Address Space, Tutorials Point (India) Pvt. Ltd., 18 Jan. 2018, Available here.