Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

Memory Hierarchy in Computer Systems - Prof. Leona Mcmillan, Study notes of Computer Architecture and Organization

The concept of memory hierarchy in computer systems, including the trade-offs between size and speed, memory types, and techniques for increasing throughput. It also covers cache algorithms, associativity, and direct-mapped caches.

Typology: Study notes

Pre 2010

Uploaded on 03/16/2009

koofers-user-fom
koofers-user-fom 🇺🇸

10 documents

1 / 27

Toggle sidebar

Related documents


Partial preview of the text

Download Memory Hierarchy in Computer Systems - Prof. Leona Mcmillan and more Study notes Computer Architecture and Organization in PDF only on Docsity! L2 1 – M em o ry H ie ra rc hy 1 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 M e m or y H ie ra rc h y W hy a re y o u d re s s ed lik e th a t? H a llo w ee n w a s w ee ks a go ! It m a ke s m e lo o k fa s te r, d o n’ t yo u th in k? •M em o ry F la vo rs •P ri n ci p le o f Lo ca lit y •P ro gr a m T ra ce s •M em o ry H ie ra rc h ie s •A s s o ci a ti vi ty (S tu d y C h a p te r 7) L2 1 – M em o ry H ie ra rc hy 2 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 W h a t D o W e W a nt i n a M e m or y ? P C IN S T M A D D R M D A T A m in iM IP S M E M O R Y ¢ 10 m s 10 0 ’s G by te s H a rd d is k* W a nt ? $ 5 n s 10 0 ’s M by te s D R A M $$ $ 0 .2 n s 10 0 ’s K by te s S R A M $$ $$ 10 p s 10 0 0 ’s o f bi ts R eg is te r C o s t La te n cy C a p a ci ty * no n- vo la ti le A D D R D O U T A D D R D A T A R /W W r 2 G by te 0 .2 n s c he a p L2 1 – M em o ry H ie ra rc hy 5 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 Q ua nt it y v s Q ua li ty … Y o u r m em o ry s ys te m c a n b e • B IG a n d S LO W ... o r • S M A LL a n d F A S T. 10 -8 10 -3 1 10 0 .110 10 0 0 10 0 1 10 -6 D VD B ur ne r (0 .0 2 $/ G B , 1 2 0 m s ) D IS K ( 0 .0 5 $/ G B , 1 0 m S ) D R A M ( 2 5 $/ G B , 5 n s ) S R A M ( 10 0 0 $/ G B , 0 .2 n s ) A cc es s Ti m e .0 1 $/ G B W e’ ve e xp lo re d a r a ng e of d ev ic e- d es ig n tr a d e- o ff s . Is t h er e a n A R C H IT E C TU R A L s o lu ti o n to t h is D E LI M A ? 1 L2 1 – M em o ry H ie ra rc hy 6 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 M a na gi ng M e m or y v ia P ro gr a m m in g • In r ea lit y, s ys te m s a re b u ilt w it h a m ix tu re o f a ll th es e va ri o u s m em o ry t yp es • H o w d o w e m a ke t h e m o s t ef fe ct iv e u s e of e a ch m em o ry ? • W e co u ld p u s h a ll o f th es e is s u es o ff t o p ro gr a m m er s • K ee p m o s t fr eq ue nt ly u s ed v a ri a bl es a nd s ta ck in S R A M • K ee p la rg e d a ta s tr uc tu re s ( a rr a ys , l is ts , e tc ) in D R A M • K ee p b ig ge r d a ta s tr uc tu re s o n d is k (d a ta ba s es ) on D IS K • It is h a rd er t h a n y o u t h in k… d at a u s a ge e vo lv es o ve r a p ro gr a m ’s e xe cu ti o n C P U S R A M M A IN M E M L2 1 – M em o ry H ie ra rc hy 7 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 B e st o f B ot h W or ld s W h a t w e R E A LL Y w a nt : A B IG , F A S T m em o ry ! (K ee p e ve ry th in g w it h in in s ta nt a cc es s ) W e’ d li ke t o h a ve a m em o ry s ys te m t h a t • P E R F O R M S li ke 2 G B yt es o f S R A M ; b ut • C O S TS li ke 5 12 M B yt es o f s lo w m em o ry . S U R P R IS E : W e ca n ( n ea rl y) g et o u r w is h ! K E Y : U s e a h ie ra rc h y o f m em o ry t ec h n o lo gi es : C P U S R A M M A IN M E M L2 1 – M em o ry H ie ra rc hy 10 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 W or ki ng S e t ti m e a d d re s s d a ta s ta c k p ro g ra m ∆ t |S | ∆ t S is t he s et o f lo ca ti o ns a cc es s ed d ur in g ∆ ∆∆∆ t. W o rk in g s et : a s et S w hi ch c ha ng es s lo w ly w .r .t . a cc es s t im e. W o rk in g s et s iz e, |S | L2 1 – M em o ry H ie ra rc hy 11 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 E x pl oi ti ng t h e M e m or y H ie ra rc h y A p p ro a ch 1 ( C ra y, o th er s ): E xp o s e H ie ra rc h y • R eg is te rs , M a in M em o ry , D is k ea ch a va ila bl e a s s to ra ge a lt er na ti ve s ; • Te ll p ro gr a m m er s : “ U s e th em c le ve rl y” A p p ro a ch 2 : H id e H ie ra rc hy • P ro g ra m m in g m o d el : S IN G LE k in d o f m em o ry , s in gl e a d d re s s s p a ce . • M a ch in e A U TO M A TI C A LL Y a s s ig ns lo ca ti o ns t o f a s t o r s lo w m em o ry , d ep en d in g o n u s a ge p a tt er ns . C P U S R A M M A IN M E M C P U S m a ll S ta ti c D yn a m ic R A M H A R D D IS K “M A IN M E M O R Y ” L2 1 – M em o ry H ie ra rc hy 12 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 W h y W e C a re C P U S m a ll S ta ti c D yn a m ic R A M H A R D D IS K “M A IN M E M O R Y ” TR IC K # 1: H ow t o m a ke s lo w M A IN M E M O R Y a p p ea r fa s te r th a n it is . C P U p er fo rm a n ce is d o m in a te d b y m em o ry p er fo rm a n ce . M o re s ig ni fi ca nt t ha n: IS A , c ir cu it o pt im iz a ti on , p ip el in in g, s up er -s ca la r, e tc TR IC K # 2 : H ow t o m a ke a s m a ll M A IN M E M O R Y a p p ea r bi gg er t ha n it is . “V IR TU A L M E M O R Y ” “S W A P S P A C E ” Te ch ni q ue : VI R TU A L M E M O R Y – Le ct ur e a ft er t ha t “C A C H E ” Te ch ni q ue : C A C H E IN G – N ex t 2 L ec tu re s L2 1 – M em o ry H ie ra rc hy 15 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 T h e C a ch e P ri nc ip le F in d “ H a rt , L ee ” 5 -M in ut e A cc es s T im e: 5 -S ec on d A cc es s T im e: A LG O R TH IM : L o o k on y o ur d es k fo r th e re q ue s te d in fo rm a ti on f ir s t, if it s n o t th er e ch ec k s ec on d a ry s to ra ge L2 1 – M em o ry H ie ra rc hy 16 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 B a si c C a ch e A lg or it h m O N R E F E R E N C E T O M em [X ]: L o o k fo r X a m o ng c a ch e ta gs ... H IT : X = T A G (i ) , f o r s o m e ca ch e lin e i R E A D : re tu rn D A TA (i ) W R IT E : ch a ng e D A TA (i ); S ta rt W ri te t o M em (X ) M IS S : X n o t fo u n d in T A G o f a n y ca ch e lin e R E P LA C E M E N T S E LE C TI O N : S el ec t s o m e LI N E k t o h o ld M em [X ] (A llo ca ti o n ) R E A D : R ea d M em [X ] S et T A G (k )= X, D A TA (K )= M em [X ] W R IT E : S ta rt W ri te t o M em (X ) S et T A G (k )= X, D A TA (K )= n ew M em [X ] M A IN M E M O R Y C P U (1 − α ) Ta g D a ta A B M em [A ] M em [B ] “X ” h er e is a m em o ry a d d re s s . L2 1 – M em o ry H ie ra rc hy 17 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 C a ch e S it s b et w ee n C P U a nd m a in m em o ry Ve ry f a s t m em o ry t h a t s to re s T A G s a n d D A TA TA G is t h e m em o ry a d d re s s ( o r p a rt o f it ) D A TA is a c o p y of m em o ry a t th e a d d re s s g iv en b y TA G 11 10 0 8 9 7 10 3 2 1 10 4 0 17 10 0 0 4 10 4 4 1 10 4 0 2 5 10 3 6 9 7 10 3 2 9 9 10 2 8 4 4 10 2 4 3 8 10 2 0 2 9 10 16 5 10 12 11 10 0 8 2 3 10 0 4 17 10 0 0 M e m o ry T a g D a ta C a c h e L in e 0 L in e 1 L in e 2 L in e 3 L2 1 – M em o ry H ie ra rc hy 2 0 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 H ow d o w e S e a rc h t h e C a ch e T A G s? N op e, “ S m it h” N op e, “ J on es ” N op e, “ Le Vi le ” H E R E IT IS ! F in d “ H a rt , L ee ” A s s o ci a ti vi ty : Th e d eg re e o f p a ra lle lis m u s ed in th e lo o ku p o f Ta gs L2 1 – M em o ry H ie ra rc hy 2 1 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 F ul ly - A ss oc ia ti ve C a ch e TA G D a ta = ? TA G D a ta = ? TA G D a ta = ? In co m in g A d d re s s H IT D a ta O ut Th e ex tr em e in a s s o ci a ti ve ly : A ll TA G S a re s ea rc he d in p a ra lle l D a ta it em s f ro m * a ny * a d d re s s c a n be lo ca te d in *a ny * ca ch e lin e L2 1 – M em o ry H ie ra rc hy 2 2 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 D ir e ct - M a pp e d C a ch e (n on - a ss oc ia ti ve ) N O P a ra lle lis m : Lo o k in J U S T O N E p la ce , d et er m in ed b y p a ra m et er s o f in co m in g re q u es t (a d d re s s b it s ) ... c a n u s e o rd in a ry R A M a s ta bl e A F in d “ H a rt , L ee ” Y Z B H L2 1 – M em o ry H ie ra rc hy 2 5 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 D ir e ct M a pp e d C a ch e Lo w -c o s t ex tr em e: S in gl e co m p a ra to r U s e o rd in a ry ( fa s t) s ta ti c R A M f o r ca ch e ta gs & d a ta : In co m in g A d d re s s K T = ? H IT D a ta O ut D IS A D VA N TA G E : C O LL IS IO N S Q U E S TI O N : W hy n o t us e H IG H -o rd er bi ts a s t he C a ch e In d ex ? K -b it C a ch e In d ex D -b it d a ta w o rd T U p p er -a d d re s s b it s Ta g D a ta K x ( T + D )- bi t s ta ti c R A M L2 1 – M em o ry H ie ra rc hy 2 6 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 A P ro b le m w it h C ol li si on s F in d “ H ee l, A rt ” F in d “ H er e, A l T .” F in d “ H a rt , L ee ” N o p e, I’ ve g o t “H ee l” u n d er “ H ” P R O B LE M : C o nt en ti o n a m o n g H ’s ... . - C A N ’T c a ch e bo th “H a rt ” & “ H ee l” ... S u p p o s e H ’s t en d to c o m e a t o n ce ? = = > B E TT E R ID E A : F ile b y LA S T le tt er ! Y Z B H L2 1 – M em o ry H ie ra rc hy 2 7 C o m p 4 11 – F a ll 2 0 0 7 11 /1 4 /0 7 C a ch e Q ue st io ns = C a sh Q ue st io ns W h a t lie s b et w ee n F u lly A s s o ci a te a n d D ir ec t- M a p p ed ? W h en I p ut s o m et hi n g n ew in to t he c a ch e, w h a t d a ta g et s th ro w n o ut ? H o w m a ny p ro ce s s o r w o rd s s h o u ld t h er e be p er t a g? W h en I w ri te t o c a ch e, s h o u ld I a ls o w ri te t o m em o ry ? W h a t d o I d o w he n a w ri te m is s es c a ch e, s h o u ld s p a ce in ca ch e be a llo ca te d f o r th e w ri tt en a d d re s s . W h a t if I h a ve IN P U T/ O U TP U T d ev ic es lo ca te d a t ce rt a in m em o ry a d d re s s es , d o w e ca ch e th em ?
Docsity logo



Copyright © 2024 Ladybird Srl - Via Leonardo da Vinci 16, 10126, Torino, Italy - VAT 10816460017 - All rights reserved