SlideShare a Scribd company logo
1 of 20
Download to read offline
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

What's hot

basics of virtual memory
basics of virtual memorybasics of virtual memory
basics of virtual memoryAdarsh Patel
 
Virtual memory
Virtual memoryVirtual memory
Virtual memoryAsif Iqbal
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory managementDr. Loganathan R
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory ManagementAkmal Cikmat
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentationRanjeet Kumar
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managmentSantu Kumar
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryWayne Jones Jnr
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memoryMazin Alwaaly
 
Memory management
Memory managementMemory management
Memory managementcpjcollege
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual MemoryDamian T. Gordon
 
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...ITM University
 
chapter 2 memory and process management
chapter 2 memory and process managementchapter 2 memory and process management
chapter 2 memory and process managementAisyah Rafiuddin
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory pptRITULDE
 
Virtual Mapping in Virtual Memory
Virtual Mapping in Virtual MemoryVirtual Mapping in Virtual Memory
Virtual Mapping in Virtual MemoryMeghaj Mallick
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory managementMukesh Chinta
 

What's hot (20)

basics of virtual memory
basics of virtual memorybasics of virtual memory
basics of virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
9 virtual memory management
9 virtual memory management9 virtual memory management
9 virtual memory management
 
VIRTUAL MEMORY
VIRTUAL MEMORYVIRTUAL MEMORY
VIRTUAL MEMORY
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Operating System-Memory Management
Operating System-Memory ManagementOperating System-Memory Management
Operating System-Memory Management
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
 
Chapter 9 - Virtual Memory
Chapter 9 - Virtual MemoryChapter 9 - Virtual Memory
Chapter 9 - Virtual Memory
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Memory management
Memory managementMemory management
Memory management
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual Memory
 
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
Virtual Memory ,Direct memory addressing and indirect memory addressing prese...
 
chapter 2 memory and process management
chapter 2 memory and process managementchapter 2 memory and process management
chapter 2 memory and process management
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Virtual Mapping in Virtual Memory
Virtual Mapping in Virtual MemoryVirtual Mapping in Virtual Memory
Virtual Mapping in Virtual Memory
 
Operating Systems - memory management
Operating Systems - memory managementOperating Systems - memory management
Operating Systems - memory management
 

Similar to Virtual Memory in 40 Characters

Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfHarika Pudugosula
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxAmanuelmergia
 
Operating system 37 demand paging
Operating system 37 demand pagingOperating system 37 demand paging
Operating system 37 demand pagingVaibhav Khanna
 
Power Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptPower Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptRahulRaj395610
 
Virtual Memory in Windows
Virtual Memory in Windows Virtual Memory in Windows
Virtual Memory in Windows HanzlaRafique
 
16. PagingImplementIssused.pptx
16. PagingImplementIssused.pptx16. PagingImplementIssused.pptx
16. PagingImplementIssused.pptxMyName1sJeff
 
OS Presentation 2023.pptx
OS Presentation 2023.pptxOS Presentation 2023.pptx
OS Presentation 2023.pptxShayanAli68
 
Windows Internal - Ch9 memory management
Windows Internal - Ch9 memory managementWindows Internal - Ch9 memory management
Windows Internal - Ch9 memory managementKent Huang
 
08 virtual memory
08 virtual memory08 virtual memory
08 virtual memoryKamal Singh
 
CSI-503 - 9. Virtual Memory
CSI-503 - 9. Virtual MemoryCSI-503 - 9. Virtual Memory
CSI-503 - 9. Virtual Memoryghayour abbas
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxAmanuelmergia
 
08 operating system support
08 operating system support08 operating system support
08 operating system supportdilip kumar
 
08 operating system support
08 operating system support08 operating system support
08 operating system supportBitta_man
 

Similar to Virtual Memory in 40 Characters (20)

Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdf
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Operating system 37 demand paging
Operating system 37 demand pagingOperating system 37 demand paging
Operating system 37 demand paging
 
Power Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.pptPower Point Presentation on Virtual Memory.ppt
Power Point Presentation on Virtual Memory.ppt
 
Virtual Memory in Windows
Virtual Memory in Windows Virtual Memory in Windows
Virtual Memory in Windows
 
16. PagingImplementIssused.pptx
16. PagingImplementIssused.pptx16. PagingImplementIssused.pptx
16. PagingImplementIssused.pptx
 
OS Presentation 2023.pptx
OS Presentation 2023.pptxOS Presentation 2023.pptx
OS Presentation 2023.pptx
 
Virtual Memory.pdf
Virtual Memory.pdfVirtual Memory.pdf
Virtual Memory.pdf
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
Demand paging
Demand pagingDemand paging
Demand paging
 
Windows Internal - Ch9 memory management
Windows Internal - Ch9 memory managementWindows Internal - Ch9 memory management
Windows Internal - Ch9 memory management
 
Operating System
Operating System Operating System
Operating System
 
virtual_memory (3).pptx
virtual_memory (3).pptxvirtual_memory (3).pptx
virtual_memory (3).pptx
 
08 virtual memory
08 virtual memory08 virtual memory
08 virtual memory
 
CSI-503 - 9. Virtual Memory
CSI-503 - 9. Virtual MemoryCSI-503 - 9. Virtual Memory
CSI-503 - 9. Virtual Memory
 
Lecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptxLecture-7 Main Memroy.pptx
Lecture-7 Main Memroy.pptx
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
08 operating system support
08 operating system support08 operating system support
08 operating system support
 
Os unit 3
Os unit 3Os unit 3
Os unit 3
 

Recently uploaded

SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSneha Padhiar
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfalene1
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHSneha Padhiar
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Communityprachaibot
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfDrew Moseley
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmDeepika Walanjkar
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionMebane Rash
 
A brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProA brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProRay Yuan Liu
 
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...gerogepatton
 
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...IJAEMSJORNAL
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxRomil Mishra
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfBalamuruganV28
 
Detection&Tracking - Thermal imaging object detection and tracking
Detection&Tracking - Thermal imaging object detection and trackingDetection&Tracking - Thermal imaging object detection and tracking
Detection&Tracking - Thermal imaging object detection and trackinghadarpinhas1
 
Secure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech LabsSecure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech Labsamber724300
 
STATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subjectSTATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subjectGayathriM270621
 

Recently uploaded (20)

SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
 
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdfComprehensive energy systems.pdf Comprehensive energy systems.pdf
Comprehensive energy systems.pdf Comprehensive energy systems.pdf
 
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACHTEST CASE GENERATION GENERATION BLOCK BOX APPROACH
TEST CASE GENERATION GENERATION BLOCK BOX APPROACH
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 
Prach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism CommunityPrach: A Feature-Rich Platform Empowering the Autism Community
Prach: A Feature-Rich Platform Empowering the Autism Community
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
Immutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdfImmutable Image-Based Operating Systems - EW2024.pdf
Immutable Image-Based Operating Systems - EW2024.pdf
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
 
Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
US Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of ActionUS Department of Education FAFSA Week of Action
US Department of Education FAFSA Week of Action
 
A brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision ProA brief look at visionOS - How to develop app on Apple's Vision Pro
A brief look at visionOS - How to develop app on Apple's Vision Pro
 
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
March 2024 - Top 10 Read Articles in Artificial Intelligence and Applications...
 
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
Guardians of E-Commerce: Harnessing NLP and Machine Learning Approaches for A...
 
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptxTriangulation survey (Basic Mine Surveying)_MI10412MI.pptx
Triangulation survey (Basic Mine Surveying)_MI10412MI.pptx
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 
CS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdfCS 3251 Programming in c all unit notes pdf
CS 3251 Programming in c all unit notes pdf
 
Detection&Tracking - Thermal imaging object detection and tracking
Detection&Tracking - Thermal imaging object detection and trackingDetection&Tracking - Thermal imaging object detection and tracking
Detection&Tracking - Thermal imaging object detection and tracking
 
Secure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech LabsSecure Key Crypto - Tech Paper JET Tech Labs
Secure Key Crypto - Tech Paper JET Tech Labs
 
STATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subjectSTATE TRANSITION DIAGRAM in psoc subject
STATE TRANSITION DIAGRAM in psoc subject
 

Virtual Memory in 40 Characters

  • 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 ?