Lecture 07 Flashcards

1
Q

What is virtual memory?

A

When two or more levels of memory hierarchy are made to look like one.
You get the speed of the top level, and the size of the bottom level.

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

What decade was virtual memory invented in?

A

The 1960s

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

What positive effect does virtual memory have on multi-processing?

A

Each process can be given its own virtual address space, which means a stray pointer in one process cannot harm another one.

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

When caching, what is a line?

A

A chunk that data has been divided into.

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

When caching, what are addresses split into?

A

A chunk identifier and an offset within the chunk.

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

What are the main steps involving the cache to perform when a user accesses data?

A
  • Look up the chunk identifier to see if it’s in fast memory, and where
  • If not:
    • Find or make space in the fast memory
    • Transfer the chunk from slow memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

What is ‘Spatial Locality’?

A

Memory being accessed is often near memory accessed recently.
Chunk size is often chosen to exploit this.

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

What is ‘Temporal Locality’?

A

Accesses to the same area of memory tend to be grouped in time.

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

In a Direct Mapped Cache, how many different places could a given chunk be in?

A

1.

Multiple chunks may map to the same place, however.

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

In a Fully Associative Cache, how many different places can a given chunk be in?

A

A chunk in a FAC can be placed anywhere.

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

What is the typical line length of a Fully Associative Cache?

A

4 KiB

They can, however, be much bigger.

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

What do the least significant 12 bits represent in the address of a line of a Fully Associative Cache?

A

The chunk’s offset within the line.

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

How does a Fully Associative Cache know if a chunk is in fast memory?

A

It compares a chunk’s tag and offset against a lookup table which stores everything that’s in the cache.

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

What is it called when a cache gets rid of something?

A

Evict

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

What are the three sections that a Direct Mapped Cache address is split into?
What is each section used for?

A

Offset - Length determines the length of a line
Index - Length determines the number of lines in a cache
Tag - Whatever remains

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

If a Direct mapped Cache has a 5 bit offset, how long is each line?

A

2^5 = 32B

17
Q

If a Direct Mapped Cache has a 17 bit index, how many lines are there in the cache?

A

2^17 = 131072 lines

18
Q

If a Direct Mapped Cache has a 17 bit index, 5 bit offset, and 10 bit tag, how much memory is needed for the cache?

A

2^17 * (2^5 + 10 + 1) ~= 5.4MiB

19
Q

If a Direct Mapped Cache has a X bit index, Y bit offset, and Z bit tag, what is the formula to work out the memory needed for the cache?

A

2^X * (2^Y + Z + 1)

The 1 is for the valid bit (whether the line is in use or not)

20
Q

What are the steps a Direct Mapped Cache follows when looking up an address?

A
  1. Use index to find the line in the cache
  2. If the valid bit is off, the line is not in the cache (miss)
  3. Otherwise, compare tags.
  4. If the tag is the same, then the line is in the cache (hit)
  5. Otherwise, ‘wrong’ line in cache (miss) and will need to be replaced by the ‘correct’ line (evict)
21
Q

What makes a Direct Mapped Cache wasteful?

A

Two lines with the same index can compete for the same line in the cache, while there’s lots of free space elsewhere in the cache.

22
Q

Does Direct Mapped Caching make a choice about whether or not to evict a line?

A

No.

The older line is always replaced by the newer one.

23
Q

In a 4-way associative cache, how many lines are there per index?

A

4.

For an N-way associative cache, each index has N lines.

24
Q

In an 8-way associative cache, how many lines does it check when looking for a specific line.

A

8.

An N-way cache with look at all associated lines in an index.

25
Q

How does an Associative Cache choose which line to evict on a ‘miss’?

A

It evicts the line that was used longest ago.

26
Q

What is ‘write-through’ in terms of cache operation?

A

Whenever something in the cache is written to, it also writes to slow memory straight away.
This keeps both copies up to date.

27
Q

What is ‘write-back’ in terms of cache operation?

A

The cache does not write the data back to slow memory until a ‘later time’. This can be as long as until eviction.

28
Q

What are the 9 levels of the memory hierarchy?

A
  • Regs
  • L1 Cache
  • L2 Cache
  • L3 Cache
  • DRAM
  • Flash
  • Local DIsk
  • Network Disk
  • Cloud, Tapes
29
Q

Memory near the top of the hierarchy gets which of the following:

  • More expensive
  • Larger
  • Faster
A

More expensive and faster.

It also becomes smaller.