The difference between physical address and logical address in OS

Tram Ho

The address uniquely identifies a location in memory. We have two types of addresses: logical and physical. The logical address is a virtual and user-viewable address. The physical address cannot be viewed directly by the user. Logical address is used as a reference, to access physical address.

The basic difference between a logical and a physical address is that a logical address is generated by the CPU during program execution while a physical address refers to a location in a memory unit.

There are several differences between a logical and a physical address.

Comparison chart

CriteriaLogical addressPhysical address
Defineis a virtual address created by the CPUis a location in a memory unit.
Address spaceThe set of all logical addresses generated by the CPU that refer to a programThe set of all physical addresses mapped to their respective logical addresses
DisplayUser can view the logical address of a programUser can never see the physical address of the program
AccessUser uses logical address to access physical addressThe user cannot directly access the physical address
GenerationThe logical address is generated by the CPUThe physical address is calculated in MMU

Defines a logical address

The address generated by the CPU while the program is running is called a logical address. The logical address is virtual because it does not actually exist. Hence, it is also known as a virtual address. This address is used as reference to access physical memory location. The set of all logical addresses generated by a program perspective is called the Logical Address Space.

The logical address is mapped to its corresponding physical address by a hardware device called the Memory Manager (MMU). The address binding methods used by the MMU produce identical physical and logical addresses at compile and load time. However, during runtime, the address binding methods produce different physical and logical addresses.

Defines the physical address

The physical address identifies a physical location in memory. The MMU calculates the physical address for the corresponding logical address. The MMU also uses the physical address to calculate the logical address. User never interacts with real address. Instead, the physical address is accessed by the user using its corresponding logical address.

The user program generates the logical address and thinks that the program is running in this logical address. But the program needs physical memory to execute. Therefore, logical addresses must be mapped to physical addresses before they can be used.

Logical addresses are mapped to physical addresses using hardware called the Memory Manager. The set of all physical addresses corresponding to logical addresses in the logical address space is called the Physical Address Space.


Logical address is a reference used to access physical address. User can access physical address in memory using this logical address.


Share the news now

Source : Viblo