Course Content
Operating Systems (OS)
Logical vs Physical Address

In modern computing systems, memory is managed in layers to provide flexibility, protection, and efficiency. One fundamental concept in memory management is the distinction between logical addresses and physical addresses. Understanding the difference between them is essential to grasp how programs access memory safely and efficiently.

 



What is a Logical Address?

A logical address, also known as a virtual address, is the address generated by the CPU during the execution of a program. This is the address that a program uses to access memory.

 

  • It is used by the program’s instructions.
  • It refers to a location in the program’s virtual memory.
  • It is not the actual location in physical RAM.

 

Why it’s used:


Logical addresses allow programs to run as if they have access to an isolated memory space, even when multiple programs share the same physical memory.


What is a Physical Address?

A physical address is the actual location in the main memory (RAM) where data is stored.

 

  • It is the real memory location in the system’s hardware.
  • It can be accessed only after the logical address is translated by the Memory Management Unit (MMU).
  • This is where the real data resides in RAM.

 

Role in execution:


When a program runs, the logical address it uses must be converted into a physical address so the CPU can retrieve or store data in actual memory.


Address Translation Process

The translation from logical to physical address is handled by a hardware component called the Memory Management Unit (MMU). Here’s how it works:

 

  • The CPU generates a logical address.
  • The MMU takes this address and translates it using a technique such as paging or segmentation.
  • The resulting address is the physical address in RAM.
  • Data is accessed using this physical address.

 

This mechanism provides memory protection, process isolation, and enables virtual memory features.

 




Key Differences
Feature Logical Address Physical Address
Generated by CPU during program execution MMU after translation
Visible to User and programs Operating System and hardware
Location In virtual/imaginary memory space In actual physical memory (RAM)
Flexibility Allows processes to run in isolation Depends on available hardware memory
Security Offers process-level protection No direct access by user programs
0% Complete
WhatsApp Icon

Hi Instagram Fam!
Get a FREE Cheat Sheet on System Design.

Hi LinkedIn Fam!
Get a FREE Cheat Sheet on System Design

Loved Our YouTube Videos? Get a FREE Cheat Sheet on System Design.