Professional Documents
Culture Documents
Dr J Vaughan
1/25
Important terms
Cache
fully associative
write allocate
Virtual memory
dirty bit
unified cache
block offset
Direct mapped
write-back
block
Valid hit
data cache
locality
Block address
hit time
address trace
2/25
Write-through
Cache miss
Set
Instruction cache
Page fault
Random replacement
Average memory
access time
Miss rate
Index field
Cache hit
No-write allocate
Page
Write buffer
Miss penalty
Tag field
Write stall
3/25
Term definitions 1
Cache The first level of memory met when the address
leaves the processor. The word cache is often used to
mean buffering commonly-used items for re-use
Cache hit Success: finding a referenced item in cache
Cache miss Failure: the required item is not in the cache
Block The fixed number of bytes of main memory that is
copied to the cache in one transfer operation. This
transfer happens when a cache miss occurs
Temporal locality A referenced item is likely to be referenced again
in the near future
Spatial locality Other data in the same block as a referenced item
are likely to be needed soon
4/25
Term definitions 2
5/25
Term definitions 3
6/25
Term definitions 4
I
Miss rate
Fraction of cache accesses that miss =
Number of accesses that miss
Number of accesses
7/25
Miss rates and miss penalties are different for reads and writes
but are averaged here
Example
8/25
Solution
9/25
Solution (continued)
10/25
Total performance:
CPU execution timecache
= (IC 1.0 + IC 0.75) Clock cycle time
= 1.75 IC Clock cycle time
execution timecache
Performance ratio = CPU
CPU execution time
1.75IC Clock cycle time
= 1.0IC Clock cycle time
= 1.75
accesses
= Miss rateMemory
Instruction count
accesses
= Miss rate Memory
Instruction
Misses
Instruction
Misses
Instruction
accesses
= Miss rate Memory
Instruction
= 0.02 1.5 = 0.03
11/25
Example
Answer
I
12/25
13/25
14/25
Mapping
I
I
I
15/25
Direct mapped
2-way set associative
4-way set associative
16/25
17/25
Direct mapping
I
18/25
Only 1 block frame checked for a hit, only that block can be
replaced
Choice of which block to replace
Replacement strategies
Random
I
LRU
I
Relies on locality
FIFO
I
19/25
20/25
21/25
Read block from cache at the same time that the tag is read
and compared
Write
22/25
Write policies
Write-through
I
Write-back
I
23/25
Advantages of write-back
24/25
Advantages of write-through
25/25
Next lower level has current copy of data which simplifies data
coherence