100% Free Forever
AI-Powered Learning
Industry Expert Content
Certificates & Badges
Learn At Your Own Pace

Logical vs Physical Address in Operating Systems

Logical vs physical address explained — how the MMU translates addresses at runtime — with examples and OS interview questions.

mediumQ160 of 224 in Operating Systems Est. time: 5 minsLast updated:
Open Code Lab

Expected Interview Answer

A logical address is the address a running program generates and sees, relative to its own address space, while a physical address is the real hardware location in RAM that the memory management unit (MMU) maps that logical address to at runtime.

Every instruction a process executes references memory using logical addresses, generated by the CPU and starting from a base that the program itself is unaware of. The MMU, using a relocation register, base-and-limit pair, or a full page table, translates each logical address into a physical address just before the memory bus is actually accessed, so the CPU never touches physical memory directly. This separation is what allows a program to be compiled and linked without knowing where in physical RAM it will eventually be loaded, and it is also what enables two processes to each believe they own address zero while actually residing in completely different physical frames. Because translation happens on every single memory access, its cost is critical, which is why hardware caches translations in a translation lookaside buffer (TLB) rather than walking the page table from scratch each time.

  • Programs can be compiled without knowing their final physical location
  • Enables process isolation — each process gets its own logical view
  • Makes relocation and swapping possible without touching program code
  • Foundation for understanding paging, segmentation, and the MMU

AI Mentor Explanation

A logical address is like a fan’s ticket saying "Block A, Seat 12" — a number meaningful only within the venue’s own numbering scheme. The physical address is the actual GPS location of that seat inside the real stadium structure, which the ushers (the MMU) translate the ticket into as the fan walks in. The fan never needs to know the real coordinates; the stadium staff resolve the mapping on entry, and if the ground is rebuilt, only the usher’s mapping chart needs updating, not every printed ticket.

Step-by-Step Explanation

  1. Step 1

    CPU generates logical address

    The running process issues a memory reference relative to its own address space, unaware of physical layout.

  2. Step 2

    MMU intercepts the reference

    Before the memory bus is touched, the memory management unit intercepts the logical address for translation.

  3. Step 3

    Translation via mapping structure

    A relocation register, base-and-limit pair, or page table converts the logical address into a physical address.

  4. Step 4

    Physical memory accessed

    The resolved physical address is placed on the memory bus and the actual RAM location is read or written.

What Interviewer Expects

  • A clear distinction between what the CPU sees vs what the hardware sees
  • Naming the MMU as the component that performs translation
  • Understanding that translation happens on every memory access
  • Awareness of why this separation enables relocation and isolation

Common Mistakes

  • Using “logical” and “physical” address interchangeably
  • Thinking the compiler resolves the final physical address
  • Forgetting the MMU translates on every single memory reference
  • Not connecting this to process isolation and relocation benefits

Best Answer (HR Friendly)

A logical address is the address my program thinks it is using, while a physical address is where that data actually sits in real RAM. The hardware quietly translates between the two every time memory is touched, which is what lets my program be loaded anywhere in memory and still work correctly without me ever knowing the real location.

Code Example

Simple base-register translation of logical to physical address
unsigned base = 0x4000;   /* physical start address assigned at load time */
unsigned limit = 0x1000;  /* size of this process’s address space */

unsigned translate(unsigned logical_addr) {
    if (logical_addr >= limit) {
        raise_segmentation_fault();   /* out of this process’s bounds */
    }
    return base + logical_addr;       /* MMU-style translation */
}

Follow-up Questions

  • What hardware component performs logical-to-physical address translation?
  • How does a base-and-limit register scheme differ from paging?
  • Why does address translation need to be fast, and how does the TLB help?
  • How does this distinction relate to process relocation?

MCQ Practice

1. A logical address is generated by?

The CPU generates logical addresses as the process executes; they are meaningful only within that process’s own view of memory.

2. What component translates a logical address into a physical address?

The MMU performs this translation at runtime, on every memory access, using a mapping structure such as a page table.

3. Why is the logical/physical address separation useful?

Because translation happens at runtime, the same compiled program can be loaded at different physical addresses and processes can be isolated from one another.

Flash Cards

What is a logical address?The address a process generates, relative to its own view of memory, before translation.

What is a physical address?The real hardware location in RAM that a logical address maps to.

What performs the translation?The memory management unit (MMU), using a relocation register or page table.

When does translation happen?On every single memory access made by the running process.

1 / 4

Continue Learning