DOC PREVIEW
UB CSE 421 - Virtual Memory Management

This preview shows page 1-2-16-17-18-33-34 out of 34 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
View full document
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 34 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

Virtual Memory ManagementPagingDemand Paging (contd.)Page Tables (1)Page Tables (2)Page Tables (3)TLBs – Translation Lookaside BuffersInverted Page TablesPage Fault Handling (1)Page Fault Handling (2)Locking Pages in MemoryBacking StoreSharing Pages: a text editorImplementation IssuesOperating System Involvement with PagingPage Replacement AlgorithmsOptimal Page Replacement AlgorithmNot Recently Used Page Replacement AlgorithmFIFO Page Replacement AlgorithmThe Clock Page Replacement AlgorithmLeast Recently Used (LRU)Simulating LRU in Software (1)Simulating LRU in Software (2)Working-Set ModelWorking-set modelKeeping Track of the Working SetThe Working Set Page Replacement Algorithm (1)The Working Set Page Replacement Algorithm (2)The WSClock Page Replacement AlgorithmReview of Page Replacement AlgorithmsModeling Page Replacement AlgorithmsBelady's AnomalyStack AlgorithmsDesign Issues for Paging SystemsLocal versus Global Allocation Policies (1)Page Size (1)Page Size (2)1Virtual Memory ManagementB.RamamurthyChapter 102Paging The relation betweenvirtual addressesand physical memory addres-ses given bypage table3Demand Paging (contd.)Executablecode space1234567Main memory(Physical Address Space -PAS)0LAS 0LAS 1LAS 2LAS - Logical Address Space4Page Tables (1)Internal operation of MMU with 16 4 KB pages5Page Tables (2)Second-level page tablesTop-level page table32 bit address with 2 page table fieldsTwo-level page tables6Page Tables (3)Typical page table entry7TLBs – Translation Lookaside BuffersA TLB to speed up paging8Inverted Page TablesComparison of a traditional page table with an inverted page table9Page Fault Handling (1)l Hardware traps to kernell General registers savedl OS determines which virtual page neededl OS checks validity of address, seeks page framel If selected frame is dirty, write it to disk10Page Fault Handling (2)l OS brings schedules new page in from diskl Page tables updatedl Faulting instruction backed up to when it began l Faulting process scheduledl Registers restoredl Program continues11Locking Pages in MemoryVirtual memory and I/O occasionally interactProc issues call for read from device into buffern while waiting for I/O, another processes starts upn has a page faultn buffer for the first proc may be chosen to be paged outNeed to specify some pages lockedn exempted from being target pages12Backing Store(a) Paging to static swap area(b) Backing up pages dynamically13Sharing Pages: a text editor14Implementation IssuesOperating System Involvement with PagingFour times when OS involved with paging1. Process creation- determine program size- create page table2. Process execution- MMU reset for new process- TLB flushed3. Page fault time- determine virtual address causing fault- swap target page out, needed page in4. Process termination time- release page table, pages15Page Replacement AlgorithmsPage fault forces choicen which page must be removedn make room for incoming pageModified page must first be savedn unmodified just overwrittenBetter not to choose an often used pagen will probably need to be brought back in soon16Optimal Page Replacement AlgorithmReplace page needed at the farthest point in futuren Optimal but unrealizableEstimate by …n logging page use on previous runs of processn although this is impractical17Not Recently Used Page Replacement AlgorithmEach page has Reference bit, Modified bitn bits are set when page is referenced, modifiedPages are classified1. not referenced, not modified2. not referenced, modified3. referenced, not modified4. referenced, modifiedNRU removes page at randomn from lowest numbered non empty class18FIFO Page Replacement AlgorithmMaintain a linked list of all pagesn in order they came into memoryPage at beginning of list replacedDisadvantagen page in memory the longest may be often used19The Clock Page Replacement Algorithm20Least Recently Used (LRU)Assume pages used recently will used again soonn throw out page that has been unused for longest timeMust keep a linked list of pagesn most recently used at front, least at rearn update this list every memory reference !!Alternatively keep counter in each page table entryn choose page with lowest value countern periodically zero the counter21Simulating LRU in Software (1)LRU using a matrix – pages referenced in order0,1,2,3,2,1,0,3,2,322Simulating LRU in Software (2)The aging algorithm simulates LRU in softwareNote 6 pages for 5 clock ticks, (a) – (e)23Working-Set ModelDºworking-set window º a fixed number of page references Example: 10,000 instructionWSSi(working set of Process Pi) =total number of pages referenced in the most recent D (varies in time)n if D too small will not encompass entire locality.n if D too large will encompass several localities.n if D = ¥Þwill encompass entire program.D= SWSSiº total demand frames if D> mÞ ThrashingPolicy if D> m, then suspend one of the processes.24Working-set model25Keeping Track of the Working SetApproximate with interval timer + a reference bitExample: D = 10,000n Timer interrupts after every 5000 time units.n Keep in memory 2 bits for each page.n Whenever a timer interrupts copy and sets the values of all reference bits to 0.n If one of the bits in memory = 1 Þ page in working set.Why is this not completely accurate?Improvement = 10 bits and interrupt every 1000 time units.26The Working Set Page Replacement Algorithm (1)The working set is the set of pages used by the kmost recent memory referencesw(k,t) is the size of the working set at time, t27The Working Set Page Replacement Algorithm (2)The working set algorithm28The WSClock Page Replacement AlgorithmOperation of the WSClock algorithm29Review of Page Replacement Algorithms30Modeling Page Replacement AlgorithmsBelady's AnomalyFIFO with 3 page framesFIFO with 4 page framesP's show which page references show page faults31Stack Algorithms7 4 6 5 State of memory array, M, after each item in reference string is processed32Design Issues for Paging SystemsLocal versus Global Allocation Policies (1)Original configurationLocal page replacementGlobal page replacement33Page Size (1)Small page sizeAdvantagesn less internal fragmentation n better fit for various data structures, code sectionsn less unused program in memoryDisadvantagesn programs need many pages, larger page tables34Page Size (2)Overhead due to page table and internal fragmentationWheren s = average process size in bytesn p = page size in bytesn e = page entry2se poverheadp×=+page table


View Full Document

UB CSE 421 - Virtual Memory Management

Documents in this Course
Security

Security

28 pages

Threads

Threads

24 pages

Security

Security

20 pages

Security

Security

52 pages

Security

Security

20 pages

Load more
Download Virtual Memory Management
Our administrator received your request to download this document. We will send you the file to your email shortly.
Loading Unlocking...
Login

Join to view Virtual Memory Management and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Virtual Memory Management 2 2 and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?