ECM 1413 Cache & Virtual Memory Flashcards

1
Q

Temporal Locality

A

Items accessed recently are likely to be accessed again soon (e.g. loops)
If you want to discard data, start with the one that has not been requested in a long time

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

Spatial Locality

A

Items located near each other in memory are likely to be accessed within a short period of time (Most programs exhibit spatial locality)
Copy additional nearby memory locations into the cache

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

A memory request may be a

A
  • Cache hit - the cache contains the data (faster data return)
  • Cache miss - the cache does not contain the requested data - first read from memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Cache designs

A
  • Direct Mapping
  • Fully-associative Mapping
  • Set-associative Mapping
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Direct-Mapped Cache

A

Each block of main memory maps to one unique cache line
+Simple, easy to implement & search
-Inefficient use of the cache space

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

Fully-Associative Cache

A

Each block of main memory can map to any line of the cache
Replacement Algorithm: LRU
+Flexible
-Takes a long time to search

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

S-Way Set-Associative Cache

A

The cache is divided into N cache sets
Each cache set consists of S lines
Each block of main memory maps to one unique cache set
Replacement algorithm: LRU

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

A write request may be a:

A
  • Write hit - the address we want to write to is present in the cache
  • Write miss - the address we want to write to is not present in the cache
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

For a write hit, there are two options:

A

Write-back
Write-through

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

Write-back:

A

initially write only to cache
Write into memory if being replaced
+fast writes
-mechanism for cache coherence

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

Write-through

A

write into both cache and memory
+consistency between the cache and memory
-slow writes

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

For a write miss, there are two options:

A

Write around
Write allocate

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

Write around (no-write allocate):

A

Write into memory only
+Avoids unnecessary cache access and cache pollution
-Does not utilise temporal locality

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

Write allocate:

A

write into both cache and memory
+exploits spatial and temporal locality
-Potential unnecessary cache access and cache pollution

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

High temporal Locality indicates

A

Write-Back + Write-Allocate

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

Low Temporal Locality indicates

A

Write-Through + Write-Around

17
Q

Virtual Memory

A

Use disk storage as if it was main memory

Analogy: Main memory is the cache of the disk

18
Q

Demand Paging

A

Only load a page when there is a request for it
+More processes can be loaded into memory
-Thrashing

19
Q

Pre-paging

A

Guesses which pages will be requested and pre-load them
+Less overhead when page predictions are accurate
-Resources are wasted on loading unused pages