Caches Flashcards

1
Q

Ideal memory properties

A
  • large
  • fast
  • nonvolatile
  • cheap
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Types of cache misses

A
  1. Compulsory: data was never in the cache before
  2. Capacity: can’t fit all data in the cache
  3. Conflict: there is enough space, but structure doesn’t allow it to be used; collision, interference
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Write and Replacement Policies
Cache hit
Cache miss

A

Cache Hit:
=> Write-through: main memory is always up to date, writes may be slow
=> Write-back: Data is written only to the cache, main memory is temporarily inconsistent
Cache Miss:
=>Write-allocate: To-be-written data item is read from main memory into the cache, write performed afterwards according to the write policy
=> Write-to-memory: Modification is performed only in main memory

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

Fully associative cache

A
  • cache lines with fixed length
  • data identified by tag-field
  • memory access: searching all tags for address tag
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Direct mapped cache

A
  • cache lines with fixed length
  • mapping from address to cache lines
  • data identified by tag field
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Cache design parameters

A
  • size and set size
  • line length
  • write policy
  • replacement policy
  • using virtual or physical addresses for tagging/indexing
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Ambiguity Problem

A

Identical virtual addresses point to different physical addresses at different points in time

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

Alias Problem

A

Different virtual addresses point to the same physical memory location

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

What is a memory hierarchy and how does it provide fast access and large capacity?

A
  • Trade-off between speed and capacity when manufacturing
  • In a memory hierarchy multiple levels of gradually faster types of physical memory are installed in front of each other, with the fastest and smallest memory being closest.
  • The goal is to create an illusion of both fast and large memory
  • Migrate data from slower to faster memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Temporal vs spatial locality (definitions)

A

Temporal: data that have been accessed recently are likely to be accessed again
Spatial: Memory cells that are accessed within a short period of time are close together

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

Cache memory is divided into cache blocks. Why is it necessary?

A
  • Each cache is divided into sets of cache lines
  • Each set is used to cache specific parts of the main memory
  • Size of cache block is determined by maximal data that can be transferred between cache and the lower memory level
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Write-through vs write-back

A

Write-through: any update to a given memory location isn’t only applied to the cache, but also to main memory.
=> Main memory content is always up-to-date

Write-back: only cache is updated when data is modified. only when data is evicted from the cache, it is written back to the main memory.

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

How can we handle writes if the data is not in the cache?

A

Write-allocate: Data is first brought into the cache, then either write-through or write-back

Write-to-memory: Data is directly written to the main memory, without caching it first

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

What problems can arise with virtually-indexed virtually-tagged caches?

A
  1. Ambiguity: Same virtual address but different address spaces and therefore different physical addresses and values
    => invalidate cache on context switch
  2. Aliasing: Different virtual addresses, same address space, same physical location, results in cache incoherence.
    => disallow mapping both addresses at the same time or disallow caching for shared segments
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

To what degree do virtually-indexed physically-tagged caches solve these issues?

A

+Ambiguity: tags are different for processes
- Aliasing: two virtual addresses can still result in different cache sets being used

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

What kinds of cache-misses are there? What can be done to reduce their
number?

A

Compulsory: data has never been used before
+ prefetching
+ in VIVT, reducing the number of context switches

Capacity: there isn’t enough space in the cache
+ larger cache
+ reduction of the working set

Conflict: there isn’t enough space in the designated cache set.
+ page coloring
+ increase cache associativity