Cache Coherence Flashcards

1
Q

What are the states and their bits in MSI protocol?

A

M: Modified. Valid==1, Dirty==1.
S: Shared. Valid==1, Dirty==0.
I: Invalid. Valid==0, Dirty==anything.

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

What are the state transitions of I in the MSI protocol?

A

INVALID (I)
- This is the state of a block that is invalid or not in the cache.
- On local read: Put read request on the bus, get the data, then put block in S state. Data could come from memory OR another cache that has block in M state.
- On local write: Suffer a write miss, put write request on the bus (to get the block and invalidate other cores), and move to M.
- Snoop read on bus: Stay in I.
- Snoop write on bus: Stay in I.

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

What is “local” about “local read” and “local write”?

A

“Local” refers to the core. Local read as opposed to snooping another core’s read on the bus.

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

What are the state transitions of M in the MSI protocol?

A

MODIFIED (M)
- This is the state of a cache line (or block?) that is valid and dirty.
- On local read: Stay in M. Put nothing on the bus.
- On local write: Stay in M. Put nothing on the bus.
- Snoop read on bus: Write back to memory and move to S.
- Snoop write on bus: write back to memory, move to I, and get data to the writing cache!

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

Is MSI an invalidation- or update-based protocol?

A

Invalidation

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

When a cache line is in state M and snoops a read or write on the bus, it needs to transfer its data to the reading/writing cache. What are the two ways it can get data to the reading/writing cache?

A

1) Cancel the request, write back, move to invalid, and let the writing cache get data from memory.
2) Suppress the memory response and feed data to the requesting cache.

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

What are the state transitions of S in the MSI protocol?

A

SHARED (S)
- This is the state of a cache line (or block?) that is valid and clean.
- On local read: Stay in S. Put nothing on the bus.
- On local write: No write miss and no need to put write request on the bus (because we already have the block)! Instead, we put an invalidation on the bus, then move to M.
- Snoop write on bus: Move to I.
- Snoop read on bus: Stay in S. This is what S is for!

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

What does it mean that the dirty bit is 1 in the M state?

A

It means that we always need to write back to memory before leaving M.

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

What are the four actions that lead to state transitions in the MSI protocol?

A
  • Local read: The local core, from the perspective of a cache line, wants to read from said cache line.
  • Local write: The local core, from the perspective of a cache line, wants to write to said cache line.
  • Snoop read: The local core snoops a read request for the block in said cache line.
  • Snoop write: The local core snoops a write request for the block in said cache line.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What is the purpose of the O (Owned) state?

A

Avoiding memory writes on cache to cache transfers. Imagine two caches alternating reads and writes on the same block. Every time ownsership changes hands, we get a memory write. Not good!

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

What is the O (Owned) state responsible for?

A
  • Giving data to other caches
  • Eventually writing block to memory
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

How is the MOSI protocol different from the MSI protocol?

A

1) When M state snoops a read, it transitions to O state, not S. Memory is NOT accessed.
2) O state is like S state except that
- When it snoops a read, it provides the data.
- When O block is replaced, we write back to memory.

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

What are the access and clean/dirty properties of MOSI protocol?

A

M: Exclusive read/write access, dirty
S: Shared read access, clean
O: Shared read access, dirty
I: No read/write access, clean/dirty irrelevant

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

What is the key inefficiency of the MSI protocol?

A

Unnecessary memory accesses. We might already have a block in M state, and we’d like to send it to another cache, but we have to write back to memory before moving it.

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

What is the key inefficiency of the MOSI protocol? (this is shared with MSI)

A

Thread-private data accessed by only a single thread.

When we read then write the same block, the block will go from I state -> read miss -> S state -> send inval -> M state.

Putting the invalidation request on the bus is SLOW. Not as slow as requesting the data or going to memory, but it still requires that we wait for the invalidation process to finish.

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

Why would we ever use MSI or MOSI if we have a key inefficiency with thread-private data accessed by a single thread.

A

Because the penalty of waiting on the invalidation process is worth it when we are sharing data and need to maintain coherence.

17
Q

What is the purpose of the E (Exclusive) state?

A

To avoid the invalidation request that occurs when writing to thread-private data accessed by a single thread, while still maintaining coherence for shared data.

i.e., instead of moving from I to S, then S to M, and sending and inval, we move from I to E, then E to M (no inval!).

18
Q

What are the access and clean/dirty properties of the MOESI protocol?

A

M: Exclusive read/write access, dirty
S: Shared read access, clean
O: Shared read access, dirty
E: Exclusive read/write access, clean
I: No read/write access, clean/dirty irrelevant