Virtual Memory
Upcoming SlideShare
Loading in...5

Virtual Memory






Total Views
Views on SlideShare
Embed Views



2 Embeds 3 2 1



Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
Post Comment
Edit your comment

Virtual Memory Virtual Memory Presentation Transcript

  • Virtual Memory
  • Overview ● Background ● Demand Paging ● Process Creation ● Page Replacement Operating System 2011/2012
  • Background Virtual memory – 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. Operating System 2011/2012
  • Virtual to physical mapping Operating System 2011/2012
  • Demand Page Bring a page into memory only when it is needed. ● Less I/O needed ● Less memory needed ● Faster response ● More users Page is needed → reference to it invalid reference → abort not-in-memory → bring to memory ● ● Operating System 2011/2012
  • Transfer page Operating System 2011/2012
  • Valid/Invalid Bit With each page table entry a valid–invalid bit is associated (1 → in-memory, → not-in-memory) ● Initially valid–invalid but is set to 0 on all entries. ● Example of a page table snapshot. ● During address translation, if valid–invalid bit in page table entry is 0 ⇒ page fault. ● Operating System 2011/2012
  • Valid/Invalid Bit Operating System 2011/2012
  • Page Fault Operating System 2011/2012
  • Memory full ● Page replacement – find some page in memory, but not really in use, swap it out. ● ● ● algorithm performance – want an algorithm which will result in minimum number of page faults. Same page may be brought into memory several times. Operating System 2011/2012
  • Copy-on-Write Copy-on-Write (COW) allows both parent and child processes to initially share the same pages in memory. If either process modifies a shared page, only then is the page copied. COW allows more efficient process creation as only modified pages are copied. Free pages are allocated from a pool of zeroed-out pages. Operating System 2011/2012
  • Page replacement ● FIFO Page Replacement ● Optimal Page Replacement ● LRU Page Replacement ● LRU – Approximation Page Replacement ● ● ● Additional-Reference-Bits Algorithm Second-Chance Algorithm Counting-Based Page Replacement ● ● least-frequently-used (LFU) most-frequently-used (MFU) Operating System 2011/2012