SlideShare a Scribd company logo
1 of 13
Virtual Memory
Management
Content
1. Virtual Memory
2. Virtual Address Space
3. Shared Library
4. Demand Paging
5. Virtual Memory Table
6. Page Fault
7. Page Replacement
8. Page Replacement Algorithm
Virtual Memory
Virtual Memory : Conceptual separation of user logical memory from
physical memory
 Only part of the program needs to be
in memory for execution
 Logical address space can therefore
be much larger than physical address
space
 Allows address spaces to be shared by
several processes
 Allows for more efficient process
creation
 More programs running concurrently
 Less I/O needed to load or swap
processes
Virtual Address Space
 Virtual address space–logical view of how process is stored in
memory
 Usually start at address 0, contiguous addresses until end of space
 Meanwhile, physical memory organized in page frames
 MMU must map logical to physical
 Virtual memory can be implemented via:
 Demand paging
 Demand segmentation
Virtual Address Space (cont.)
 Usually design logical address space for stack to
start at Max logical address and grow “down”
while heap grows “up”
 Maximizes address space use
 Unused address space between the two is hole
 No physical memory needed until heap or stack grows to a
given new page
 Enables sparse address spaces with holes left for
growth, dynamically linked libraries, etc.
 System libraries shared via mapping into virtual
address space
 Shared memory by mapping pages read-write
into virtual address space
 Pages can be shared during fork(), speeding
process creation
Shared Library
 System libraries can be shared by several processes through mapping of the shared
object into a virtual address space.
 Virtual Memory allows one process to create a region of memory that it can share
with another process through the use of Shared Memory.
Demand Paging
 Could bring entire process into memory
at load time Or bring a page into
memory only when it is needed
 Less I/O needed, no unnecessary I/O
 Less memory needed
 Faster response
 More users
 Similar to paging system with swapping
(diagram on right)
 Page is needed =>reference to it
 invalid reference =>abort
 not-in-memory =>bring to memory
 Lazy swapper–never swaps a page into
memory unless page will be needed
 Swapper that deals with pages is a pager
Virtual Memory Table
 With each page table entry a valid–invalid
bit is associated (1: in-memory, 0:not-in-
memory)
 Initially valid–invalid but is set to 0 on all
entries

 During address translation, if valid–invalid
bit in page table entry is 0 : page fault
 Example of a page table snapshot:
Page Fault
STEPS IN HANDLING A PAGE FAULT
1. The process has touched a page not
currently in memory.
2. Check an internal table for the target
process to determine if the reference was
valid (do this in hardware.)
3. If page valid, but page not resident, try to
get it from secondary storage.
4. Find a free frame; a page of physical
memory not currently in use. (May need to
free up a page.)
5. Schedule a disk operation to read the
desired page into the newly allocated
frame.
6. When memory is filled, modify the page
table to show the page is now resident.
7. Restart the instruction that failed
Page Replacement
Approach: If no physical frame is free, find
one not currently being touched and free it.
Steps to follow are:
1. Find requested page on disk.
2. Find a free frame.
a. If there's a free frame, use it
b. Otherwise, select a victim page.
c. Write the victim page to disk.
3. Read the new page into freed frame.
Change page and frame tables.
4. Restart user process.
Hardware requirements include "dirty" or
modified bit.
When we over-allocate memory, we need to push out something already in memory.
Over-allocation may occur when programs need to fault in more pages than there are physical
frames to handle.
Page Replacement Algorithms
When memory is over allocated, we can either swap out some process, or overwrite some
pages.
Which pages should we replace ? <--- here the goal is to minimize the number of faults.
FIFO
 Conceptually easy to implement; either use a time-stamp on pages, or organize on a queue.
(The queue is by far the easier of the two methods.)
OPTIMAL REPLACEMENT
 This is the replacement policy that results in the lowest page fault rate.
 Algorithm: Replace that page which will not be next used for the longest period of time.
 Impossible to achieve in practice; requires crystal ball.
LEAST RECENTLY USED ( LRU )
 Replace that page which has not been used for the longest period of time.
 Results of this method considered favorable. The difficulty comes in making it work.
 Implementation possibilities:
 Time stamp on pages - records when the page is last touched.
 Page stack - pull out touched page and put on top
Page Replacement (cont.)
Questions?

More Related Content

What's hot (19)

Page replacement
Page replacementPage replacement
Page replacement
 
basics of virtual memory
basics of virtual memorybasics of virtual memory
basics of virtual memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Ch9 Virtual Memory
Ch9 Virtual MemoryCh9 Virtual Memory
Ch9 Virtual Memory
 
Virtual memory
Virtual memory Virtual memory
Virtual memory
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
40 demand paging
40 demand paging40 demand paging
40 demand paging
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 
Thrashing allocation frames.43
Thrashing allocation frames.43Thrashing allocation frames.43
Thrashing allocation frames.43
 
Operating Systems - Virtual Memory
Operating Systems - Virtual MemoryOperating Systems - Virtual Memory
Operating Systems - Virtual Memory
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
Page replacement
Page replacementPage replacement
Page replacement
 
Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
Virtual Memory Management
Virtual Memory ManagementVirtual Memory Management
Virtual Memory Management
 
virtual memory
virtual memoryvirtual memory
virtual memory
 
Virtual memory presentation
Virtual memory presentationVirtual memory presentation
Virtual memory presentation
 
Virtual Memory
Virtual MemoryVirtual Memory
Virtual Memory
 

Similar to Virtual Memory Management

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 managementRai University
 
Virtual memory - Demand Paging
Virtual memory - Demand PagingVirtual memory - Demand Paging
Virtual memory - Demand Pagingjeyaperumal
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memoryMazin Alwaaly
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managmentSantu Kumar
 
Unit 2chapter 2 memory mgmt complete
Unit 2chapter 2  memory mgmt completeUnit 2chapter 2  memory mgmt complete
Unit 2chapter 2 memory mgmt completeKalai Selvi
 
Operating system 37 demand paging
Operating system 37 demand pagingOperating system 37 demand paging
Operating system 37 demand pagingVaibhav Khanna
 
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
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OSC.U
 
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.pptry54321288
 
virtual memory Operating system
virtual memory Operating system virtual memory Operating system
virtual memory Operating system Shaheen kousar
 
Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858marangburu42
 
Virtual memoryfinal
Virtual memoryfinalVirtual memoryfinal
Virtual memoryfinalmarangburu42
 

Similar to Virtual Memory Management (20)

Virtual memory
Virtual memoryVirtual memory
Virtual memory
 
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 - Demand Paging
Virtual memory - Demand PagingVirtual memory - Demand Paging
Virtual memory - Demand Paging
 
Operating System
Operating SystemOperating System
Operating System
 
Module4
Module4Module4
Module4
 
Computer architecture virtual memory
Computer architecture virtual memoryComputer architecture virtual memory
Computer architecture virtual memory
 
Virtual memory managment
Virtual memory managmentVirtual memory managment
Virtual memory managment
 
Unit 2chapter 2 memory mgmt complete
Unit 2chapter 2  memory mgmt completeUnit 2chapter 2  memory mgmt complete
Unit 2chapter 2 memory mgmt complete
 
Virtual Memory.pdf
Virtual Memory.pdfVirtual Memory.pdf
Virtual Memory.pdf
 
Operating system 37 demand paging
Operating system 37 demand pagingOperating system 37 demand paging
Operating system 37 demand paging
 
Virtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdfVirtual Memory Management Part - I.pdf
Virtual Memory Management Part - I.pdf
 
Mem mgt
Mem mgtMem mgt
Mem mgt
 
Lecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptxLecture 8- Virtual Memory Final.pptx
Lecture 8- Virtual Memory Final.pptx
 
Ch10 OS
Ch10 OSCh10 OS
Ch10 OS
 
OS_Ch10
OS_Ch10OS_Ch10
OS_Ch10
 
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
 
virtual memory Operating system
virtual memory Operating system virtual memory Operating system
virtual memory Operating system
 
Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858Virtualmemoryfinal 161019175858
Virtualmemoryfinal 161019175858
 
Virtual memoryfinal
Virtual memoryfinalVirtual memoryfinal
Virtual memoryfinal
 

Recently uploaded

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfjoe51371421
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AIABDERRAOUF MEHENNI
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 

Recently uploaded (20)

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Exploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the ProcessExploring iOS App Development: Simplifying the Process
Exploring iOS App Development: Simplifying the Process
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
why an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdfwhy an Opensea Clone Script might be your perfect match.pdf
why an Opensea Clone Script might be your perfect match.pdf
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AISyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
SyndBuddy AI 2k Review 2024: Revolutionizing Content Syndication with AI
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 

Virtual Memory Management

  • 2. Content 1. Virtual Memory 2. Virtual Address Space 3. Shared Library 4. Demand Paging 5. Virtual Memory Table 6. Page Fault 7. Page Replacement 8. Page Replacement Algorithm
  • 3. Virtual Memory Virtual Memory : Conceptual separation of user logical memory from physical memory  Only part of the program needs to be in memory for execution  Logical address space can therefore be much larger than physical address space  Allows address spaces to be shared by several processes  Allows for more efficient process creation  More programs running concurrently  Less I/O needed to load or swap processes
  • 4. Virtual Address Space  Virtual address space–logical view of how process is stored in memory  Usually start at address 0, contiguous addresses until end of space  Meanwhile, physical memory organized in page frames  MMU must map logical to physical  Virtual memory can be implemented via:  Demand paging  Demand segmentation
  • 5. Virtual Address Space (cont.)  Usually design logical address space for stack to start at Max logical address and grow “down” while heap grows “up”  Maximizes address space use  Unused address space between the two is hole  No physical memory needed until heap or stack grows to a given new page  Enables sparse address spaces with holes left for growth, dynamically linked libraries, etc.  System libraries shared via mapping into virtual address space  Shared memory by mapping pages read-write into virtual address space  Pages can be shared during fork(), speeding process creation
  • 6. Shared Library  System libraries can be shared by several processes through mapping of the shared object into a virtual address space.  Virtual Memory allows one process to create a region of memory that it can share with another process through the use of Shared Memory.
  • 7. Demand Paging  Could bring entire process into memory at load time Or bring a page into memory only when it is needed  Less I/O needed, no unnecessary I/O  Less memory needed  Faster response  More users  Similar to paging system with swapping (diagram on right)  Page is needed =>reference to it  invalid reference =>abort  not-in-memory =>bring to memory  Lazy swapper–never swaps a page into memory unless page will be needed  Swapper that deals with pages is a pager
  • 8. Virtual Memory Table  With each page table entry a valid–invalid bit is associated (1: in-memory, 0:not-in- memory)  Initially valid–invalid but is set to 0 on all entries   During address translation, if valid–invalid bit in page table entry is 0 : page fault  Example of a page table snapshot:
  • 9. Page Fault STEPS IN HANDLING A PAGE FAULT 1. The process has touched a page not currently in memory. 2. Check an internal table for the target process to determine if the reference was valid (do this in hardware.) 3. If page valid, but page not resident, try to get it from secondary storage. 4. Find a free frame; a page of physical memory not currently in use. (May need to free up a page.) 5. Schedule a disk operation to read the desired page into the newly allocated frame. 6. When memory is filled, modify the page table to show the page is now resident. 7. Restart the instruction that failed
  • 10. Page Replacement Approach: If no physical frame is free, find one not currently being touched and free it. Steps to follow are: 1. Find requested page on disk. 2. Find a free frame. a. If there's a free frame, use it b. Otherwise, select a victim page. c. Write the victim page to disk. 3. Read the new page into freed frame. Change page and frame tables. 4. Restart user process. Hardware requirements include "dirty" or modified bit. When we over-allocate memory, we need to push out something already in memory. Over-allocation may occur when programs need to fault in more pages than there are physical frames to handle.
  • 11. Page Replacement Algorithms When memory is over allocated, we can either swap out some process, or overwrite some pages. Which pages should we replace ? <--- here the goal is to minimize the number of faults. FIFO  Conceptually easy to implement; either use a time-stamp on pages, or organize on a queue. (The queue is by far the easier of the two methods.) OPTIMAL REPLACEMENT  This is the replacement policy that results in the lowest page fault rate.  Algorithm: Replace that page which will not be next used for the longest period of time.  Impossible to achieve in practice; requires crystal ball. LEAST RECENTLY USED ( LRU )  Replace that page which has not been used for the longest period of time.  Results of this method considered favorable. The difficulty comes in making it work.  Implementation possibilities:  Time stamp on pages - records when the page is last touched.  Page stack - pull out touched page and put on top