lec11_mem

lec11_mem - Review Tuesdays Lecture CSE120 Principles of...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
1 CSE120 Principles of Operating Systems Prof Yuanyuan (YY) Zhou Lecture 11: paging Nov 4th, 2010 Review Tuesday’s Lecture Reducing space overhead of page tables Allocate page table entry (PTE) on demand Two level page tables Master page table + secondary page table Reducing time for address translation Hardware support to cache TLB (miss vs. hit) Demand paging When physical memory is full, evicting some pages, and write dirty pages to swap space. Reload them into memory if they are accessed again 11/3/2010 CSE 120 2 Agenda for this lecture Put things together TLB miss, page fault, etc Some optimizations leveraging VM A couple of replacement algorithms 11/3/2010 CSE 120 3 11/3/2010 CSE 120 4 Hardware-Controlled TLB On a TLB miss (different from page fault) Hardware loads the PTE into the TLB Need to write back if there is no free entry But if the page containing the PTE is invalid, Generate a fault VM software performs fault handling Restart from the same instruction TLB miss happens again, and this time hardware will find the PTE from the page table, and load it into the TLB On a TLB hit, hardware checks the valid bit If valid, pointer to page frame in memory If invalid, the hardware generates a page fault Perform page fault handling Restart the faulting instruction
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 11/3/2010 CSE 120 5 Software-Controlled TLB On a miss in TLB, VM software Evict one (may need to write it back first) if there is no free entry Check if the page containing the PTE is in memory If no, perform page fault handling Load the PTE into the TLB Restart the faulting instruction On a hit in TLB, the hardware checks valid bit If valid, pointer to page frame in memory If invalid, the hardware generates a page fault Perform page fault handling Restart the faulting instruction Example: RISC including SPARC, Alpha, MIPS, HP PA 11/3/2010 CSE 120 6 Hardware vs. Software Controlled Hardware approach Efficient Inflexible Need more space for page table Software approach Flexible Software can do mappings by hashing PP# (Pid, VP#) (Pid, VP#) PP# Can deal with large virtual address space 11/3/2010 CSE 120 7 Paged Virtual Memory We’ve mentioned before that pages can be moved between memory and disk This process is called demand paging OS uses main memory as a page cache of all the data allocated by processes in the system Initially, pages are allocated from memory When memory fills up, allocating a page in memory requires some other page to be evicted from memory Why physical memory pages are called “frames” Evicted pages go to disk (where? the swap file/backing store) The movement of pages between memory and disk is done by the OS, and is transparent to the application 11/3/2010 CSE 120 8 Page Faults What happens when a process accesses a page that
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

lec11_mem - Review Tuesdays Lecture CSE120 Principles of...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online