These are the Lecture Slides of Operating Systems which includes File-System Structure, Defining, Logical File, Physical Device, Secondary, System Organized, File Control Block, Structure Consisting, Typical File Control Block etc.Key important points are: Virtual Memory Three, Ryan, Belady'S Anomaly, Frames, Memory Available, Reference String, Additional, First Loaded, Encountered, First Frame
Download Virtual Memory Two - Operating Systems - Lecture Slides and more Slides Computer Science in PDF only on Docsity!
Operating Systems
Lecture 23:
Virtual Memory
Execution Behavior
Breakthrough in
Memory Management
If:
Memory references are logical addresses dynamically translated into physical addresses at run time (processes may be swapped in and out of main memory occupying different regions at different times)
A process may be broken up into pieces that do not need to be located contiguously in main memory
Then it is not necessary to have all pages of a process in main memory during execution. - If the next instruction, and the next data location are in memory, then execution can proceed
Chapter 9: Virtual Memory
Implications of
Virtual Memory
More processes may be maintained in main memory - Only load in some of the pieces of each process - With so many processes in main memory, it is very likely a process will be in the Ready state at any particular time
A process may be larger than all of main memory
Execution of a Process
Operating system brings into main memory a few pieces of the program - Resident set: portion of process that is in main memory
An interrupt is generated when an address is needed that is not in main memory
Operating system places the process in a blocking state
Support Needed for
Virtual Memory
Hardware must support paging and/or segmentation
Operating system must be able to manage the movement of pages and/or segments between secondary memory and main memory - What if no room in main memory? Which frame to replace?
Page Table
Entries Formats
Replacement Policy
When all of the frames in main memory are occupied and it is necessary to bring in a new page, the replacement policy determines which page currently in memory is to be replaced.
Subject to other design issues such as:
Number of frames per process
Local or global allocation
But…
Which page is replaced?
Page removed should be the page least likely to be referenced in the near future - How is that determined? - Principle of locality again
Most policies predict the future behavior on the basis of past behavior
Basic Replacement
Algorithms
There are certain basic algorithms that are used for the selection of a page to replace, they include - Optimal - Least recently used (LRU) - First-in-first-out (FIFO) - Clock
Optimal Page Replacement
Policy
Knows the future, minimizes page faults
Theoretical limit, not a practical algorithm
LRU Example
The LRU policy does nearly as well as the optimal policy. - In this example, there are four page faults
First-in, first-out (FIFO)
Treats page frames allocated to a process as a circular buffer
Pages are removed in round-robin style
Simplest replacement policy to implement
Page that has been in memory the longest is replaced - But, these pages may be needed again very soon if it hasn’t truly fallen out of use