Difference between Physical and Logical Address in Operating System

In this article, we will study the two types of addresses in the operating system – Physical and Logical addresses and take a look at the differences between the two of them.

How do we define an address? In layman language, an address is used to uniquely identify a location in the computer memory. The two types of addresses also bear the same qualities and store addresses in a slightly different manner which we will study subsequently.

There are two main components of a computer system – the Control Unit (CU) and the Memory Unit (MU). CU is responsible for input and output operations while MU is responsible for processing and storing instructions and data.

The logical address is generated by the CPU and the physical address is generated by MU. The physical address is the real location in the memory unit which is virtual to the user, i.e., the user cannot view the physical address. But the logical address is generated in the perspective of the execution of a program and is visible to the user. A logical address has no physical existence and so it also called a virtual address.

The logical and physical addresses are generated through mapping.

The following figure shows how the addresses are generated in our computer system:

Address-mapping

The Central Processing Unit generates the logical address during program execution. The logical address passes through the Memory Management Unit (MMU) which translates the logical address into a physical address in two steps. First, it generates a relocation register ( a hardware component consisting of a constant which is added to the memory address). After this, the constant is added to the logical address to get the physical address which is stored in the memory unit. The need to perform mapping of address in MMU is that although the program can run in the logical address, it requires a physical address for its execution. And this physical address can be accessed indirectly with the help of a logical address after mapping.

Difference between Physical and Logical Address

Logical Address Physical Address
It is generated by the CPU. It is a location in a memory unit.
The set of all logical addresses is called Logical Address Space. The set of all physical addresses corresponding to the logical addresses is called Physical Address Space.
It can be viewed by the user. It is not visible to the user.
A logical address can be used to access physical addresses. A physical address cannot be used to access logical addresses.
It is also called a virtual address. It is also called a real address.

Comment down below if you have any queries related to physical and logical address in os.

Leave a Comment

Your email address will not be published. Required fields are marked *