SlideShare a Scribd company logo
1 of 70
Chapter 9:  Virtual Memory
Chapter 9:  Virtual Memory ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Objectives ,[object Object],[object Object],[object Object]
Background ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Virtual Memory That is Larger Than Physical Memory 
Virtual-address Space
Shared Library Using Virtual Memory
Demand Paging ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Transfer of a Paged Memory to Contiguous Disk Space
Valid-Invalid Bit ,[object Object],[object Object],[object Object],[object Object],[object Object],v v v v i i i … . Frame # valid-invalid bit page table
Page Table When Some Pages Are Not in Main Memory
Page Fault ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Page Fault (Cont.) ,[object Object],[object Object],[object Object]
Steps in Handling a Page Fault
Performance of Demand Paging ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Demand Paging Example ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Process Creation ,[object Object],[object Object],[object Object]
Copy-on-Write ,[object Object],[object Object],[object Object]
Before Process 1 Modifies Page C
After Process 1 Modifies Page C
What happens if there is no free frame? ,[object Object],[object Object],[object Object],[object Object]
Page Replacement ,[object Object],[object Object],[object Object]
Need For Page Replacement
Basic Page Replacement ,[object Object],[object Object],[object Object],[object Object]
Page Replacement
Page Replacement Algorithms ,[object Object],[object Object],[object Object],[object Object],[object Object]
Graph of Page Faults Versus The Number of Frames
First-In-First-Out (FIFO) Algorithm ,[object Object],[object Object],[object Object],[object Object],1 2 3 1 2 3 4 1 2 5 3 4 9 page faults 1 2 3 1 2 3 5 1 2 4 5 10 page faults 4 4 3
FIFO Page Replacement
FIFO Illustrating Belady’s Anomaly
Optimal Algorithm ,[object Object],[object Object],[object Object],[object Object],[object Object],1 2 3 4 6 page faults 4 5
Optimal Page Replacement
Least Recently Used (LRU) Algorithm ,[object Object],[object Object],[object Object],[object Object],5 2 4 3 1 2 3 4 1 2 5 4 1 2 5 3 1 2 4 3
LRU Page Replacement
LRU Algorithm (Cont.) ,[object Object],[object Object],[object Object],[object Object],[object Object]
Use Of A Stack to Record The Most Recent Page References
LRU Approximation Algorithms ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Second-Chance (clock) Page-Replacement Algorithm
Counting Algorithms ,[object Object],[object Object],[object Object]
Allocation of Frames ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Fixed Allocation ,[object Object],[object Object]
Priority Allocation ,[object Object],[object Object],[object Object],[object Object]
Global vs. Local Allocation ,[object Object],[object Object]
Thrashing ,[object Object],[object Object],[object Object],[object Object],[object Object]
Thrashing (Cont.)
Demand Paging and Thrashing  ,[object Object],[object Object],[object Object],[object Object]
Locality In A Memory-Reference Pattern
Working-Set Model ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Working-set model
Keeping Track of the Working Set ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Page-Fault Frequency Scheme ,[object Object],[object Object],[object Object]
Memory-Mapped Files ,[object Object],[object Object],[object Object],[object Object]
Memory Mapped Files
Memory-Mapped Shared Memory in Windows
Allocating Kernel Memory ,[object Object],[object Object],[object Object],[object Object]
Buddy System ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Buddy System Allocator
Slab Allocator ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Slab Allocation
Other Issues -- Prepaging ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Other Issues – Page Size ,[object Object],[object Object],[object Object],[object Object],[object Object]
Other Issues – TLB Reach  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Other Issues – Program Structure ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Other Issues – I/O interlock ,[object Object],[object Object]
Reason Why Frames Used For I/O Must Be In Memory
Operating System Examples ,[object Object],[object Object]
Windows XP ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Solaris  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Solaris 2 Page Scanner
End of Chapter 9

More Related Content

What's hot

What's hot (20)

Virtual memory
Virtual memory Virtual memory
Virtual memory
 
Operating system memory management
Operating system memory managementOperating system memory management
Operating system memory management
 
Paging.ppt
Paging.pptPaging.ppt
Paging.ppt
 
Paging and segmentation
Paging and segmentationPaging and segmentation
Paging and segmentation
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
Distributed file system
Distributed file systemDistributed file system
Distributed file system
 
Disk scheduling
Disk schedulingDisk scheduling
Disk scheduling
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 
Memory management
Memory managementMemory management
Memory management
 
contiguous memory allocation.pptx
contiguous memory allocation.pptxcontiguous memory allocation.pptx
contiguous memory allocation.pptx
 
Memory Management in OS
Memory Management in OSMemory Management in OS
Memory Management in OS
 
Inter Process Communication
Inter Process CommunicationInter Process Communication
Inter Process Communication
 
CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2CS6401 OPERATING SYSTEMS Unit 2
CS6401 OPERATING SYSTEMS Unit 2
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Chapter 7 - Deadlocks
Chapter 7 - DeadlocksChapter 7 - Deadlocks
Chapter 7 - Deadlocks
 
Structure of the page table
Structure of the page tableStructure of the page table
Structure of the page table
 
8 memory management strategies
8 memory management strategies8 memory management strategies
8 memory management strategies
 
Mainframe systems
Mainframe systemsMainframe systems
Mainframe systems
 
Memory management ppt
Memory management pptMemory management ppt
Memory management ppt
 

Viewers also liked (6)

Handling Page Fault
Handling Page FaultHandling Page Fault
Handling Page Fault
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
 
Faults
FaultsFaults
Faults
 
Page replacement
Page replacementPage replacement
Page replacement
 
Page replacement algorithms
Page replacement algorithmsPage replacement algorithms
Page replacement algorithms
 
Virtual memory ppt
Virtual memory pptVirtual memory ppt
Virtual memory ppt
 

Similar to Chapter 9 - Virtual Memory

Ch10 OS
Ch10 OSCh10 OS
Ch10 OS
C.U
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
Google
 

Similar to Chapter 9 - Virtual Memory (20)

Ch09
Ch09Ch09
Ch09
 
OSCh10
OSCh10OSCh10
OSCh10
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OS
 
OS_Ch10
OS_Ch10OS_Ch10
OS_Ch10
 
Mem mgt
Mem mgtMem mgt
Mem mgt
 
Distributed Operating System_3
Distributed Operating System_3Distributed Operating System_3
Distributed Operating System_3
 
Unit 2chapter 2 memory mgmt complete
Unit 2chapter 2  memory mgmt completeUnit 2chapter 2  memory mgmt complete
Unit 2chapter 2 memory mgmt complete
 
Mca ii os u-4 memory management
Mca  ii  os u-4 memory managementMca  ii  os u-4 memory management
Mca ii os u-4 memory management
 
CH09.pdf
CH09.pdfCH09.pdf
CH09.pdf
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Virtual memory - Demand Paging
Virtual memory - Demand PagingVirtual memory - Demand Paging
Virtual memory - Demand Paging
 
Operating System
Operating SystemOperating System
Operating System
 
virtual memory Operating system
virtual memory Operating system virtual memory Operating system
virtual memory Operating system
 
Operating system 38 page replacement
Operating system 38 page replacementOperating system 38 page replacement
Operating system 38 page replacement
 
Virtual memory This is the operating system ppt.ppt
Virtual memory This is the operating system ppt.pptVirtual memory This is the operating system ppt.ppt
Virtual memory This is the operating system ppt.ppt
 
381 ccs chapter7_updated(1)
381 ccs chapter7_updated(1)381 ccs chapter7_updated(1)
381 ccs chapter7_updated(1)
 
Chapter 04
Chapter 04Chapter 04
Chapter 04
 
ikh311-06
ikh311-06ikh311-06
ikh311-06
 
Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858
 
Virtual memoryfinal
Virtual memoryfinalVirtual memoryfinal
Virtual memoryfinal
 

More from Wayne Jones Jnr (20)

Chapter 26 - Remote Logging, Electronic Mail & File Transfer
Chapter 26 - Remote Logging, Electronic Mail & File TransferChapter 26 - Remote Logging, Electronic Mail & File Transfer
Chapter 26 - Remote Logging, Electronic Mail & File Transfer
 
Ch25
Ch25Ch25
Ch25
 
Ch24
Ch24Ch24
Ch24
 
Ch23
Ch23Ch23
Ch23
 
Ch22
Ch22Ch22
Ch22
 
Ch21
Ch21Ch21
Ch21
 
Ch20
Ch20Ch20
Ch20
 
Ch19
Ch19Ch19
Ch19
 
Ch18
Ch18Ch18
Ch18
 
Ch17
Ch17Ch17
Ch17
 
Ch16
Ch16Ch16
Ch16
 
Ch15
Ch15Ch15
Ch15
 
Ch14
Ch14Ch14
Ch14
 
Ch13
Ch13Ch13
Ch13
 
Ch12
Ch12Ch12
Ch12
 
Ch10
Ch10Ch10
Ch10
 
Ch09
Ch09Ch09
Ch09
 
Ch08
Ch08Ch08
Ch08
 
Ch07
Ch07Ch07
Ch07
 
Ch06
Ch06Ch06
Ch06
 

Recently uploaded

CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
Joaquim Jorge
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
Enterprise Knowledge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
Earley Information Science
 

Recently uploaded (20)

Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 

Chapter 9 - Virtual Memory