Podcast
Questions and Answers
What is the primary benefit of using a 'modify bit' (or 'dirty bit') in page replacement algorithms?
What is the primary benefit of using a 'modify bit' (or 'dirty bit') in page replacement algorithms?
- It doubles the page-fault service time.
- It increases access time, thereby improving overall system performance.
- It eliminates page faults entirely.
- It reduces the overhead of page transfers by only writing modified pages back to disk. (correct)
A system with a smaller physical memory can support a large virtual memory due to what aspect of page replacement?
A system with a smaller physical memory can support a large virtual memory due to what aspect of page replacement?
- Increased page-fault service time.
- The access time being increased.
- The elimination of the need for frame allocation.
- The separation between logical memory and physical memory. (correct)
What are the two main decisions a frame-allocation algorithm must make?
What are the two main decisions a frame-allocation algorithm must make?
- What the optimal page size should be and how to structure the page table.
- Which page to bring into memory and when to bring it in.
- How many frames to give each process and which frames to replace. (correct)
- Whether to use a dirty bit and how often to run the garbage collector.
How is a page-replacement algorithm typically evaluated?
How is a page-replacement algorithm typically evaluated?
What does a 'reference string' represent in the context of evaluating page-replacement algorithms?
What does a 'reference string' represent in the context of evaluating page-replacement algorithms?
How does increasing the number of available frames typically affect the number of page faults?
How does increasing the number of available frames typically affect the number of page faults?
What is the consequence of repeated access to the same page, in the context of page replacement algorithms?
What is the consequence of repeated access to the same page, in the context of page replacement algorithms?
Why is it crucial for page-replacement algorithms to aim for the minimum number of page faults?
Why is it crucial for page-replacement algorithms to aim for the minimum number of page faults?
Which of the following best describes the virtual address space of a process?
Which of the following best describes the virtual address space of a process?
What are the two primary approaches to implementing virtual memory?
What are the two primary approaches to implementing virtual memory?
In the context of demand paging, what does 'demand' refer to?
In the context of demand paging, what does 'demand' refer to?
What is a key advantage of using virtual memory with demand paging?
What is a key advantage of using virtual memory with demand paging?
Which of the following is a disadvantage associated with demand paging?
Which of the following is a disadvantage associated with demand paging?
What role does a high-speed direct access storage device play in a virtual memory system using demand paging?
What role does a high-speed direct access storage device play in a virtual memory system using demand paging?
What is the primary purpose of swapping in the context of demand paging?
What is the primary purpose of swapping in the context of demand paging?
How does demand paging contribute to the appearance of 'almost infinite' physical memory?
How does demand paging contribute to the appearance of 'almost infinite' physical memory?
A system with a single frame experiences a page reference string: 1, 4, 1, 6, 1, 6, 1, 6, 1, 6, 1. How many page faults will occur?
A system with a single frame experiences a page reference string: 1, 4, 1, 6, 1, 6, 1, 6, 1, 6, 1. How many page faults will occur?
A system uses FIFO page replacement. Given a reference string, which page should be removed?
A system uses FIFO page replacement. Given a reference string, which page should be removed?
Which page replacement policy aims to replace the page that will not be used for the longest period of time?
Which page replacement policy aims to replace the page that will not be used for the longest period of time?
Which of the following is NOT a page replacement policy?
Which of the following is NOT a page replacement policy?
What is the main goal of page replacement policies in operating systems?
What is the main goal of page replacement policies in operating systems?
In the context of page replacement algorithms, what is a 'reference string'?
In the context of page replacement algorithms, what is a 'reference string'?
A system uses the Least Recently Used (LRU) page replacement policy. Given a reference string, which page would be selected for removal?
A system uses the Least Recently Used (LRU) page replacement policy. Given a reference string, which page would be selected for removal?
Why is the choice of a page replacement policy important for operating system performance?
Why is the choice of a page replacement policy important for operating system performance?
In the context of page replacement algorithms, what is the primary purpose of Optimal Page Replacement (OPR)?
In the context of page replacement algorithms, what is the primary purpose of Optimal Page Replacement (OPR)?
Why is the Optimal Page Replacement (OPR) algorithm primarily used for measuring the performance of other algorithms, rather than practical implementation?
Why is the Optimal Page Replacement (OPR) algorithm primarily used for measuring the performance of other algorithms, rather than practical implementation?
What is Belady's Anomaly in the context of page replacement algorithms?
What is Belady's Anomaly in the context of page replacement algorithms?
Which of the following page replacement algorithms is most susceptible to Belady's Anomaly?
Which of the following page replacement algorithms is most susceptible to Belady's Anomaly?
Consider a reference string 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4
and a system with 3 frames. Using FIFO page replacement, how many page faults occur?
Consider a reference string 1, 2, 3, 4, 1, 2, 5, 1, 2, 3, 4
and a system with 3 frames. Using FIFO page replacement, how many page faults occur?
A system uses OPR page replacement with the reference string: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1
. Assuming 3 frames are available, how many page faults will occur?
A system uses OPR page replacement with the reference string: 7, 0, 1, 2, 0, 3, 0, 4, 2, 3, 0, 3, 2, 1, 2, 0, 1, 7, 0, 1
. Assuming 3 frames are available, how many page faults will occur?
A computer system employing FIFO page replacement experiences Belady's anomaly. What practical implication does this have for system administrators?
A computer system employing FIFO page replacement experiences Belady's anomaly. What practical implication does this have for system administrators?
Consider a memory system employing a page replacement algorithm. If the number of frames is increased from 3 to 4 and the number of page faults decreases, which of the following page replacement algorithms could be in use?
Consider a memory system employing a page replacement algorithm. If the number of frames is increased from 3 to 4 and the number of page faults decreases, which of the following page replacement algorithms could be in use?
Using the LRU page replacement algorithm with 4 frames, how many page faults occur for the reference string 7 0 1 2 0 3 0 4 2 3 0 3 0 3 2 1 2 0 1 7 0 1
?
Using the LRU page replacement algorithm with 4 frames, how many page faults occur for the reference string 7 0 1 2 0 3 0 4 2 3 0 3 0 3 2 1 2 0 1 7 0 1
?
What is a primary problem with implementing the LRU page replacement algorithm using a counter-based approach?
What is a primary problem with implementing the LRU page replacement algorithm using a counter-based approach?
In the stack implementation of the LRU algorithm, what can be said about the location of the least recently used page?
In the stack implementation of the LRU algorithm, what can be said about the location of the least recently used page?
Which of the following statements is true regarding the stack implementation of the LRU page replacement algorithm?
Which of the following statements is true regarding the stack implementation of the LRU page replacement algorithm?
Beyond running extremely large processes, what is another significant advantage of virtual memory?
Beyond running extremely large processes, what is another significant advantage of virtual memory?
Which of the following is a primary benefit of virtual memory?
Which of the following is a primary benefit of virtual memory?
What is the main advantage of executing a partially loaded program in a virtual memory environment?
What is the main advantage of executing a partially loaded program in a virtual memory environment?
Which of the following is a key capability enabled by virtual memory?
Which of the following is a key capability enabled by virtual memory?
What is a commonality between the LRU and OPT page replacement algorithms, in the context of Belady's Anomaly?
What is a commonality between the LRU and OPT page replacement algorithms, in the context of Belady's Anomaly?
In a virtual memory system, what is the key reason for the increased CPU utilization and throughput?
In a virtual memory system, what is the key reason for the increased CPU utilization and throughput?
Why might LRU page replacement be considered 'slow' despite its advantages?
Why might LRU page replacement be considered 'slow' despite its advantages?
How does virtual memory contribute to more efficient process creation?
How does virtual memory contribute to more efficient process creation?
What is the primary reason for reduced I/O operations when using virtual memory?
What is the primary reason for reduced I/O operations when using virtual memory?
How does the concept of 'separation of user logical memory from physical memory' enhance the utility of an operating system?
How does the concept of 'separation of user logical memory from physical memory' enhance the utility of an operating system?
Why is it beneficial for the logical address space to be much larger than the physical address space in a virtual memory system?
Why is it beneficial for the logical address space to be much larger than the physical address space in a virtual memory system?
In what scenario is the sharing of address spaces by multiple processes most advantageous?
In what scenario is the sharing of address spaces by multiple processes most advantageous?
Flashcards
Partial Program Execution
Partial Program Execution
Only a portion of a program needs to be in memory to execute.
Breaking Memory Limits
Breaking Memory Limits
Programs are no longer limited by the physical memory size.
Increased Concurrency
Increased Concurrency
Allows more programs to run concurrently.
Improved System Efficiency
Improved System Efficiency
Signup and view all the flashcards
Reduced I/O Operations
Reduced I/O Operations
Signup and view all the flashcards
Virtual Memory Definition
Virtual Memory Definition
Signup and view all the flashcards
Larger Address Space
Larger Address Space
Signup and view all the flashcards
Address Space Sharing
Address Space Sharing
Signup and view all the flashcards
Virtual Address Space
Virtual Address Space
Signup and view all the flashcards
Backing Store
Backing Store
Signup and view all the flashcards
Demand Paging
Demand Paging
Signup and view all the flashcards
Demand Segmentation
Demand Segmentation
Signup and view all the flashcards
Advantage of Virtual Memory
Advantage of Virtual Memory
Signup and view all the flashcards
Disadvantage of Paging
Disadvantage of Paging
Signup and view all the flashcards
Swapping
Swapping
Signup and view all the flashcards
Page Replacement Policies
Page Replacement Policies
Signup and view all the flashcards
Modify Bit in Page Replacement
Modify Bit in Page Replacement
Signup and view all the flashcards
Page-Replacement Algorithm Goal
Page-Replacement Algorithm Goal
Signup and view all the flashcards
Reference String Evaluation
Reference String Evaluation
Signup and view all the flashcards
Reference String
Reference String
Signup and view all the flashcards
Frames vs. Page Faults
Frames vs. Page Faults
Signup and view all the flashcards
Frame-Allocation Algorithm
Frame-Allocation Algorithm
Signup and view all the flashcards
Page Replacement Benefits
Page Replacement Benefits
Signup and view all the flashcards
Overhead Problems
Overhead Problems
Signup and view all the flashcards
FIFO Page Replacement
FIFO Page Replacement
Signup and view all the flashcards
Optimal Page Replacement (OPT)
Optimal Page Replacement (OPT)
Signup and view all the flashcards
Least Recently Used (LRU)
Least Recently Used (LRU)
Signup and view all the flashcards
Random Page Replacement
Random Page Replacement
Signup and view all the flashcards
Page Fault Increase
Page Fault Increase
Signup and view all the flashcards
Number of Page Faults
Number of Page Faults
Signup and view all the flashcards
Page Replacement Policy
Page Replacement Policy
Signup and view all the flashcards
Page Removal Selection
Page Removal Selection
Signup and view all the flashcards
Page Fault
Page Fault
Signup and view all the flashcards
LRU Page Replacement
LRU Page Replacement
Signup and view all the flashcards
LRU Implementation: Counters
LRU Implementation: Counters
Signup and view all the flashcards
LRU Implementation: Stack
LRU Implementation: Stack
Signup and view all the flashcards
Virtual Memory Benefit: Large Processes
Virtual Memory Benefit: Large Processes
Signup and view all the flashcards
Virtual Memory Benefit: Multiprogramming
Virtual Memory Benefit: Multiprogramming
Signup and view all the flashcards
Virtual Memory Benefit: CPU Utilization
Virtual Memory Benefit: CPU Utilization
Signup and view all the flashcards
Belady's Anomaly
Belady's Anomaly
Signup and view all the flashcards
OPR as a Benchmark
OPR as a Benchmark
Signup and view all the flashcards
Number of Frames
Number of Frames
Signup and view all the flashcards
Page fault Number (given)
Page fault Number (given)
Signup and view all the flashcards
Study Notes
- Chapter 9 is about Virtual Memory
Background
- Code must be in memory to run effectively but not all code is used
- Entire program code doesn't have to be in the system memory
- Programs are no longer limited by physical storage
- Programs use less memory while running, more programs can run at one time
- Throughput and CPU utilization is increased when running in real time
- Less I/O is needed, that helps user programs run faster
- Virtual memory is a user's logical memory split from physical memory
- Only part of the program needs to be in memory to run it.
- Logical address space can be bigger compared to physical address space
- Allows for more efficient processes creation
- More programs can run at once when implementing virtual memory
- Less I/O load or swap processes when implementing virtual memory
- Virtual memory uses two approaches: demand paging and demand segmentation.
- Demand segmentation will not be covered
Demand Paging, Overview
- Jobs run with less main memory in segmented memory allocation
- There is an almost infinite appearance of physical memory
- Increased overhead caused by tables and page interrupts
- High-speed direct access storage device is required
Benefits of Virtual Memory
- Bring a page into memory only when needed by a user
- Less I/O and memory is ideal for more users and faster response times
Lazy Swapper
- Never swaps a page into memory until the specific page will be used
- A swapper deals with pages
Basic Demand Paging
- Guess what pages will be used before being swapped out
- A pager can bring “guessed” pages into memory alone versus the whole process
- New Memory Management Unit functionality is needed to implement demand paging
- Needed is understanding that page is in memory and located on the disk
- The valid-invalid scheme is for valid protection (see next slide).
- Pages that are needed, and happen to be memory resident don't change from demand paging
- For pages that are needed, and are not memory resident need to find and load its storage
- Should perform processes without changing programmer code or behavior
- Page table entries use valid-invalid bits
- "v" means in-memory, while "i" means not-in-memory
- Valid-invalid bit is initialized to "i"
Invalid Pages
- Invalid pages are non-valid and are not in the logical address space
- Invalid pages that are valid are currently on disk
Page Faults
- A page fault occurs when a page is marked invalid
- A trap page fault occurs from the operating system
- When a page fault occurs, the operating system uses another table
- An invalid reference will abort in most cases
- If valid and not in memory, the system will find a free frame location
- Swap that page via disk operation and reset the table to show page location and validation
- Restart the instruction when swapping is complete
Handling a Page fault
- In the event there are no free frames, select a victim to replace
Page Replacement
- Page replacement occurs when there are no free frames available
- When there are no free frames, a page fault occurs, and action to implement replacement begins.
- Page replacement finds the proper page in memory, then puts it out
- Decision to clear a frame is dependent on the desired algorithm
- Key point is to minimize number of page faults
- Pages may be moved to memory numerous times
Basic Page Replacement
- Find the desired location of the page disk
- Find a free frame: utilize algorithm to replace if there aren't any
- If free, write a victim to disk if it's dirty and restart the process that caused the fault
- When a process asks for a page, page replacement occurs if a page fault occurs.
- A page fault exists if there are no free frames
Issues of Page Replacement
- Overhead problems occur if there are no free frames, resulting in 2 page transfers
- This doubles page-fault time & increases access time
- To resolve, use "modify" or "dirty" bits to lower transfers
- Only modded pages written back on the disk
- Page replacement separates the logical memory from the physical memory.
- Resulting in a large virtual memory on a smaller physical memory
Algorithms to use
- Frame allocation algorithms determine: frames per process, and which frames to replace
- Choose page-replace algorithms that give minimum page faults
- Page replacement algorithms are tested by memory references
- Algorithm testing can be completed by checking faults and string
- Strings are simply page numbers, not full addresses
- Repeated access to the same page does not cause a page fault
- Results heavily depend of provided frame amounts
Page String
- If CPU has the following addresses, and page size is 100 bytes, reference string will be
- Example - the addresses 0100, 0432, 0101, 0612 etc: the reference string will equal to 1, 4, 1, 6
FIFO, First-In-First-Out
- This involves removing in memory pages with longest time stamps
- The page is in memory for the longest period
- Best page to remove is one that is not in memory for long
- More memory does not equal better performance in FIFO
- Efficiency measures a ratio to the number of page interrupts to number of requests
OPT, Optimal Page Replacement (OPR)
- OPT replaces pages not accessed for a period of time in the future
- Only provides measurements of how well a algorithm performs when comparing
- It replaces the page that will not be used for the longest time
- One is not able to read the future
LRU, Least Recently Used
- LRU utilizes past info instead of future
- Replaces pages that have not been used for an extended passage of time
- Time stamp of last use is saved
LRU Implementation
- To get an order of frames for a time of last use
- You can use different methods to implement LRU algorithms
- Methods include a counter, in which page table entries have one
- The clock content is copied into the counter as reference
- Replacement occurs to smallest time value searches
LRU Stack
- Maintain a page number stack in a double link form
- (Header pointer & Tail pointer)
- Page is moved at the top and used as a reference
- Page found on top, is most recently used
- No search for replacement
- LRU uses special hardware and slow
- LRU and OPT are stack algorithms so they don't have Belady's anomaly
Summary
- Processes can execute with logical address space larger than actual physical address space
- Virtual memory runs very large processes, raises multiprogramming, and increases CPU
- Programs run when stored entirely in memory via virtual memory
- Job size is not restricted when using virtual memory
- Demand paging lowers the number of frames per process
- Total memory replacement is greater than physical then replace the pages from memory to make place.
- Page replacement algorithms are used for all of these actions
- FIFO is easy to program but can suffer from Belady's anomaly
- OPT needs future knowledge, which is impossible
- LRU, the Least Recently Used algorithm, best approximates the OPT, although difficult to implement
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.