Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • Aptitude
  • Engineering Mathematics
  • Discrete Mathematics
  • Operating System
  • DBMS
  • Computer Networks
  • Digital Logic and Design
  • C Programming
  • Data Structures
  • Algorithms
  • Theory of Computation
  • Compiler Design
  • Computer Org and Architecture
Open In App
Next Article:
Page Fault Handling in Operating System
Next article icon

Logical and Physical Address in Operating System

Last Updated : 24 May, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

A logical address is generated by the CPU while a program is running. The logical address is a virtual address as it does not exist physically, therefore, it is also known as a Virtual Address. The physical address describes the precise position of necessary data in a memory. Before they are used, the MMU must map the logical address to the physical address. In operating systems, logical and physical addresses are used to manage and access memory. Here is an overview of each in detail.

What is a Logical Address?

A logical address, also known as a virtual address, is an address generated by the CPU during program execution. It is the address seen by the process and is relative to the program's address space. The process accesses memory using logical addresses, which are translated by the operating system into physical addresses. An address that is created by the CPU while a program is running is known as a logical address. Because the logical address is virtual—that is, it doesn't exist physically—it is also referred to as such. The CPU uses this address as a reference to go to the actual memory location. All logical addresses created from a program's perspective are referred to as being in the "logical address space". This address is used as a reference to access the physical memory location by CPU. The term Logical Address Space is used for the set of all logical addresses generated by a program's perspective. 

What is a Physical Address?

A physical address is the actual address in the main memory where data is stored. It is a location in physical memory, as opposed to a virtual address. Physical addresses are used by the Memory Management Unit (MMU) to translate logical addresses into physical addresses. The user must use the corresponding logical address to go to the physical address rather than directly accessing the physical address. For a computer program to function, physical memory space is required. Therefore, the logical address and physical address need to be mapped before the program is run.

The term "physical address" describes the precise position of necessary data in a memory. Before they are used, the MMU must map the logical address to the physical address. This is because the user program creates the logical address and believes that the program is operating in this logical address. However, the program requires physical memory to execute. All physical addresses that match the logical addresses in a logical address space are collectively referred to as the "physical address space"

The translation from logical to physical addresses is performed by the operating system's memory management unit (MMU) within the computer's hardware architecture. The MMU uses a page table to translate logical addresses into physical addresses. The page table maps each logical page number to a physical frame number. While the operating system plan this process, it's important to note that the MMU itself is a hardware component separate from the software-based elements of the operating system.

Similarities Between Logical and Physical Addresses in the Operating System

  • Both logical and physical addresses are used to identify a specific location in memory.
  • Both logical and physical addresses can be represented in different formats, such as binary, hexadecimal, or decimal.
  • Both logical and physical addresses have a finite range, which is determined by the number of bits used to represent them.

Important Points about Logical and Physical Addresses in Operating Systems

  • The use of logical addresses provides a layer of abstraction that allows processes to access memory without knowing the physical memory location.
  • Logical addresses are mapped to physical addresses using a page table. The page table contains information about the mapping between logical and physical addresses.
  • The MMU translates logical addresses into physical addresses using the page table. This translation is transparent to the process and is performed by hardware.
  • The use of logical and physical addresses allows the operating system to manage memory more efficiently by using techniques such as paging and segmentation.

MMU scheme

What is Memory Management Unit ?

The physical hardware of a computer that manages its virtual memory and caching functions is called the memory management unit (MMU). The MMU is sometimes housed in a separate Integrated Chip (IC), but it is typically found inside the central processing unit (CPU) of the computer. The MMU receives all inputs for data requests and decides whether to retrieve the data from ROM or RAM storage.

Difference Between Logical address and Physical Address

ParameterLOGICAL ADDRESSPHYSICAL ADDRESS
Basicgenerated by CPUlocation in a memory unit
Address SpaceLogical Address Space is set of all logical addresses generated by CPU in reference to a program.Physical Address is set of all physical addresses mapped to the corresponding logical addresses.
VisibilityUser can view the logical address of a program.User can never view physical address of program.
Generationgenerated by the CPUComputed by MMU
AccessThe user can use the logical address to access the physical address.The user can indirectly access physical address but not directly.
EditableLogical address can be change.Physical address will not change.
Also calledvirtual address.real address.

Some reference books on operating system concepts that cover logical and physical addressing include:

  • "Operating System Concepts" by Abraham Silberschatz, Peter Baer Galvin, and Greg Gagne.
  • "Modern Operating Systems" by Andrew S. Tanenbaum.
  • "Operating Systems: Three Easy Pieces" by Remzi H. Arpaci-Dusseau and Andrea C. Arpaci-Dusseau.
    These books provide detailed coverage of operating system concepts, including memory management and addressing techniques.

Next Article
Page Fault Handling in Operating System

A

Ankit_Bisht
Improve
Article Tags :
  • Technical Scripter
  • Computer Organization & Architecture
  • Operating Systems
  • Difference Between
  • Operating Systems-Memory Management

Similar Reads

  • Physical and Logical File Systems
    1. Physical files: Physical files contain the actual data that is stored on an iSeries system, and a description of how data is to be presented to or received from a program. They contain only one record format and one or more members. Records in database files can be described using either a field-
    5 min read
  • I/O Hardware in Operating System
    I/O Hardware is a set of specialized hardware devices that help the operating system access disk drives, printers, and other peripherals. These devices are located inside the motherboard and connected to the processor using a bus. They often have specialized controllers that allow them to quickly re
    6 min read
  • Virtual Address Space in Operating System
    In operating systems, Virtual memory plays a very vital role, in managing the memory allotted to different processes and efficiently isolating the different memory addresses. The role of the virtual address is to assign a space to the ledger of all the virtual memory areas that are provided to diffe
    5 min read
  • Page Fault Handling in Operating System
    A page fault occurs when a program attempts to access data or code that is in its address space but is not currently located in the system RAM. This triggers a sequence of events where the operating system must manage the fault by loading the required data from secondary storage into RAM. Page fault
    5 min read
  • File Access Methods in Operating System
    File access methods in an operating system are the techniques and processes used to read from and write to files stored on a computer's storage devices. There are several ways to access this information in the file. Some systems provide only one access method for files. Other systems, such as those
    10 min read
  • Free Space Management in Operating System
    Free space management is a critical aspect of operating systems as it involves managing the available storage space on the hard disk or other secondary storage devices. The operating system uses various techniques to manage free space and optimize the use of storage devices. Here are some of the com
    7 min read
  • Hashed Page Tables in Operating System
    There are several common techniques for structuring page tables like Hierarchical Paging, Hashed Page Tables, and Inverted Page Tables. In this article, we will discuss the Hashed Page Table. Hashed Page Tables are a type of data structure used by operating systems to efficiently manage memory mappi
    4 min read
  • Critical Regions in Operating System
    In an operating system, a critical region refers to a section of code or a data structure that must be accessed exclusively by one method or thread at a time. Critical regions are utilized to prevent concurrent entry to shared sources, along with variables, information structures, or devices, that a
    3 min read
  • Paging in Operating System
    Paging is a memory management scheme that eliminates the need for a contiguous allocation of physical memory. The process of retrieving processes in the form of pages from the secondary storage into the main memory is known as paging. The basic purpose of paging is to separate each procedure into pa
    10 min read
  • Device-Independent I/O Software in Operating System
    Device-independent I/O software, also known as the I/O subsystem or I/O management, is an integral part of an operating system that provides a layer of abstraction between hardware devices and user-level applications This abstraction though performs input and output operations for applications It ca
    5 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences