Difference Between Logical and Physical Address

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

1. What is a Logical Address
      – Definition, Functionality
2. What is a Physical Address
     – Definition, Functionality
3. Difference Between Logical and Physical Address
     – Comparison of Key Differences

Key Terms

Logical Address, Physical Address, Operating System

Difference Between Logical and Physical Address - Comparison Summary

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.

Difference Between Logical and Physical Address

Figure 1: Conversion of  Logical Address to Physical Address

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

Definition

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.

Address Space

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.  

Usage

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. 

Conclusion

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.

Reference:

1. Logical Vs Physical Address Space, Tutorials Point (India) Pvt. Ltd., 18 Jan. 2018, Available here.

About the Author: Lithmee

Lithmee holds a Bachelor of Science degree in Computer Systems Engineering and is reading for her Master’s degree in Computer Science. She is passionate about sharing her knowldge in the areas of programming, data science, and computer systems.

Leave a Reply