🔢

Logical and Physical Addressing in Computing

Jul 1, 2024

Logical and Physical Addressing in Computing

Definitions

Logical Address

  • Definition: Address generated by the CPU.
  • Purpose: Addresses used by the program instructions.
  • Accessibility: Can be accessed directly by the user.
  • Also Known As: Virtual address (does not exist physically in the main memory).

Physical Address

  • Definition: Actual address in the main memory where instructions are stored.
  • Purpose: Addresses used during the execution of a program.
  • Accessibility: Cannot be accessed directly by the user; only accessible via logical address.
  • Calculated By: Adding the logical address and the relocation register (base register).

Address Conversion

Logical to Physical Address Conversion

  • Process: Physical Address = Logical Address + Relocation Register.
  • Example: If Logical Address = 346 and Relocation Register = 14,000, then Physical Address = 14,346.
  • Relocation Register: Base register containing the starting address of the process.

Memory Management Unit (MMU)

  • Function: Hardware that performs mapping between logical addresses and physical addresses.
  • Location: Present in the CPU.
  • Generated By: Logical address is generated by the CPU, and physical address is generated by the MMU.

Address Space

Logical Address Space

  • Definition: Set of logical addresses generated by the program.
  • Example: If a program has 10 instructions, it has 10 logical addresses forming the logical address space.

Physical Address Space

  • Definition: Set of physical addresses corresponding to the logical address space.

Key Points

  • Logical addresses = Program addresses; can be accessed directly by the user.
  • Physical addresses = Main memory addresses; accessed indirectly via logical addresses.
  • MMU maps logical addresses to physical addresses.

Summary

  • Logical address: CPU-generated, also called virtual address, directly accessible by user.
  • Physical address: Main memory address, calculated using logical address + base register, accessible indirectly.
  • Logical address space: Collection of logical addresses by a program.
  • Physical address space: Collection of physical addresses corresponding to logical address space.

Additional Resources

  • Further materials and video content can be found in the description and first comment.