1 / 16

Project: Translation Look-Aside Buffer

Project: Translation Look-Aside Buffer. ICS 143B L. Bic. NOTE: This is an individual project—no groups are allowed. Assignment. implement a software emulation of a TLB generate reference strings study how TLB reduces number of main memory references. Organization of VM and TLB.

robersonc
Télécharger la présentation

Project: Translation Look-Aside Buffer

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Project: Translation Look-Aside Buffer ICS 143B L. Bic NOTE: This is an individual project—no groups are allowed

  2. Assignment • implement a software emulation of a TLB • generate reference strings • study how TLB reduces number of main memory references

  3. Organization of VM and TLB • assume both paging and segmentation (Sect. 8.2.3) • VM address is an integer, divided into s,p,w • TLB:

  4. Organization of VM and TLB • implement TLB as an integer array: • TLB.LRU[], TLB.SP[] • frame number f is not needed • implement each s,p as a single integer • operations on TLB: • do for each s,p from a given RS: • search TLB.SP[] sequentially for a match • if not found, replace one entry with the current s,p using LRU information • if found, count as TLB hit • update LRU information

  5. Organization of VM and TLB • LRU implementation • LRU field is a counter c • for any given sp: • when sp is found (TLB hit), set corresponding c=0 • increment c of all frames by 1 • when sp is not found (TLB miss), select entry with largest c for replacement

  6. Performance evaluations • measure effectiveness of TLB: • disregards page faults (assume VM is resident) • disregard caching • cost w/o TLB: 3 main memory accesses (3m) • cost w/ TLB: • fixed overhead for each VM access, cm • memory accesses: 1m for each TLB hit, 3m for each TLB miss • determine hit ratio h experimentally cost of VM access without TLB cost of VM access with TLB E =

  7. Performance evaluations • determine best case and worst case (h=0, h=1, c=0, c=1) • determine best case and worst case for realistic c (e.g., c=0.1) • determine h using simulation for different RS types; compute and plot E 3m hm+(1–h)3m+cm 33–2h+c E = =

  8. Performance evaluations • determine h for different RSs and TLB sizes hit_cnt=0; for (i=0; i<length_of_RS; i++) { read next element sp of RS; search for i such that TLB.SP[i]==sp; if (no such i exists) //TLB miss find i such that TLB.LRU[i] is max; TLB.SP[i]=sp; else hit_cnt++; TLB.LRU[i]=0; for (j=0; j<length_of_TLB; j++) if (j != i) TLB.LRU[j]++; } h = hit_cnt/length_of_RS;

  9. Performance evaluations • variables to experiment with: • program locality • choose different parameters when generating RS • size n of TLB • minimum: n=0 (no TLB) • maximum: use observed h as a guide; when h approaches 1, increasing n further will not help • fixed cost overhead c of using TLB • determine and plot: • hit ratio h • effectiveness E

  10. Generating reference strings (analogous to page replacement project) • no locality: pick random number in [0..P-1] • typical behavior: • periods of stable WS • punctuated by transitions: WS grows rapidly, then settles into new stable size

  11. Generating reference strings • model typical behavior: • locus of reference  |---------|-------|------------------------------------| 0 sp sp+e P-1 • stable period: • assume constant rate in one direction (1 step every m references) • transition: • generate new locus with probability t • locus defined by sp, e, m, t

  12. Generating reference strings • Note: algorithm for generating RS is on page 498/499 (page replacement project) • for TLB project, pages are grouped into segments but we do not need to choose s and p separately; an integer sp in the range 0:P-1 represents a page

  13. Generating reference strings • algorithm to generate RS: • select P, sp, e, m, t • repeat until RS generated: • pick m random numbers in [sp..sp+e]; include in RS • generate random number 0 <= r <= 1; • if (r < t) generate new sp else increment sp (mod P)

  14. Choosing simulation constants • P: size of VM (# pages) • e: size of working set (# pages) • P and e need to be chosen together: e<P, but: • if e is too close to P, working sets overlap after transitions • if e is too small, the program will rarely revisit previous locations (important for LRU to benefit) • suggestion: e varies from 2 to P/10, P=500 or 1000 • sp random number within [0..P-1]

  15. Choosing simulation constants • m: # of times a page is referenced • typically, m100 (see page 267, fig 8-13b) • t: length of stable period • random number in [0..1]; typically, t<0.1 (i.e., thousands of instructions are executed between transitions) • length of RS: • must be large to make behavior statistically significant • suggestion: 100,000

  16. Summary of tasks • develop simulation program • generate representative reference strings • run simulation program: • for each type of RS, • vary TLB size n and overhead value c • record hit ratio h • compute corresponding effectiveness E • plot h and E over TLB size for different c values

More Related