COM 60011
Bab #4 –Cache Memory
© 2016 Pearson Education, Inc., Hoboken, NJ. Seluruh hak cipta.
Memori Cache
Bab 4 +
Tabel 4.1
Karakteristik Sistem Memori Komputer
Lokasi Performa
Internal (misalnya register prosesor, cache,
memori utama) Waktu akses
Eksternal (misalnya disk optik, disk
T2
0 1
Fraction of accesses involving only Level 1 (Hit ratio)
Fastest Fast
Less Slow
fast
C–1
Block Length
(K Words)
(a) Cache
Block M – 1
2n – 1
Word
Length
(b) Main memory
Terima alamat
RA dari CPU
Muat utama
Menyampaikan kata RA
memory block
ke CPU
ke dalam garis singgahan
DONE
Address
buffer
System Bus
Control Control
Processor Cache
Data
buffer
Data
Processor Main
Cache memory
Data
Processor Main
Cache memory
Data
m lines
Bm–1 Lm–1
First m blocks of
cache memory
main memory
(equal to size of cache) b = length of block in bits
t = length of tag in bits
(a) Direct mapping
t b
L0
one block of
main memory
Lm–1
cache memory
(b) Associativemapping
s–r
s
W4j
w Li W(4j+1) Bj
Compare w
W(4j+2)
W(4j+3)
(hit in cache)
1 if match
0 if no match
Lm–1
0 if match
1 if no match
(miss in cache)
00 000000001111111111111000
00 000000001111111111111100
Line
Tag Data Number
16 000101100000000000000000 77777777 00 13579246 0000
16 000101100000000000000100 11235813 16 11235813 0001
FF 11223344 3FFE
16 000101101111111111111100 12345678 16 12345678 3FFF
8 bits 32 bits
FF 111111110000000000000000 16-Kline cache
FF 111111110000000000000100
FF 111111111111111111111000 11223344
FF 111111111111111111111100 24682468
Note: Memory address values are
in binary representation;
32 bits other values are in hexadecimal
16-MByte main memory
w Lj
s
W4j
W(4j+1)
Compare w Bj
W(4j+2)
W(4j+3)
(hit in cache)
1 if match
0 if no match
s
Lm–1
0 if match
1 if no match
(miss in cache)
Line
Tag Data Number
3FFFFE 11223344 0000
058CE7 FEDCBA98 0001
058CE6 000101100011001110011000
058CE7 000101100011001110011100 FEDCBA98 FEDCBA98
058CE8 000101100011001110100000
3FFFFD 33333333 3FFD
000000 13579246 3FFE
3FFFFF 24682468 3FFF
22 bits 32 bits
16 Kline Cache
Tag Word
Main Memory Address =
22 bits 2 bits
k lines
Lk–1
Cache memory - set 0
Bv–1
First v blocks of
main memory
(equal to number of sets)
B0 L0
one
set
v li nes
Bv–1 Lv–1
First v blocks of Cache memory - way 1 Cache memory - way k
main memory
(equal to number of sets)
Set 0
s–d Fk–1
Fk s+w
Bj
0 if match
1 if no match
(miss in cache)
000 000000001111111111111000
000 000000001111111111111100
32 bits
Note: Memory address values are
16 MByte Main Memory in binary representation;
other values are in hexadecimal
Hit ratio
0.6
0.5
0.4
0.3
0.2
0.1
0.0
1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1M
Cache size (bytes)
direct
2-way
4-way
8-way
16-way
0.96
0.94
0.92
0.90
L1 = 16k
Hit ratio
0.88 L1 = 8k
0.86
0.84
0.82
0.80
0.78
1k 2k 4k 8k 16k 32k 64k 128k 256k 512k 1M 2M
Gambar
e 4.17 Total Hit Ratio (L1 dan L2) for8 Kbyte and 16 Kbyte L1
© 2016 Pearson Education, Inc., Hoboken, NJ. Seluruh hak cipta.
+
Bersatu Melawan Pisahkan Cache
Telah menjadi umum untuk membagi cache: