DOC PREVIEW
Berkeley COMPSCI 162 - Lecture 10 Caches and TLBs

This preview shows page 1-2-3-20-21-40-41-42 out of 42 pages.

Save
View full document
View full document
Premium Document
Do you want full access? Go Premium and unlock all 42 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 42 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 42 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 42 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 42 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 42 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 42 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 42 pages.
Access to all documents
Download any document
Ad free experience
Premium Document
Do you want full access? Go Premium and unlock all 42 pages.
Access to all documents
Download any document
Ad free experience

Unformatted text preview:

CS162 Operating Systems and Systems Programming Lecture 10 Caches and TLBsReview: Address SegmentationSlide 3Slide 4Review: PagingSlide 6Slide 7Review: Two-Level PagingSlide 9Review: Inverted TableAddress Translation ComparisonSimple Page Table ExampleHow is the translation accomplished?Goals for TodayCaching ConceptWhy Bother with Caching?Another Major Reason to Deal with CachingWhy Does Caching Help? Locality!Review: Memory HierarchyExampleReview: Sources of Cache MissesDirect Mapped CacheSet Associative CacheFully Associative CacheAdministrivia5min BreakWhere does a Block Get Placed in a Cache?Which block should be replaced on a miss?What happens on a write?Caching Applied to Address TranslationWhat Actually Happens on a TLB Miss?What happens on a Context Switch?What TLB organization makes sense?TLB organization: include protectionReducing translation time furtherOverlapping TLB & Cache AccessDemand PagingIllusion of Infinite MemoryDemand Paging is CachingDemand Paging MechanismsSummary (1/2)Summary (2/2)CS162Operating Systems andSystems ProgrammingLecture 10Caches and TLBsFebruary 23, 2011Ion Stoicahttp://inst.eecs.berkeley.edu/~cs162Lec 10.22/23 Ion Stoica CS162 ©UCB Spring 2011Review: Address Segmentation 1111 1111stackheapcodedataVirtual memory viewPhysical memory viewdataheapstack0000 00000001 00000101 00000111 00001110 0000000 00000100 00001000 00001100 00001111 0000Seg # base limit00 0001 0000 10 000001 0101 0000 10 000010 0111 0000 1 100011 1011 0000 1 0000seg # offsetcodeLec 10.32/23 Ion Stoica CS162 ©UCB Spring 2011Review: Address Segmentation 1111 1111stackheapcodedataVirtual memory viewPhysical memory viewdataheapstack0000 00000100 00001000 00001100 0000seg # offsetcodeWhat happens if stack grows to 1110 0000?1110 00000000 00000001 00000101 00000111 00001110 000Seg # base limit00 0001 0000 10 000001 0101 0000 10 000010 0111 0000 1 100011 1011 0000 1 0000Lec 10.42/23 Ion Stoica CS162 ©UCB Spring 2011Review: Address Segmentation 1111 1111stackheapcodedataVirtual memory viewPhysical memory viewdataheapstack0000 00000100 00001000 00001100 00001110 0000seg # offsetcodeNo room to grow!! Buffer overflow error0000 00000001 00000101 00000111 00001110 000Seg # base limit00 0001 0000 10 000001 0101 0000 10 000010 0111 0000 1 100011 1011 0000 1 0000Lec 10.52/23 Ion Stoica CS162 ©UCB Spring 2011Review: Paging1111 1111stackheapcodedataVirtual memory view0000 00000100 00001000 00001100 00001111 0000page # offsetPhysical memory viewdatacodeheapstack0000 00000001 00000101 0000111 0001110 000011111 1110111110 1110011101 null 11100 null 11011 null11010 null11001 null11000 null10111 null10110 null10101 null10100 null10011 null10010 1000010001 0111110000 0111001111 null01110 null 01101 null01100 null01011 01101 01010 01100 01001 0101101000 0101000111 null00110 null00101 null 00100 null 00011 0010100010 0010000001 0001100000 00010Page TableLec 10.62/23 Ion Stoica CS162 ©UCB Spring 2011Review: Paging1111 1111stackheapcodedataVirtual memory view0000 00000100 00001000 00001100 0000page # offsetPhysical memory viewdatacodeheapstack0000 00000001 00000101 0000111 0001110 000011111 1110111110 1110011101 null 11100 null 11011 null11010 null11001 null11000 null10111 null10110 null10101 null10100 null10011 null10010 1000010001 0111110000 0111001111 null01110 null 01101 null01100 null01011 01101 01010 01100 01001 0101101000 0101000111 null00110 null00101 null 00100 null 00011 0010100010 0010000001 0001100000 00010Page Table1110 0000What happens if stack grows to 1110 0000?Lec 10.72/23 Ion Stoica CS162 ©UCB Spring 2011stackReview: Paging1111 1111stackheapcodedataVirtual memory view0000 00000100 00001000 00001100 0000page # offsetPhysical memory viewdatacodeheapstack11111 1110111110 1110011101 1011111100 1011011011 null11010 null11001 null11000 null10111 null10110 null10101 null10100 null10011 null10010 1000010001 0111110000 0111001111 null01110 null01101 null01100 null01011 01101 01010 01100 01001 0101101000 0101000111 null00110 null00101 null 00100 null 00011 0010100010 0010000001 0001100000 00010Page Table0000 00000001 00000101 0000111 0001110 0000Allocate new pages where room!Challenge: Table size equal to the # of pages in virtual memory!1110 0000Lec 10.82/23 Ion Stoica CS162 ©UCB Spring 2011stackReview: Two-Level Paging1111 1111stackheapcodedataVirtual memory view0000 00000100 00001000 00001100 0000page1 # offsetPhysical memory viewdatacodeheapstack0000 00000001 00000101 0000111 0001110 0000page2 #111 110 null101 null100 011 null010 001 null000 11 11101 10 1110001 1011100 1011011 01101 10 0110001 0101100 0101011 00101 10 0010001 0001100 0001011 null 10 1000001 0111100 01110Page Tables(level 2)Page Table(level 1)1110 0000Lec 10.92/23 Ion Stoica CS162 ©UCB Spring 2011stackReview: Two-Level PagingstackheapcodedataVirtual memory view1001 0000Physical memory viewdatacodeheapstack0000 00000001 00001000 00001110 0000111 110 null101 null100 011 null010 001 null000 11 11101 10 1110001 1011100 1011011 01101 10 0110001 0101100 0101011 00101 10 0010001 0001100 0001011 null 10 1000001 0111100 01110Page Tables(level 2)Page Table(level 1)In best case, total size of page tables ≈ number of pages used by program. But requires one additional memory access!Lec 10.102/23 Ion Stoica CS162 ©UCB Spring 2011stackReview: Inverted Table1111 1111stackheapcodedataVirtual memory view0000 00000100 00001000 00001100 0000page # offsetPhysical memory viewdatacodeheapstack11111 1110111110 1110011101 1011111100 1011010010 1000010001 0111110000 0111001011 01101 01010 01100 01001 0101110000 01010 00011 0010100010 0010000001 0001100000 00010Inverted Tablehash(virt. page #) = physical page #0000 00000001 00000101 0000111 0001110 00001110 0000Total size of page table ≈ number of pages used by program. But hash more complex.Lec 10.112/23 Ion Stoica CS162 ©UCB Spring 2011Address Translation ComparisonAdvantages DisadvantagesSegmentation Fast context switching: Segment mapping maintained by CPU External fragmentationPaging (single-level page)No external fragmentation•Large size: Table size ~


View Full Document

Berkeley COMPSCI 162 - Lecture 10 Caches and TLBs

Documents in this Course
Lecture 1

Lecture 1

12 pages

Nachos

Nachos

41 pages

Security

Security

39 pages

Load more
Download Lecture 10 Caches and TLBs
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 Lecture 10 Caches and TLBs 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 Lecture 10 Caches and TLBs 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?