Measure additional misses in a fully associative

This preview shows page 8 - 16 out of 23 pages.

Measure: additional misses in a fully-associative cache Conflict Placement restrictions (not fully-associative) cause useful  blocks to be displaced Think of as  capacity within set Good replacement policy is crucial! Measure: additional misses in cache of interest
Image of page 8

Subscribe to view the full document.

© 2005 Mikko Lipasti 9 Replacement Replacement How do we choose  victim ? Verbs:  Victimize, evict, replace, cast out Many policies are possible FIFO (first-in-first-out) LRU (least recently used), pseudo-LRU LFU (least frequently used) NMRU (not most recently used) NRU Pseudo-random (yes, really!) Optimal Etc
Image of page 9
© 2005 Mikko Lipasti 10 Optimal Replacement Policy? Optimal Replacement Policy? [Belady, IBM Systems Journal, 1966] Evict block with longest reuse distance i.e. next reference to block is farthest in  future Requires knowledge of the future! Can’t build it, but can model it with  trace Process trace in reverse – [Sugumar&Abraham]  describe how to do this  in one pass over the trace with some  lookahead (Cheetah simulator) Useful, since it reveals  opportunity (X,A,B,C,D,X): LRU 4-way SA $, 2 nd  X will  miss
Image of page 10

Subscribe to view the full document.

Least-Recently Used Least-Recently Used For a=2, LRU is equivalent to NMRU Single bit per set indicates LRU/MRU Set/clear on each access For a>2, LRU is difficult/expensive Timestamps? How many bits? Must find min timestamp on each eviction Sorted list? Re-sort on every access? List overhead:  log 2 (a)  bits /block Shift register implementation © Shen, Lipasti 11
Image of page 11
Practical Pseudo-LRU Practical Pseudo-LRU Rather than true LRU, use binary tree Each node records which half is older/newer Update nodes on each reference Follow older pointers to find LRU victim 12 0 0 1 0 1 1 1 J F C B X Y A Z Older Newer
Image of page 12

Subscribe to view the full document.

Practical Pseudo-LRU In Action Practical Pseudo-LRU In Action 13 J F C B X Y A Z J YXZBCFA 011: PLRU  Block B is  here 110: MRU  block is here Z <  A Y <  X B <  C J < F A  >  X C <  F A >  F B C F A J Y X Z Partial Order Encoded in Tree:
Image of page 13
Practical Pseudo-LRU Practical Pseudo-LRU Binary tree encodes PLRU  partial order At each level  point  to LRU half of subtree Each access: flip nodes along path to block Eviction: follow  LRU  path Overhead:  (a-1)/a  bits per block 14 0 0 1 0 1 1 1 J F C B X Y A Z 011: PLRU  Block B is  here 110: MRU  block is here Older Newer Refs:  J,Y,X,Z,B,C,F,A
Image of page 14

Subscribe to view the full document.

True LRU Shortcomings True LRU Shortcomings Streaming data/scans: x 0 , x 1 , …, x n Effectively no temporal reuse Thrashing:  reuse distance > a Temporal reuse exists but LRU fails All blocks march from MRU to LRU Other conflicting blocks are pushed out For  n>a  no blocks remain after  scan/thrash Incur many conflict misses after scan  ends Pseudo-LRU sometimes helps a little  15
Image of page 15
Image of page 16
You've reached the end of this preview.
  • Fall '09
  • PROFGURISOHI
  • CPU cache, Cache algorithms, cache replacement policies, Mikko Lipasti

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern