SlideShare a Scribd company logo
Virtual Memory
Amirkabir
University of Technology
Negar Neda
What is Virtual Memory?
Virtual Memory is an address mapping
Source:Amirhosein Peyberah
• What is Virtual Memory?
•
Virtual Memory is an address mapping
● Maps virtual address space to
physical address space
– Maps virtual addresses to physical RAM
– Maps virtual addresses to hardware devices
o Separation of user logical memory from physical memory
o Only part of the program needs to be in memory for execution.
o Virtual Memory is an address mapping maps virtual address space
to
physical address space
– Maps virtual addresses to physical RAM
– Maps virtual addresses to hardware devices
Image source: Virtual Memory (Amirhosein Pyeberah(
Virtual Memory Features
• Each process has its own virtual address space
– Process invisible to each other
– Process cannot access another process memory
• MMU checks protection bits on memory access
– Pages can be protected from being written or being executed or even
being read
– System can distinguish different protection level
Address space
• Physical addresses
– Addresses as used by the hardware
- DMA, peripherals
• Virtual addresses
– Addresses as used by software
• MMU must map logical to physical.
Memory Managment
Memory-Management Unit (MMU)
• The Memory Management Unit (MMU) is a
hardware component which manages virtual
address mappings
• Sits between the CPU core and memory
• The MMU operates on basic units of memory called pages
• Transparently handles all memory accesses from
Load/Store instructions
– Maps accesses using virtual addresses to
system RAM
– Handles permissions
– Generates an exception (page fault) on an invalid access
Virtual Memory Sharing
• Pages of different processes mapped to one single frame on
physical memory
– Allows sharing of code
– Frame may be used to several processes until one writes to it
Image source: Virtual Memory (Amirhosein Pyeberah(
Paging
What is paging
Image source: google.com
Demand Paging
• Rather than swapping the entire process into memory, we
use a lazy swapper.
• I A lazy swapper never swaps a page into memory unless
that page will be needed.
Image source: Virtual Memory (Amirhosein Pyeberah(
Demand Paging
• Trap to the OS.
• Save the user registers and process state.
• Determine that the interrupt was a page fault.
• Check that the page reference was legal and determine the
location of the page on the disk.
Demand Paging (cont’d)
• Issue a read from the disk to a free frame:
– Wait in a queue for this device until the read request is
serviced.
– Wait for the device seek and/or latency time.
– Begin the transfer of the page to a free frame.
• Issue a read from the disk to a free frame:
– Wait in a queue for this device until the read request is
serviced.
– Wait for the device seek and/or latency time.
– Begin the transfer of the page to a free frame.
Page Fault
Page Fault
• A page fault is a CPU exception, generated
when software attempts to use an invalid virtual
address.
There are two cases:
– The virtual address is not mapped for the
process requesting it.
– The processes has insufficient
Image source: Virtual Memory (Amirhosein Pyeberah(
Handling Page Fault
• I Check an internal table for the process to determine
whether the reference was a valid or an invalid memory
access.
– I If the reference was invalid, we terminate the process.
– If it was valid but we have not yet brought in that page, we now
page it in.
Translation Lookaside Buffer
Translation Lookaside Buffer (TLB)
• Each virtual memory reference can cause two physical
memory access
– One to fetch the page table
– One to fetch the data
• To overcome this problem a high-speed cache is set up for
page table entries called TLB
• TLB is part of the MMU consulted by the MMU when the
CPU access a virtual address.
– Contains page table entries that have been most recently used
– Functions like a cache
Translation Look aside Buffer
• First checks if page is already in main memory
– If not a page fault is issued
• The TLB is updated to include the new page entry
• The TLB holds the entries of the mapping
– Virtual address
– Physical address
– permissions
Negar Neda
Thank you !
Any Questions ?

More Related Content

PPT
Virtual Memory
PPT
virtual memory
PPT
Ch9 Virtual Memory
DOCX
virtual memory
PDF
Virtual Memory
PPTX
virtual memory
PDF
Virtual memory
PPT
Virtual memory
Virtual Memory
virtual memory
Ch9 Virtual Memory
virtual memory
Virtual Memory
virtual memory
Virtual memory
Virtual memory

What's hot (20)

PPTX
basics of virtual memory
PPT
Virtual memory
PPTX
Virtual memory
PPTX
Virtual memory
PDF
9 virtual memory management
PPTX
VIRTUAL MEMORY
PPTX
Virtual Memory
PPTX
Operating System-Memory Management
PPTX
Virtual memory presentation
PPTX
Virtual memory managment
PPT
Chapter 9 - Virtual Memory
PPTX
Computer architecture virtual memory
PPTX
Operating Systems - Virtual Memory
PPT
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
PPTX
chapter 2 memory and process management
PPTX
Virtual memory ppt
PPTX
Virtual memory
PPTX
Virtual Mapping in Virtual Memory
PDF
Operating Systems - memory management
basics of virtual memory
Virtual memory
Virtual memory
Virtual memory
9 virtual memory management
VIRTUAL MEMORY
Virtual Memory
Operating System-Memory Management
Virtual memory presentation
Virtual memory managment
Chapter 9 - Virtual Memory
Computer architecture virtual memory
Operating Systems - Virtual Memory
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
chapter 2 memory and process management
Virtual memory ppt
Virtual memory
Virtual Mapping in Virtual Memory
Operating Systems - memory management
Ad

Similar to Virtual memory (20)

PDF
Virtual Memory - Part1
PPTX
coafinal1-copy-150430204758-conversion-gate01.pptx
PPT
NOV11 virtual memory.ppt
PPT
memory management and Virtual Memory.ppt
PPT
Cache replacement policies,cache miss,writingtechniques
PPT
Chapter 09 - Virtual Memory.ppt
PPTX
Virtual Memory Management
PPT
Power Point Presentation on Virtual Memory.ppt
PPT
Virtual memory - Demand Paging
PDF
Adobe Scan 06-Jan-2023.pdf demand paging document
PDF
Virtual Memory Management Part - I.pdf
PPT
virtual memory.ppt
PDF
Virtual Memory 53565686598386865286860.pdf
PPT
Linux Memory
PPTX
Virtual Memory (1).pptx
PDF
CSI-503 - 9. Virtual Memory
PPT
NOV11 virtual memory.ppt
DOCX
virtual memory - Computer operating system
PDF
Virtual memory
PPTX
Os Module 4_Virtual Memory Management.pptx
Virtual Memory - Part1
coafinal1-copy-150430204758-conversion-gate01.pptx
NOV11 virtual memory.ppt
memory management and Virtual Memory.ppt
Cache replacement policies,cache miss,writingtechniques
Chapter 09 - Virtual Memory.ppt
Virtual Memory Management
Power Point Presentation on Virtual Memory.ppt
Virtual memory - Demand Paging
Adobe Scan 06-Jan-2023.pdf demand paging document
Virtual Memory Management Part - I.pdf
virtual memory.ppt
Virtual Memory 53565686598386865286860.pdf
Linux Memory
Virtual Memory (1).pptx
CSI-503 - 9. Virtual Memory
NOV11 virtual memory.ppt
virtual memory - Computer operating system
Virtual memory
Os Module 4_Virtual Memory Management.pptx
Ad

Recently uploaded (20)

PDF
86236642-Electric-Loco-Shed.pdf jfkduklg
PPTX
UNIT - 3 Total quality Management .pptx
PPT
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
PDF
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
PDF
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
PDF
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
Soil Improvement Techniques Note - Rabbi
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PDF
737-MAX_SRG.pdf student reference guides
PDF
III.4.1.2_The_Space_Environment.p pdffdf
PPTX
introduction to high performance computing
PDF
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
PPTX
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPT
Total quality management ppt for engineering students
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
PPTX
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx
86236642-Electric-Loco-Shed.pdf jfkduklg
UNIT - 3 Total quality Management .pptx
INTRODUCTION -Data Warehousing and Mining-M.Tech- VTU.ppt
COURSE DESCRIPTOR OF SURVEYING R24 SYLLABUS
UNIT no 1 INTRODUCTION TO DBMS NOTES.pdf
A SYSTEMATIC REVIEW OF APPLICATIONS IN FRAUD DETECTION
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
Soil Improvement Techniques Note - Rabbi
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
737-MAX_SRG.pdf student reference guides
III.4.1.2_The_Space_Environment.p pdffdf
introduction to high performance computing
Level 2 – IBM Data and AI Fundamentals (1)_v1.1.PDF
EXPLORING LEARNING ENGAGEMENT FACTORS INFLUENCING BEHAVIORAL, COGNITIVE, AND ...
CURRICULAM DESIGN engineering FOR CSE 2025.pptx
R24 SURVEYING LAB MANUAL for civil enggi
Total quality management ppt for engineering students
Automation-in-Manufacturing-Chapter-Introduction.pdf
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
6ME3A-Unit-II-Sensors and Actuators_Handouts.pptx

Virtual memory

  • 2. What is Virtual Memory? Virtual Memory is an address mapping Source:Amirhosein Peyberah • What is Virtual Memory? • Virtual Memory is an address mapping ● Maps virtual address space to physical address space – Maps virtual addresses to physical RAM – Maps virtual addresses to hardware devices o Separation of user logical memory from physical memory o Only part of the program needs to be in memory for execution. o Virtual Memory is an address mapping maps virtual address space to physical address space – Maps virtual addresses to physical RAM – Maps virtual addresses to hardware devices
  • 3. Image source: Virtual Memory (Amirhosein Pyeberah(
  • 4. Virtual Memory Features • Each process has its own virtual address space – Process invisible to each other – Process cannot access another process memory • MMU checks protection bits on memory access – Pages can be protected from being written or being executed or even being read – System can distinguish different protection level
  • 5. Address space • Physical addresses – Addresses as used by the hardware - DMA, peripherals • Virtual addresses – Addresses as used by software • MMU must map logical to physical.
  • 7. Memory-Management Unit (MMU) • The Memory Management Unit (MMU) is a hardware component which manages virtual address mappings • Sits between the CPU core and memory • The MMU operates on basic units of memory called pages • Transparently handles all memory accesses from Load/Store instructions – Maps accesses using virtual addresses to system RAM – Handles permissions – Generates an exception (page fault) on an invalid access
  • 8. Virtual Memory Sharing • Pages of different processes mapped to one single frame on physical memory – Allows sharing of code – Frame may be used to several processes until one writes to it Image source: Virtual Memory (Amirhosein Pyeberah(
  • 10. What is paging Image source: google.com
  • 11. Demand Paging • Rather than swapping the entire process into memory, we use a lazy swapper. • I A lazy swapper never swaps a page into memory unless that page will be needed. Image source: Virtual Memory (Amirhosein Pyeberah(
  • 12. Demand Paging • Trap to the OS. • Save the user registers and process state. • Determine that the interrupt was a page fault. • Check that the page reference was legal and determine the location of the page on the disk.
  • 13. Demand Paging (cont’d) • Issue a read from the disk to a free frame: – Wait in a queue for this device until the read request is serviced. – Wait for the device seek and/or latency time. – Begin the transfer of the page to a free frame. • Issue a read from the disk to a free frame: – Wait in a queue for this device until the read request is serviced. – Wait for the device seek and/or latency time. – Begin the transfer of the page to a free frame.
  • 15. Page Fault • A page fault is a CPU exception, generated when software attempts to use an invalid virtual address. There are two cases: – The virtual address is not mapped for the process requesting it. – The processes has insufficient Image source: Virtual Memory (Amirhosein Pyeberah(
  • 16. Handling Page Fault • I Check an internal table for the process to determine whether the reference was a valid or an invalid memory access. – I If the reference was invalid, we terminate the process. – If it was valid but we have not yet brought in that page, we now page it in.
  • 18. Translation Lookaside Buffer (TLB) • Each virtual memory reference can cause two physical memory access – One to fetch the page table – One to fetch the data • To overcome this problem a high-speed cache is set up for page table entries called TLB • TLB is part of the MMU consulted by the MMU when the CPU access a virtual address. – Contains page table entries that have been most recently used – Functions like a cache
  • 19. Translation Look aside Buffer • First checks if page is already in main memory – If not a page fault is issued • The TLB is updated to include the new page entry • The TLB holds the entries of the mapping – Virtual address – Physical address – permissions
  • 20. Negar Neda Thank you ! Any Questions ?