Podcast
Questions and Answers
What advantage does FIFO page replacement take advantage of?
What advantage does FIFO page replacement take advantage of?
- Instructions execute sequentially most of the time. (correct)
- Programs make frequent distant past references.
- Branching is a major part of most programs.
- Programs often execute instructions randomly.
Which page replacement algorithm replaces the page that will not be used for the longest period of time?
Which page replacement algorithm replaces the page that will not be used for the longest period of time?
- Optimal Page Replacement (correct)
- First In First Out (FIFO)
- Least Recently Used (LRU)
- Random Page Replacement
What is a main drawback of FIFO page replacement?
What is a main drawback of FIFO page replacement?
- It requires complex implementation.
- It leads to more page faults in all scenarios.
- It fails to take locality into account.
- It may replace pages that are still frequently accessed. (correct)
How does the Least Recently Used (LRU) replacement algorithm determine which page to remove?
How does the Least Recently Used (LRU) replacement algorithm determine which page to remove?
What is the purpose of implementing approximate algorithms like LRU?
What is the purpose of implementing approximate algorithms like LRU?
What is the outcome when a process exceeds its Resident Set (RS) during a page fault?
What is the outcome when a process exceeds its Resident Set (RS) during a page fault?
Why is FIFO considered easy to implement?
Why is FIFO considered easy to implement?
What occurs in a page buffer when a page is modified and needs to be removed?
What occurs in a page buffer when a page is modified and needs to be removed?
Which of the following statements characterizes LRU algorithms?
Which of the following statements characterizes LRU algorithms?
What is a significant improvement suggested for FIFO page replacement policy?
What is a significant improvement suggested for FIFO page replacement policy?
What is the primary characteristic of the Least Recently Used (LRU) page replacement algorithm?
What is the primary characteristic of the Least Recently Used (LRU) page replacement algorithm?
In the context of LRU, what happens when a non-resident page p is referenced?
In the context of LRU, what happens when a non-resident page p is referenced?
What strategy is typically employed to approximate the LRU replacement?
What strategy is typically employed to approximate the LRU replacement?
How many page faults occurred in the example reference string using the LRU algorithm?
How many page faults occurred in the example reference string using the LRU algorithm?
Which method yields the fewest page faults compared to the LRU algorithm in the provided data?
Which method yields the fewest page faults compared to the LRU algorithm in the provided data?
What role does the Page Table serve in relation to the LRU algorithm?
What role does the Page Table serve in relation to the LRU algorithm?
Which of the following is NOT used in the process of LRU page replacement?
Which of the following is NOT used in the process of LRU page replacement?
What does a Present bit value of P==0 indicate?
What does a Present bit value of P==0 indicate?
What action is taken if the Writable bit W==0?
What action is taken if the Writable bit W==0?
In the context of the Second-Chance Page-Replacement Algorithm, what happens if a page has a reference bit of 1?
In the context of the Second-Chance Page-Replacement Algorithm, what happens if a page has a reference bit of 1?
What prompts the application of page replacement?
What prompts the application of page replacement?
What is the purpose of the Accessed bit A?
What is the purpose of the Accessed bit A?
Which algorithm uses a circular list of pages to manage memory?
Which algorithm uses a circular list of pages to manage memory?
Which situation leads to a page being marked as Dirty?
Which situation leads to a page being marked as Dirty?
What does the Enhanced 2nd Chance algorithm prioritize for replacement?
What does the Enhanced 2nd Chance algorithm prioritize for replacement?
When is 'second chance' given to a page in the Clock replacement algorithm?
When is 'second chance' given to a page in the Clock replacement algorithm?
What is the main function of the 'Dirty' bit in a page table entry?
What is the main function of the 'Dirty' bit in a page table entry?
Flashcards
FIFO Page Replacement
FIFO Page Replacement
A page replacement algorithm that replaces the oldest page in memory. It is simple to implement but does not account for the possibility of pages being referenced again after a long time.
MIN Page Replacement
MIN Page Replacement
An optimal page replacement algorithm that replaces the page that will not be used for the longest period of time. It is impossible to implement in practice because it requires knowledge of the future reference string.
LRU Page Replacement
LRU Page Replacement
A page replacement algorithm that replaces the page that has not been referenced for the longest time. It approximates the behavior of the optimal algorithm by considering past references.
LRU Implementation
LRU Implementation
Signup and view all the flashcards
FIFO vs. LRU
FIFO vs. LRU
Signup and view all the flashcards
Page Buffering
Page Buffering
Signup and view all the flashcards
Clean List
Clean List
Signup and view all the flashcards
Dirty List
Dirty List
Signup and view all the flashcards
Page Fault
Page Fault
Signup and view all the flashcards
Resident Set (RS)
Resident Set (RS)
Signup and view all the flashcards
Page Replacement Algorithms
Page Replacement Algorithms
Signup and view all the flashcards
Clock Algorithm
Clock Algorithm
Signup and view all the flashcards
Reference Bit (USE bit)
Reference Bit (USE bit)
Signup and view all the flashcards
Second Chance Algorithm
Second Chance Algorithm
Signup and view all the flashcards
Modified Bit (Dirty bit)
Modified Bit (Dirty bit)
Signup and view all the flashcards
Enhanced Second Chance Algorithm
Enhanced Second Chance Algorithm
Signup and view all the flashcards
Ad Hoc Algorithm
Ad Hoc Algorithm
Signup and view all the flashcards
Page Table Entry (PTE)
Page Table Entry (PTE)
Signup and view all the flashcards
Physical Page Number (PPN)
Physical Page Number (PPN)
Signup and view all the flashcards
Reference String
Reference String
Signup and view all the flashcards
MRU (Most Recently Used)
MRU (Most Recently Used)
Signup and view all the flashcards
LRU (Least Recently Used)
LRU (Least Recently Used)
Signup and view all the flashcards
Time Reference Counter
Time Reference Counter
Signup and view all the flashcards
Study Notes
Lecture Agenda - November 19
- Reminders:
- Read Chapters 20-22 (Virtual Memory Module 8)
- Project 4 Demo due Wednesday, November 20 (Driving Simulation using threads and concurrency)
- Project 5 Deliverable 3 due November 20 (Implementing a Simple File System)
- Quiz tomorrow
- Attendance required
Topics Covered Last Time
- Demand Paging
- Page Replacement
- FIFO (First-In, First-Out)
- Optimal Algorithm
Topics Covered Today
- Page Replacement Algorithms
- FIFO
- Optimal (MIN)
- LRU (Least Recently Used)
- LRU Approximations
- Policies for managing memory allocation
- PollEv.com/gkwatny9
- Send gkwatny9 to 22333
FIFO Page Replacement
- Reference String: 7 0 1 2 0 3 0 4 2 3 0 3 2 1 2 0 1 7 0 1
- Page Frames: Specific example table showing page replacements with 15 faults.
FIFO Algorithm Details
- Easy to implement using single pointer to oldest page in memory.
- When a page is replaced, advance pointer.
- Locality Principle: A positive in FIFO. Most instructions execute sequentially. Likelihood of referencing a page from the distant past decreases with time. Large data structures often referenced sequentially.
Optimal (MIN) Algorithm
- Replaces page that won't be used for longest period of time.
- Difficult to implement in real time: Requires future knowledge of page references.
- 4 frames, example: 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4, 5, resulting in 6 page faults.
LRU (Least Recently Used) Algorithm
- Replaces the least recently used page.
- Implementation:
- Requires a queue (ordered list) containing page numbers.
- When a page is referenced, move it to back (end) of the queue.
- Queue always ordered (most recently used to least recently used).
- If non-resident page referenced, remove page at front of queue and place new page at the end.
- Example with 4 frames: A specific example demonstrating the replacement process with 12 page faults.
LRU Implementation Details Including Alternatives
- Detailed description of how LRU is implemented using a queue.
- Alternative Method: Discusses using a counter to track page reference times.
- Every page entry has a related time reference
- When a page is referenced, copy the clock time to the PTE's time reference field.
- When a page needs replacing, check time references to select appropriate page.
How to Approximate LRU
- Uses information collected as a process executes to approximate LRU behaviour.
- Page tables: Connection between virtual addresses and physical addresses is a significant tool.
Page Table Bits
- Specific PTE bits relevant for LRU algorithms (example Intel PTE)
- Present (Valid) bit
- Writeable bit
- Accessed/Used bit
- Dirty/Modified bit
When to Apply Page Replacement
- Page fault occurs (no free frames in memory)
- Algorithm finds page to evict.
- Keeps frequently used pages in memory.
Clock Algorithms
- Use Page Table Entry (PTE) bits & a circular queue of pages.
- Pointer around like a clock.
- Only do work at page fault time.
Second Chance Algorithm
- Requires reference bit per page and organized in an ordered page list (Clock Algorithm).
- If page needs replacement, and reference bit = 1, set bit to 0 and leave in memory.
Enhanced 2nd Chance
- Priority-based replacement: Uses referenced and modified bits.
- Different priority levels: Distinct categories based on usage. (ex. 00 least used to 11 most used)
Page Buffering
- LRU algorithms perform well in memory minimizing page faults but high implementation overhead and hardware required.
- FIFO is simple but it doesn't consider page reference frequency.
- Ways to improve FIFO: Adding a 2nd chance policy or similar.
Page Buffering, Including Variable Allocation
- Process gets maximum number of frames (Resident Set).
- FIFO list is created to efficiently manage frames.
- Page Fault: An evicted page is put on a clean or modified list managed by the OS.
- Example of variable allocation: An excerpt from the document explaining the variable allocation (also discussed in more detail in Resident Set Management).
Fetch Policy
- Demand Paging: Only brings pages into memory when referenced, many page faults at beginning. Principle of locality; more references to recently loaded pages means fewer faults.
- Prepaging: Brings pages into memory that might be referenced following a page fault. Exploits the characteristic that sequential pages are loaded in secondary storage together, improves load speed.
Resident Set Management
- How many pages to keep in main memory for a given process.
- Trade-offs: Smaller allocation means more processes can be held but more faults.
- Certain size, beyond adding more frames, won't improve fault rate.
Policies for Resident Set Size
- Fixed allocation: Assigns fixed number of frames to the process.
- Variable allocation: The number of page frames assigned to the processes changes over time, usually to try and hold the working set (important pages).
Replacement Scope
- Global: The replacement strategy considers all unlocked pages in main memory.
- Local: Only looks at resident set pages related to the process that has experienced the fault.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.
Related Documents
Description
Test your understanding of Virtual Memory concepts as outlined in Chapters 20-22. This quiz covers page replacement algorithms, specifically FIFO, Optimal, and LRU. Make sure to review the examples and algorithms discussed in class to prepare effectively.