Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Ger Archie Di Memorie Cache

Scarica in formato pdf o txt
Scarica in formato pdf o txt
Sei sulla pagina 1di 45

!"#$"%&'%()*#+)%',%-,.

"#/)0'1)%
2#13'0+00*#)%&+45'%+5)6"#)0"#'
)7)7%898:;8988

!"#$%&'&&(")*+',-%*.-)/0")&0"%
121341211

!"#$#%&'"()'(*"*+#'$("(%$%&"

!"#$%&'()*+,-..+&/-"*)0)
-()*+,-..+%$-"*)0)120)3),%).
5'")"#$%'*+%*6'60"%)

! "#$%$ & '()*+)(,(+-$ .-& /.&-0(01 (22(3(0&0& '( 3$3+%(& $


4+-0$3*+%&-$&3$-0$ #$2+4$

! 5%$3$))&6 .- *%+7%&33& -+- &44$'$ & 0.00$ 2$ ).$ ()0%.,(+-( $ & 0.00( (
).+( '&0( 4+-0$3*+%&-$&3$-0$ 4+- 2& )0$))& *%+8&8(2(01

! 9+2.,(+-$6 .-& 7$%&%4:(& '( 3$3+%(&6 4+-)()0$ (- .- (-)($3$ '( 2(#$22( '(
3$3+%(&; 4(&)4.-+ 4&%&00$%(,,&0+ '& .-& '(#$%)& #$2+4(01 $ '(3$-)(+-$

! " *&%(01 '( 4&*&4(01; 2$ 3$3+%($ *(< #$2+4( :&--+ .- 4+)0+ *(< $2$#&0+
*$% )(-7+2+ 8(0 '( /.$22$ *(< 2$-0$

!"#$%&'&&(")*+',-%*'-)./")&/"%
Struttura fondamentale della gerarchia
5'")"#$%'*+%*6'60"%)
della memoria
Al4(&5"-*5-"-&6-((+&6)*.+07+&6+((+&8!9&
crescere della distanza dalla CPU
6)3)02)*5-&)(&5#*.#:&3+&+23-0.+&(+&
cresce anche il costo e la capacità di
5+;+5).<&6)&3-3#")77+7)#0-
memorizzazione.

La gerarchia può
consistere di più livelli, ma
in ogni istante di tempo i
dati sono copiati solamente
tra ciascuna coppia di
livelli adiacenti, per cui ci
si può concentrare su due
soli livelli.

!"#$%&'&&(")*+',-%*'-)./")&/"%
5'")"#$%'*+%*6'60"%)

! =&>3$3+%(&>(-0$%-&>&22&>?5@>A 4+)0(0.(0&>'&(>%$7()0%(>$'>A 4&%&00$%(,,&0&>


'&>&20&>#$2+4(01 $>2(3(0&0$>'(3$-)(+-(B

! =&>3$3+%(&>4$-0%&2$>A 4&%&00$%(,,&0&>'&>'(3$-)(+-(>3+20+>3&77(+%(>
'$22&>3$3+%(&>(-0$%-&>&22&>?5@;>3&>4+->0$3*(>'(>&44$))+>*(<>$2$#&0(B>C
&44$))(8(2$>(->3+'+>'(%$00+>0%&3(0$>(-'(%(,,(B>
= >-)&*)*.-3)&+..2+()&20&()?-((#&6)&3-3#")-&5+5@-&A&*.+.#&)0*-").#&."+&8!9&-&
3-3#")-&5-0."+()&

! =$>3$3+%($>)$4+-'&%($>)+-+>&'>&20&>4&*&4(01;>8&))(>4+)0(>$>-+->#+2&0(2(>

!"#$%&'&&(")*+',-%*'-)./")&/"%
7"%8#%9%0*+%*-0#)-%&:

! "# $%&'%())(* +# ,# -.%/& +0/(#/. 1+ /.)$&* (--.1. 0&2/(#/& ( ,#(


$&%3+&#. %.2(/+4().#/. $+--&2( 1.2 0,& 0$(3+& 1+ +#1+%+33().#/&

! 5($$%.0.#/( 2( 6(0. 1.2 -&)$&%/().#/& 1.+ $%&'%())+ +# ,#


-(2-&2(/&%.

! 7,. /+$+ 1+ 2&-(2+/89


! "#$%&'()#* +,(-.& /0 1( '01#'0$#-2& ( ,- #)#$#-2& 345 )( 2#-.#-6( ( 1('#
'01#'0$#-2& ())& /2#//& #)#$#-2& .&%& %&3& 2#$%&
! 7%(60()#* +,(-.& /0 1( '01#'0$#-2& ( ,- #)#$#-2& 345 )( 2#-.#-6( ( 1('#
'01#'0$#-2& %&3& .&%& (. ()2'0 #)#$#-20 38# 8(--& )40-.0'066& 9030-& (. #//&

! : $%&'%())+ ;<; 4.1&#& 2( '.%(%-=+( )( %.>.%.#3+(#& + 1(/+ -&).


0. >&00.%& 0.)$%. +# ).)&%+( -.#/%(2.

!"#$%&'&&(")*+',-%*'-)./")&/"%
!"#$#%&'$ )'(*"*+#'$ "(,#'-%','+()'(.+%$.'/0

! D2>*%(-4(*(+>'(>2+4&2(01>#($-$>)E%.00&0+>)0%.00.%&-'+>2&>3$3+%(&>(->3+'+>
7$%&%4:(4+>

! F$2+4(01
< ='>%?%@+5"1+A%B'>%?%@'1',)%)5%B#"1+$$"#+A%B'>%?%1"$0"$)

! G(3$-)(+-$
< ='>%?%4#),&+A%B'>%?%5",0),)%&)5%B#"1+$$"#+A%/+,"%1"$0"$)

! @->2(#$22+>'(>3$3+%(&>*(<>#(4(-+>&2>*%+4$))+%$>4+-0($-$>.->)+00+(-)($3$>
'(>'&0(>3$3+%(,,&0(>(->+7-(>2(#$22+>)+00+)0&-0$>$>0.00(>(>'&0(>)(>0%+#&-+>-$2>
2(#$22+>*(<>8&))+

!"#$%&'&&(")*+',-%*'-)./")&/"%
;'<%8%=%08% >?@

= B(#55#C()0-+D (+ ;)E ;)55#(+ F2+0.).< 6) )0$#"3+7)#0- 5@- ;2G -**-"-


;"-*-0.-C+**-0.- )0 20+ H-"+"5@)+ 6) 3-3#")+

= I). J*255-**# 0-((K+55-**#LD (K)0$#"3+7)#0- ")5@)-*.+ 6+( ;"#5-**#"- *) ."#?+ )0


20# 6-) ,(#55@) 0-( ()?-((# *2;-")#"- 6) 3-3#")+

= M)** J$+(()3-0.# 0-((K+55-**#LD )( 6+.# 0#0 A ;"-*-0.- 0-( ()?-((# )33-6)+.+3-0.-


*2;-")#"- -6 #55#""- +55-6-"- +( ()?-((# ;)2N 6)*.+0.-%

= I). "+.- J$"-F2-07+ 6) @).LD $"+7)#0- 6-H() +55-**) +((+ 3-3#")+ 0-) F2+()
(K)0$#"3+7)#0- ")5@)-*.+ A *.+.+ ."#?+.+ 0-( ()?-((# *2;-")#"- 6) 3-3#")+

= M)** "+.- J$"-F2-07+ 6) 3)**LD $"+7)#0- 6-H() +55-**) +((+ 3-3#")+ 0-) F2+()
(K)0$#"3+7)#0- ")5@)-*.+ >O> A *.+.+ ."#?+.+ 0-( ()?-((# *2;-")#"- 6) 3-3#")+ JP Q
I).R+.-L

!"#$%&'&&(")*+',-%*'-)./")&/"%
;'<%8%=%08% >??@

! H$3*+>'(>:(06>0$3*+>'(>&44$))+>&2>2(#$22+ ).*$%(+%$ '$22& 3$3+%(&


< !"/B#+,&+ ),13+ '5 0+/B"%,+1+$$)#'" )%$0)6'5'#+ $+%'5 0+/B"%&'%)11+$$"%$' #'$"5@) ',%*,%
$*11+$$" "%',%*,%.)55'/+,0"

! H$3*+>'(>3())6>(2 0$3*+>-$4$))&%(+ &>)+)0(0.(%$ .->82+44+ '$2>2(#$22+


).*$%(+%$ 4+->.->-.+#+>82+44+ '&2>2(#$22+ (-E$%(+%$ '$22& 7$%&%4:(&;>$>
0%&)E$%(%$ ( '&0( '(>/.$)0+ 82+44+ &2>*%+4$))+%$

! I$3(-'6>.-&>7$%&%4:(& '(>3$3+%(& *.J $))$%$ 4+3*+)0& '&>*(< 2(#$22(;>


3&>( '&0( #$-7+-+ 0%&)E$%(0( )+2+>0%& '.$>2(#$22( #(4(-(

!"#$%&'&&(")*+',-%*'-)./")&/"%
;'<%8%=%08% >???@

! "#$%&$'() *+,-+.,/,011$22+ #+234.+ 13',2&11$223 5,,,,,,


6&7$#3 .3.)4$ *+,)11$22+

! "#$%&$'() *+,7+22,/,011$22+ #+234.+ 2$'(),2&11$223 5,


6&7$#3 .3.)4$ *+,)11$22+

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)#$'

! 8)1-$9 +4 4+:$443 *$44) 7$73#+) ;$#)#1-+1) 1-$ 2+ .#3:) .#) +4


<#31$223#$ $ 4) 7$73#+) <#+'1+<)4$

! =#3:$'+$'()9 .$#7+'$ >#)'1$2$9 1)1-? @ 2+;'+>+1) ')2132.3

! A) 7$73#+) 1)1-$ $ +4 2&3 &.+4+((3 23'3 ;$'$#)47$'.$


.#)2<)#$'.+ )4 <#3;#)77).3#$ B%&+'*+ ')2132.)C

! AD)4;3#+.73 *+ 1)1-+'; 2+ E)2) 2&+ <#+'1+<+ *+ 431)4+.F 2<)(+)4$ $


.$7<3#)4$9
= M+0.)-0- ) 6+.) ")5@)-*.) "-5-0.-3-0.- S?)5)0#S +((+ 8!9 J(#5+().< .-3;#"+(-L
= M2#?- ,(#55@) 5#0.)H2) 6) 3-3#")+ 5@- 5#0.-06#0# )( 6+.# ")5@)-*.# J(#5+().<
*;+7)+(-L

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)#$'

! 7+%.-/?@($$.1
! :;30(/3,- <)&33& .#))( $#$&'0( 3&''0/%&-.# ,-(;/%#30103( )&3(60&-# -#))( 3(38#

! A,22B?C00&-+(/+4.
! =>-0 <)&33& %,? #//#'# 3&))&3(2& 0-;+,()/0(/0 )&3(60&-# .#))( 3(38#
! @#';'03#'3('# ,-;<)&33& -#))( 3(38#;5 -#3#//('0& 3#'3(')& 0-;2,22# )#;)0-## .#))(
3(38#
! A(;'03#'3( /#+,(-60()# 5 2'&%%& )#-2( BC;'03#'3( 0-;%('())#)& D/&),60&-# $&)2&;
3&/2&/(

! D./?C00&-+(/+4.
! 7&),60&-# 0-2#'$#.0(;2'( .0'#32;$(%%#.;#;1,))E;(//&30(209#
! F0(/3,- <)&33& .#))( $#$&'0( 8(;(;.0/%&/060&-# ,-;-,$#'& 10//& DCGHI;.0;
)&3(60&-0 0-;3(38#;

!"#$%&'&&(")*+',-%*'-)./")&/"%
;%"'#&*B)99%8,

!"#$%&'&&(")*+',-%*'-)./")&/"%
;%"'#&*B)99%8,

!"#$%&'&&(")*+',-%*'-)./")&/"%
C(--D )EE0#%)&%F'

!"#$%&'&&(")*+',-%*'-)./")&/"%
G'&*!EE0#%)&%F'*B)99%8,

!"#$%&'&&(")*+',-%*'-)./")&/"%
;%"'#&*B)99'+*A)#$'

! "))+4(& .-& )+2& 2+4&,(+-$ '$22& 4&4:$ & +7-( *&%+2& '$22& 3$3+%(&
'$E(-$-'+ .-& 4+%%()*+-'$-,& 0%& 2K(-'(%(,,+ (- 3$3+%(& '$22& *&%+2& $ 2&
2+4&,(+-$ -$22& 4&4:$

! 5$% 0%+#&%$ (2 82+44+ 4:$ 4+%%()*+-'$ &' .- (-'(%(,,+ '$22& 3$3+%(&


*%(-4(*&2$6
C',&'#'DD"%&+5%65"11"E%/"&*5"%C,*/+#"%&'%65"113'%,+55)%1)13+E

!"#$%&'&&(")*+',-%*'-)./")&/"%
;%"'#&*B)99'+*A)#$'

! 9$ (2 -.3$%+ '( 82+44:( -$22& 4&4:$ A .-& *+0$-,& '( L; 2& *+)(,(+-$
4+%%()*+-'$-0$ '$22& *&%+2& (- 4&4:$ A '&0& '&( 2+7LM-.3$%+ $2$3$-0(
-$22& 4&4:$N 8(0) 3$-+ )(7-(E(4&0(#( '$22K(-'(%(,,+ (- 3$3+%(& *%(-4(*&2$B

! O)$3*(+6
= >23-"# 6) -(-3-0.) 0-((+ 5+5@-D T
= B). ;-" )06)")77+"- 20+ (#5+7)#0- 6-((+ 5+5@-D (#HUJTLVW
= X06)")77# 6-((+ ;+"#(+ 6) 3-3#")+V YPPP YPYPY YYPY YPYY
= !#*)7)#0- )0 5+5@-D PYY JZL

!"#$%&'&&(")*+',-%*'-)./")&/"%
!"##$%&"'()'*+,-#+,$'($#$**$,$',.)."#$+,
),$',/+/0),
Corrispondenza tra indirizzi in
memoria e in cache
I blocchi di memoria con indirizzo
Problema: ad una posizione in
00001, 01001, 10001, 11001
cache hanno
sono gli
associate
ultimi logpiù
2 8=3 parole di
bit uguali
memoria.
→ mappati nello stesso blocco
Come è possibile sapere se il dato
presente nella cache corrisponde
effetivamente alla parola richiesta?

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)69% +'--) #)#$'

! G); B$.+1-$..)C9 13'.+$'$ +'>3#7)(+3'+ '$1$22)#+$ ) :$#+>+1)#$ 2$


&') <)#34) *$44) 1)1-$ 13##+2<3'*$ 3 7$'3 )44) <)#34) 1$#1).)

! H'*+1$9 &.+4+(().3 <$# 2$4$(+3')#$ +4 E43113 *$44) 1)1-$

! I+. *+ :)4+*+.F9 &' 1)7<3 1-$ +'*+1) 2$ +4 E43113 *+ 7$73#+)


)2231+).3 13'.+$'$ &' *).3 :)4+*3 B.#&$5>)42$C

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)69% +'--) #)#$'

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)69% +'--) #)#$'

! D 8(0 3$-+ )(7-(E(4&0(#( '$22K(-'(%(,,+ '$2 '&0+ %(4:($)0+ (-'(4&-+ 2&


*+)(,(+-$ M(-'(4$N '$2 '&0+ -$22& 4&4:$

! P))$%#&,(+-$6 *(< 82+44:( '( 3$3+%(& )+-+ '$)0(-&0( &22& )0$))&


*+)(,(+-$ -$22& 4&4:$Q ?+3$ %(4+-+)4$%$ (2 '&0+ %(4:($)0+R

! D 8(0 *(< )(7-(E(4&0(#( '$22K(-'(%(,,+ '$2 '&0+ %(4:($)0+ %&**%$)$-0&-+ (2 H&7

! O)$3*(+6

(-'(%(,,+6 SSTST UV H&76 SS D-'(4$6 TST

!"#$%&'&&(")*+',-%*'-)./")&/"%
1*H I0"+*;%"'#&*B)99'+*A)#$'

!"#$%&'&&(")*+',-%*'-)./")&/"%
.E'69%0

! D+ -&#0+1.%+ 2( 0.',.#/. 0+/,(3+&#.9


! J-.0'066& /, KH <02
! F(38# ( $(%%(2,'( .0'#22(
! A( .0$#-/0&-# .#))( 3(38# 5 .0 H! <)&3380L .&9# - <02 9#->&-& ,/(20 %#' )40-.03#
! A( .0$#-/0&-# .#) <)&33& .#))( 3(38# 5 .0 H" %('&)#L &//0( H"#$ <E2#L %#' 3,0 $
<02 9#->&-& ,/(20 %#' 0-.090.,('# ,-( %('&)( ())40-2#'-& .0 ,- <)&33&L $#-2'# H <02
%#' 0-.090.,('# ,- <E2# ())40-2#'-& .0 ,-( %('&)(

! E( 1+).#0+&#. 1.2 -()$& /(' F9 GH I J#K)KHL

! :2 #,).%& /&/(2. 1+ 6+/ -&#/.#,/+ +# ,#( -(-=. ( )($$(/,%( 1+%.//( F9

H0 M?J1+).#0+&#.N62&--& K?1+).#0+&#.N/(' K?6+/N4(2+1+/8L

H0 M?JH1 M?GH?K?JGHIJ#K)KHLL?K?OL

!"#$%&'&&(")*+',-%*'-)./")&/"%
B)99)&(")*+%*(8*%8+%"%==0

! 83'2+*$#+)73 3#) &') 1)1-$ 13' JK E4311-+ *+ LJ EM.$


1+)21&'3N AD+'*+#+((3 LOPP B+' EM.$C <&Q $22$#$ #+1):).3 137$9

J)06)")77#&6-(&,(#55#L&3#62(#&J023-"#&6)&,(#55@)&0-((+&5+5@-L

1200 22
= 75 𝑚𝑜𝑑 64
16

𝐼𝑛𝑑𝑖𝑟𝑖𝑧𝑧𝑜 𝑑𝑒𝑙 𝑑𝑎𝑡𝑜 𝑖𝑛 𝑏𝑦𝑡𝑒


𝑖𝑛𝑑𝑖𝑟𝑖𝑧𝑧𝑜 𝑑𝑒𝑙 𝑏𝑙𝑜𝑐𝑐𝑜 = = 75
𝐵𝑦𝑡𝑒 𝑝𝑒𝑟 𝑏𝑙𝑜𝑐𝑐𝑜

!"#$%&'&&(")*+',-%*'-)./")&/"%
;%6'8E%08'*+'-*/-0##0*+%*#)#$'

! =&>'(3$-)(+-$>'$2>82+44+>'(>4&4:$>A>(->)0%$00&>%$2&,(+-$>4+->2&>
E%$/.$-,&>'(>3())B

!"#$%&'&&(")*+',-%*'-)./")&/"%
G#'-&)*+'--)*+%6'8E%08'*+'-*/-0##0*

! R'D)7<+),*+7$'2+3'$,<$#,+4,E43113,<$#7$..$,*+,2>#&..)#$,4),
431)4+.F,2<)(+)4$S,T09,
= ,(#55@)&6)&H"#**+&6)3-0*)#0-&5#3;#".+0#&3+HH)#")&3)**&;-0+(.[\D&
< ? ,+1+$$)#'"%B'>%0+/B"%B+#%0#)$.+#'#+%'5%65"11"%
= *-&(+&6)3-0*)#0-&6-(&,(#55#&A ."#;;#&H"#**+&")*;-..#&+((+&6)3-0*)#0-&6-((+&
5+5@-:&)(&3)**&"+.-&+23-0.+&
< -5%,*/+#"%&'%65"113'%,+55)%1)13+%? ',$*..'1'+,0+%

\&MX]]&!'>4^_`&V&6)$$-"-07+&."+&)(&.-3;#&6)&+55-**#&+(&()?-((#&)0$-")#"-&-&)(&.-3;#&6)&
+55-**#&+((+&5+5@-

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)#$'*E'&4)EE0#%)&%F'

! H,E4311-+,)<<)#.$'$'.+,)44),1)1-$,23'3,#);;#&<<).+,+',2$.,

! +',&'),1)1-$,2$.,)2231+).+:$,)*,6 :+$,B6UV)M,2$.,)2231+).+:$C,
3;'+,2$.,#);;#&<<),6 E4311-+,

! 3;'+,+'*+#+((3,*+,7$73#+),13##+2<3'*$,)*,&',&'+13,2$.,*$44),
1)1-$,B)11$223,*+#$..3,.#)7+.$,+'*+1$C,$,<&3W,$22$#$,32<+.).3,+',
&',E43113,%&)4&'%&$,)<<)#.$'$'.$,),%&$4,2$.,

! 2.)E+4+.3,+4,2$.S,<$#,*$.$#7+')#$,2$,&',1$#.3,+'*+#+((3,X <#$2$'.$,
+',&',E43113,*$4,2$.,X '$1$22)#+3,13'>#3'.)#$,+',<)#)44$43,+,.); *+,
.&..+,+,E4311-+,

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)#$'*J4K)D*G'&*!EE0#%)&%F'*
Cache set-associativa a 4 vie
L’implementazione richiede tag indice offset
– 4 comparatori 31 30 12 11 10 9 8 3210

– 1 multiplexer 4-to-1 22 8

Tramite l’indice Index


0
V Tag Data V Tag Data V Tag Data V Tag Data

viene selezionato 1
2
uno dei 256 set 253
254
I 4 tag nel set 255
22 32
sono confrontati in
parallelo
Il blocco viene
selezionato sulla
base del risultato
4-to-1 multiplexor
dei confronti
Hit Data

- Valeria Cardellini, A.A. 2007/08 41

!"#$%&'&&(")*+',-%*'-)./")&/"%
GF)8&),,%*+'--)*#)#$'*E'&*)EE0#%)&%F'*

! 8)1-$,6UV)M,2$.,)2231+).+:$,),13'>#3'.3,13',1)1-$,)*,)11$223,
*+#$..39,
= > 5#3;+"+.#")&)0?-5-&6)&P&
= 2(.-")#"-&").+"6#&$#"0).#&6+(&32(.);(-a-"&
= )(&,(#55#&A 6)*;#0),)(-&6#;#&(+&6-5)*)#0-&I).CM)**&-&(+&*-(-7)#0-&6-(&*-.&

! H',&'),1)1-$,)*,)11$223,*+#$..3S,+4,E43113,X *+2<3'+E+4$,<#+7),
*$44),*$1+2+3'$,Y+.5T+22,

!"#$%&'&&(")*+',-%*'-)./")&/"%
A08<"08&0*&")*-'*&'#8%#$'*+%*%8+%"%==)6'8&0*
Confronto tra le tecniche di indirizzamento
Set associative:
Direct mapped: il blocco 12 può
Fully associative:
il blocco 12 può essere essere disposto
il blocco 12 può
disposto solo sul blocco ovunque nel set 0
essere disposto
4 (12 mod 8) (12 mod 4)
ovunque
Blocco 01234567 01234567
Blocco 0 1 2 3 4 5 6 7 Blocco

Set Set Set Set


0 1 2 3
ricerca
ricerca

ricerca

Memoria di livello inferiore

Blocco 00000000001111111111222222222233
01234567890123456789012345678901
F. Tortorella © 2007
Calcolatori Elettronici II
Università degli Studi
Cache - 21 di Cassino

!"#$%&'&&(")*+',-%*'-)./")&/"%
;%6'8E%08'*+'-*&), '*)EE0#%)&%F%&:
Dimensione del tag e associatività
• Aumentando il grado di associatività
– Aumenta il numero dei comparatori ed il numero di bit per il tag
• Esempio
– Cache con 4K blocchi, blocco di 4 parole, indirizzo a 32 bit
– r = log2(4*4)=4 → n-r = (32-4) = 28 bit per tag e indice
– Cache ad indirizzamento diretto
• s = log2(4K) = 12
• Bit di tag totali = (28-12)*4K = 64K
– Cache set-associativa a 2 vie
• s = log2(4K/2) = 11
• Bit di tag totali = (28-11)*2*2K = 68K
– Cache set-associativa a 4 vie
• s = log2(4K/4) = 10
• Bit di tag totali = (28-10)*4*1K = 72K
– Cache completamente associativa
• s=0
• Bit di tag totali = 28*4K*1 = 112K
AAC - Valeria Cardellini, A.A. 2007/08 42

!"#$%&'&&(")*+',-%*'-)./")&/"%
?8#"'6'8&0*+'--L)EE0#%)&%F%&:

! =#+'1+<)4$,:)'.);;+3,
= b)3)027)#0-&6-(&3)**&"+.-&

! =#+'1+<)4+,2:)'.);;+
= M+HH)#"&5#*.#&)3;(-3-0.+.)?#
= X05"-3-0.#&6-((K@).&.)3-&

! A),21$4.),.#),1)1-$,)*,+'*+#+(()7$'.3,*+#$..3S,2$.U )2231+).+:),$,
137<4$.)7$'.$,)2231+).+:),*+<$'*$,*)4,132.3,*$44D)2231+).+:+.F,
#+2<$..3,)44),#+*&(+3'$,*$4,7+22,#).$,

!"#$%&'&&(")*+',-%*'-)./")&/"%
5'E&%08'*+'--)*#)#$'

4 decisioni da
prendere
CPU CACHE MEM

1. Dove posizionare un blocco ?


Tecnica di indirizzamento
2. Come reperire un blocco ?

3. Quale blocco sostituire


in corrispondenza di un miss ? Algoritmo di sostituzione

4. Come gestire un’operazione


di scrittura ? Strategia di aggiornamento

F. Tortorella © 2007
Calcolatori Elettronici II
Università degli Studi
Cache - 2
!"#$%&'&&(")*+',-%*'-)./")&/"% di Cassino
!-,0"%&6%*9'"*-)*E0E&%&(=%08'*+%*/-0##$%

! 6$44),1)1-$,)*,)11$223,*+#$..39,2$,+4,E43113,*+,7$73#+),X
7)<<).3,+',&'),4+'$),*+,1)1-$,;+)W,311&<).),B13'>4+1. 7+22CS,2+,
$4+7+'),+4,13'.$'&.3,<#$1$*$'.$,*$44),4+'$),$,2+,#+7<+)((),13',+4,
'&3:3,E43113,

! Z&)4$,E43113,232.+.&+#$,+',1)23,*+,B1)<)1+.MC,7+22,'$44$,1)1-$,
2$.U 3,>&44MU )2231+).+:$[
= X0&5+*#&6)&5+5@-&5#3;(-.+3-0.-&+**#5)+.)?+D&#H0)&,(#55#&A 20&;#.-07)+(-&
5+06)6+.#&;-"&(+&*#*.).27)#0-&
= X0&5+*#&6)&5+5@-&*-.c+**#5)+.)?+&+&> ?)-D&,)*#H0+&*5-H()-"-&."+&H()&> ,(#55@)&
6-(&*-.&

!"#$%&'&&(")*+',-%*'-)./")&/"%
!-,0"%&6%*9'"*-)*E0E&%&(=%08'*+%*/-0##$%

! =34+.+1),*+,232.+.&(+3'$,\)'*37 Q ]5-(.+&5+*2+(-&

! =34+.+1),*+,232.+.&(+3'$,A$)2. \$1$'.4M R2$* BA\RC,


= ]$"2..+06#&(+&(#5+().+N&.-3;#"+(-:&)(&,(#55#&*#*.).2).#&A F2-((#&5@-&0#0&*)&
2.)()77+&6+&;)2N&.-3;#&
= 46&#H0)&,(#55#&*)&+**#5)+&20&5#0.+.#"-&+((K)06)-."#:&5@-&?)-0-&;#".+.#&+(&
?+(#"-&3+**)3#&)0&5+*#&6)&+55-**#&-&6-5"-3-0.+.#&6)&P&#H0)&?#(.+&5@-&*)&
+55-6-&+6&20&+(."#&,(#55#&

! =34+.+1),*+,232.+.&(+3'$,"+#2.,H',"+#2.,]&.,B"H"]C,
= ])&+;;"#**)3+&(+&*."+.-H)+&^R9&*-(-7)#0+06#&)(&,(#55#&;)2N&?-55@)#&+07)5@-d&
F2-((#&0#0&2*+.#&6+&;)2N&.-3;#&

!"#$%&'&&(")*+',-%*'-)./")&/"%
5'E&%08'*+'--)*#)#$'

4 decisioni da
prendere
CPU CACHE MEM

1. Dove posizionare un blocco ?


Tecnica di indirizzamento
2. Come reperire un blocco ?

3. Quale blocco sostituire


in corrispondenza di un miss ? Algoritmo di sostituzione

4. Come gestire un’operazione


di scrittura ? Strategia di aggiornamento

F. Tortorella © 2007
Calcolatori Elettronici II
Università degli Studi
Cache - 2
!"#$%&'&&(")*+',-%*'-)./")&/"% di Cassino
5'E&%08'*+'%*6%EE*%8*-'&&(")*

! ^$,&',E43113,'3',X <#$2$'.$,'$44),1)1-$,E+23;'),7$..$#$,+',
2.)443,4D+'.$#),8=R

! H',;$'$#)4$,)4,:$#+>+1)#2+,*+,&',7+22,'$44),1)1-$,*$44$,+2.#&(+3'+,
23'3,'$1$22)#+,+,2$;&$'.+,<)22+9,
P% X0?)+"-&!8&Q Z&J2*5).+&6-((+&4^9L&+((+&3-3#")+&
U% ^-..2"+&6+((+&3-3#")+&
W% ]5")..2"+&0-((+&5+5@-&J6+.#:&.+H -&,).&6)&?+()6).<L&
Z% R)+??)+"-&(K-*-527)#0-&6-((K)*."27)#0-&5@-&@+&5+2*+.#&)(&3)**%&

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)#$'*4 !##'EE0*%8*E#"%&&(")*

! 94%(#$%$ .- '&0+ -$22& 4&4:$ )(7-(E(4& 4%$&%$ .-K(-4+$%$-,&; )$ -+- )(


&77(+%-&-+ ( 2(#$22( (-E$%(+%( '$22& 7$%&%4:(& '( 3$3+%($B
! H&2$ &77(+%-&3$-0+ %(4:($'$ 2+ )0&22+ '$22& ?5@B

! G.$ 0$4-(4:$ %()+2.0(#$6


< F#'0+;03#"*43G
< F#'0+;6)1H
< I0'5'DD" &' *, J#'0+ 6*..+#

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)#$'M*I"%&'4&$"0(,$

! W%(0$U0:%+.7:6 ( '&0( )+-+ )4%(00( -$2 82+44+ '$22& 4&4:$ $ -$2 82+44+ '$2
2(#$22+ (-E$%(+%$B

! F&-0&77(
= 'K (+ *#(27)#0- ;)E *-3;()5- 6+ )3;(-3-0.+"-
= ]) 3+0.)-0- (+ 5#-"-07+ 6-((- )0$#"3+7)#0) 0-((+ H-"+"5@)+ 6) 3-3#")-

! 9#&-0&77(
= ^- #;-"+7)#0) 6) *5")..2"+ ?-0H#0# -$$-..2+.- +((+ ?-(#5).< 6-((+ 3-3#")+ 6)
()?-((# )0$-")#"- e 6)3)02)*5#0# (- ;"-*.+7)#0)
= 423-0.+ )( ."+$$)5# *2( ,2* 6) *)*.-3+

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)#$'M*I"%&'4/)#N

! W%(0$U8&4X M+ 4+*YU8&4XN6 ( '&0( )+-+ )4%(00( )+2+ -$2 82+44+ '$22& 4&4:$B
D2 82+44+ 3+'(E(4&0+ #($-$ )4%(00+ -$2 2(#$22+ (-E$%(+%$ '$22& 7$%&%4:(& )+2+
/.&-'+ '$#$ $))$%$ )+)0(0.(0+B

! _)'.);;+,
= ^-&*5")..2"-&+??-0H#0#&+((+&?-(#5).< 6-((+&5+5@-&
= ]5")..2"-&*255-**)?-&*2((#&*.-**#&,(#55#&+(.-"+0#&*#(#&(+&5+5@-

! ^:)'.);;+,
= OH0)&*#*.).27)#0-&6-(&,(#55#&;2G&;"#?#5+"-&20&."+*$-")3-0.#&)0&3-3#")+

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)#$'M*K"%&'4&$"0(,$ #08*K"%&' /(<<'"*

! W%(0$>8.EE$% (-0$%*+)0+>0%&>2&>4&4:$>$>2&>3$3+%(&>'(>2(#$22+>(-E$%(+%$>
= X(&;"#5-**#"-&*5")?-&)&6+.)&*)+&0-((+&5+5@-&-&0-(&f").- ,2$$-"&

= X(&5#0."#((-"&6-((+&3-3#")+&*5")?-&)(&5#0.-02.#&6-(&f").- ,2$$-"&)0& 3-3#")+

! H4,V#+.$ E&>>$#,X ;$2.+.3,+',73*)4+.F,"H"],


= >23-"#&.);)5#&6)&-(-3-0.)&6-(&,2$$-"D&Z&
= '$$)5)-0.-&*-&(+&$"-F2-07+&6)&*5")..2"+&gg&PCf").- 5[5(- 6-((+&bR4M&
= 4(.")3-0.):&)(&,2$$-"&;2#N&+06+"-&)0&*+.2"+7)#0-&-6&)(&;"#5-**#"-&6-?-&
+*;-..+"-&5@-&(-&*5")..2"-&H)20H+0#&+&5#3;(-.+3-0.#&Jf").- *.+((L&

!"#$%&'&&(")*+',-%*'-)./")&/"%
A)#$'M*K"%&'4&$"0(,$ #08*K"%&' /(<<'"*

! W%(0$>8.EE$% (-0$%*+)0+>0%&>2&>4&4:$>$>2&>3$3+%(&>'(>2(#$22+>(-E$%(+%$>
Saturazione del Write Buffer
= X(&;"#5-**#"-&*5")?-&)&6+.)&*)+&0-((+&5+5@-&-&0-(&f").- ,2$$-"&

= X(&5#0."#((-"&6-((+&3-3#")+&*5")?-&)(&5#0.-02.#&6-(&f").- ,2$$-"&)0& 3-3#")+


• Nel caso in cui la frequenza di scrittura è superiore a 1 / DRAM write cycle (es.:
! H4,V#+.$ E&>>$#,X
ciclo della ;$2.+.3,+',73*)4+.F,"H"],
CPU troppo breve o troppe istruzioni di scrittura successive), il buffer
andrà in overflow qualunque sia la sua dimensione.
= >23-"#&.);)5#&6)&-(-3-0.)&6-(&,2$$-"D&Z&
• Possibili soluzioni:
=– '$$)5)-0.-&*-&(+&$"-F2-07+&6)&*5")..2"+&gg&PCf").-
modificare la modalità della cache in write back 5[5(- 6-((+&bR4M&
=– 4(.")3-0.):&)(&,2$$-"&;2#N
inserire una cache di secondo livello (L2) di tipo write back
&+06+"-&)0&*+.2"+7)#0-&-6&)(&;"#5-**#"-&6-?-&
+*;-..+"-&5@-&(-&*5")..2"-&H)20H+0#&+&5#3;(-.+3-0.#&Jf").- *.+((L&

Cache L2
Processor DRAM
Cache

Write Buffer

!"#$%&'&&(")*+',-%*'-)./")&/"%
I"%&'*6%EE

! =$ )4%(00.%$ *+))+-+ (-'.%%$ Z%(0$ 3())


! 9+2.,(+-( *+))(8(2(6
= h").- +((#5+.-D )( ,(#55# ?)-0- 5+")5+.# )0 5+5@- - *) -$$-..2+ (+ *5")..2"+
= >#cf").- +((#5+.-D )( ,(#55# ?)-0- *5")..# 6)"-..+3-0.- 0-((+ 3-3#")+ 6) ()?-((#
)0$-")#"-: *-07+ -**-"- ."+*$-").# )0 5+5@-

!"#$%&'&&(")*+',-%*'-)./")&/"%
OEE'"F)=%08'*>?@

! @-& 4&4:$ 4+- 82+44:( '( '(3$-)(+-( 3&77(+%( )E%.00&-+ 3&77(+%3$-0$


2& 2+4&2(01 )*&,(&2$ '(3(-.$-'+ 2& E%$/.$-,& '( 3())

! =& E%$/.$-,& '( 3()) 0+%-& & 4%$)4$%$ )$ 2& '(3$-)(+-$ '$( 82+44:(
'(#$-0& 0%+**+ 7%&-'$ %()*$00+ &22& '(3$-)(+-$ '$22& 4&4:$

! [.(-'( ( 82+44:( #$-7+-+ )4&%(4&0( '&22& 4&4:$ *%(3& &-4+%& 4:$ 3+20(
'&0( (- $))( 4+-0$-.0( )(&-+ )0&0( .0(2(,,&0(

! [.(-'( 2& 2+4&2(01 )*&,(&2$ 0%& 2$ *&%+2$ '( .- 82+44+ '(3(-.()4$ $ (2


3(72(+%&3$-0+ 2$7&0+ &22& E%$/.$-,& '( 3()) )( %('.4$

!"#$%&'&&(")*+',-%*'-)./")&/"%
OEE'"F)=%08'*>??@

! D-+20%$;>4%$)4$>&-4:$>(2>4+)0+>'(>.-&>3())6>2&>*$-&2(01>'(>.-&>3())>A>
'$0$%3(-&0&>'&2>0$3*+>-$4$))&%(+>&>*%$2$#&%$>.->82+44+>'&2>2(#$22+>
)+00+)0&-0$>$>&>)4%(#$%2+>-$22&>4&4:$

! D2>0$3*+>*$%>*%$2$#&%$>.->82+44+>A>'&0+>'&22&>)+33&>0%&>2&>2&0$-,&>*$%>
+00$-$%$>2&>*%(3&>*&%+2&>'$2>82+44+>$>(2>0$3*+>'(>0%&)E$%(3$-0+>'$2>%$)0+>
'$2>82+44+

!"#$%&'&&(")*+',-%*'-)./")&/"%

Potrebbero piacerti anche