Logical Address vs Physical Address - aryanjoshi0823/5143-Operating-System GitHub Wiki

Logical Address vs. Physical Address

Logical Address

  • A logical address is a virtual address generated by the CPU while a program is running.
  • It does not physically exist and serves as a reference to access the physical address in memory.
  • The Memory Management Unit (MMU) maps logical addresses to physical addresses.
  • The collection of all logical addresses for a program forms the logical address space.

Physical Address

  • A physical address is the actual address of data stored in the memory.
  • The user program generates logical addresses, which the MMU translates into physical addresses for execution.
  • The collection of all physical addresses mapped from logical addresses constitutes the physical address space.

Differences Between Logical Address and Physical Address

Aspect Logical Address Physical Address
Definition A virtual address generated by the CPU. The actual location in physical memory.
Visibility to User Not visible to the user. Visible to the user.
Generation Created by the CPU. Computed by the MMU.
Purpose Used by the user to reference memory. Used to access actual data in memory.
Address Space Forms the logical address space. Forms the physical address space.
Accessibility Accessed indirectly via MMU. Not accessible directly by the user.

Key Points

  • The logical address space is the set of all logical addresses generated by the CPU for a program.
  • The physical address space is the set of physical addresses corresponding to these logical addresses.
  • The MMU bridges the gap between logical and physical addresses, ensuring proper memory mapping.
⚠️ **GitHub.com Fallback** ⚠️