Practice
Data Structures and Algorithms
Machine Coding Round (LLD)
System Design & Architecture (HLD)
Frontend UI Machine Coding
Resources
Career Advice and Roadmaps
Data Structures and Algorithms
Machine Coding Round (LLD)
System Design & Architecture (HLD)
Backend Development
Frontend Development
Project Ideas for Software Developers
Core Computer Science
Companies
SDE Jobs & Internships
Interview Questions
Compare Companies
IDE
Online IDE
Collaborative IDE

Logical and Physical Address in Operating System (OS) | Core CS

Ujjwal Abhishek
Ujjwal Abhishek

Logical Address

It is a virtual address generated by the CPU while a program is running. It is referred to as a virtual address because it does not exist physically. Using this address, the CPU access the actual address or physical address inside the memory, and data is fetched from there.

The hardware device called Memory Management Unit (MMU) is used for mapping this logical address to the physical address. The set of all logical addresses generated by the CPU for a program is called the logical address space.

Physical Address 

Physical Address is the actual address of the data inside the memory. The logical address is a virtual address and the program needs physical memory for its execution. The user never deals with the Physical Address. The user program generates the logical address and is mapped to the physical address by the Memory Management Unit(MMU).

The set of all physical addresses corresponding to the logical addresses in the logical address space is called the physical address space.

Differences between Logical Address and Physical Address :

  1. The Logical Address is generated by the CPU while the program is running and the Physical Address is the location inside the main memory.
  2. The Logical Address is Virtual and the Physical Address is the actual address of the memory.
  3. The Logical Address is generated by the CPU and the Physical Address is calculated by MMU.
  4. Users can't view the Logical Address of a program whereas the Physical Address is visible to the user.
  5. The set of all logical addresses generated by the CPU in reference to a program is called the Logical Address Space and the set of all physical addresses corresponding to the logical addresses in the Logical Address Space is called the Physical Address Space.

Comparison between Logical Address and Physical Address

Logical AddressPhysical Address
  • It is a virtual address.
  • It is the actual location in the memory.
  • It is visible to the user.
  • It is not visible to the user.
  • It is generated by the CPU.
  • It is computed by the MMU.
  • It is used by the user to access the physical address inside the memory.
  • It is not accessible directly by the user.
  • The set of all logical addresses generated by the CPU is called the logical address space.
  • The set of all physical addresses corresponding to the logical addresses in the logical address space is called the physical address space.

 

 

1
Ujjwal Abhishek
Ujjwal Abhishek
Ujjwal is final-year CSE Undergraduate, a competitive coder, and a web developer passionate about problem-solving and data structures and algorithms.
SDE Bootcamp - Become a software engineer at a product-based company
Practice Data Structures & Algorithms
Learning Resources
Interview Prep Resources
Blog
  • Career Advice and Roadmaps
  • Data Structures & Algorithms
  • Machine Coding Round (LLD)
  • System Design & Architecture
  • Backend Development
  • Frontend Development
  • Awesome Project Ideas
  • Core Computer Science
Practice Questions
  • Machine Coding (LLD) Questions
  • System Design (HLD) Questions
  • Topic-wise DSA Questions
  • Company-wise DSA Questions
  • DSA Sheets (Curated Lists)
  • JavaScript Interview Questions
  • Frontend UI Machine Coding Questions
Online Compilers (IDE)
  • Online Java Compiler
  • Online C++ Compiler
  • Online C Compiler
  • Online Python Compiler
  • Online JavaScript Compiler
Topic-wise Problems
  • Dynamic Programming Interview Questions
  • Linked List Interview Questions
  • Graph Interview Questions
  • Backtracking Interview Questions
  • Arrays Interview Questions
  • Trees Interview Questions
Company-wise Problems
  • Amazon Interview Questions
  • Microsoft Interview Questions
  • Google Interview Questions
  • Flipkart Interview Questions
  • Adobe Interview Questions
  • Facebook Interview Questions
DSA Sheets (Curated Lists)
  • Top Interview Questions
  • FAANG Interview Questions
  • Most Asked Interview Questions
  • 6 month DSA Practice Sheet
  • 3 month DSA Practice Sheet
  • Last minute DSA Practice Sheet