Caching Flashcards

1
Q

What are two kinds of cache locality?

A

spatial locality
temporal locality

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is fully associative mapping in caches?What are the advantages and disadvantages?

A

Full associative is when any block of memory can be loaded in any line in the cache.
Advantage: Most flexible, high
Disadvantage: Most expensive since all the tags need to be checked in parallel

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is direct-mapped in caches? What are the advantages and disadvantages?

A

A block in memory can only be placed in 1 particular line given by (block number % no. of lines)
Disadvantage: Least flexible
Advantage: Least expensive (need to only check 1 tag per access)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is common among blocks in a set?

A

(Block number % no. of sets) is the same. As a result, the occupy the same set and we only need to search each way within a set

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Explain the pseudo LRU replacement method.

A

There is 1 bit reserved for each way in a set. When each way is accessed, set its bit.
If all bits are in a set are 1, reset all but the last accessed
Replace a block with an unset bit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

LRU is the best cache replacement policy for _______________

A

small caches

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

LRU and random replacement are similar for __________________

A

large caches

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

List the replacement policies from best to worst for small caches? Large caches?

A

Small: LRU, FIFO, Random
Large: LRU and Random, FIFO

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What are the two types of write policies? Define each one

A
  1. Write-through: Everytime the cache is modified, send it to the lower level.
  2. Write-back: Only modify the cache and set the dirty bit. The block is written back to the lower level when replaced (only if dirty bit is set)
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the advantage of write-through cache policy?

A

Simplifies coherency

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

List one way of measuring memory performance

A

Count the number of stalls at commit

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is a “compulsory” miss?

A

The first time a block is accessed, it won’t be in the cache. It will need to be added and will always be a miss

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

What is a “capacity” miss?

A

The whole program can’t be fit into the cache so blocks are replaced and retrieved again

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What is a “conflict” miss?

A

When there is a miss because there is a finite number of blocks in a set. Otherwise wouldn’t occur in a fully associative cache

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is a “coherence” miss?

A

When blocks get invalidated because another core is writing/has written to it

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

What stages can a cache lookup be broken into in order to make a pipelined cache?

A

set select, tag search, data read, return data

17
Q

How can increasing block size lead to cache misses?

A

Large blocks can lead to conflict misses (due to lower associativity) or capacity misses (due to unused blocks in the cache).

18
Q

How does critical word first work?

A

If an address is requested, and it indexes the middle of a block, the memory burst starts from the requested word and provides the block, wrapping around to the front of the block. The result burst order could look something like 4, 5, 6, 7, 0, 1, 2, 3
The cache then reassembles the block in order

19
Q

What is early restart?

A

The requested data is passed to the processor as soon as it arrives (while the block is still filling)

20
Q
A