L5 & L6 & L7 Flashcards
What is the simple (inefficient) solution to the cache coherency problem in multiprocessors?
Read/write to main memory but this negates the use of the cache
What are the 3 states for a cache line using the MSI protocol?
A cache has 2 control bits for each line:
Modified state: cache line is valid but memory does not have the updated values
Invalid: the data is not valid and must be fetched from memory
Shared: not invalid and not modified
What are the possible states for a dual-core CPU using the MSI protocol?
Modified invalid
Invalid invalid
Invalid shared
Shared shared
Why is there no modified shared state? and no modified modified state?
because the second core cannot share the out of sync version
because only one core can be modified
What are the state transitions for the Modified/Invalid state?
- Read on core 1: cache hit
- Write on core 1: cache hit
- Read on core 2: changes to Shared/Shared
- Write on core 2: changes to Invalid/Modified
What are the state transitions for the Invalid/Invalid state?
- Read on core 1: fetches from memory, changes to Shared/Invalid
- Write on core 1: Fetches from memory, changes to Modified/Invalid
- Read on core 2: fetches from memory, changes to Invalid/Shared
- Write on core 2: Fetches from memory, changes to Invalid/Modified
What are the state transitions for the Invalid/Shared state?
- Read on core 1: 2 sends value to 1, changes to Shared/Shared
- Write on core 1: changes to Modified/Invalid
- Read on core 2: cache hit
- Write on core 2: changes to Invalid/Modified
What are the state transitions for the Shared/Shared state?
- Read on core 1: cache hit
- Write on core 1: changes to Modified/Invalid
- Read on core 2: cache hit
- Write on core 2: changes to Invalid/Modified
What are the 2 types of snooping protocols? Which is the more widespread protocol?
Write-invalidate: when a core updates a cache line, other copies of that line in other caches are invalidated
Write-update: when a core updates a cache line, other copies of that line are updated
Write-invalidate is more widespread because write-update leads to higher bus traffic
What are the two types of the Shared state? Why was this split made?
E: exclusive
Switch to E after a read causing a fetch from memory
S: shared
Switch to S after a read from another cache
This is done to distinguish when an invalidate request is necessary.
What is the Modified state split into?
Modified: not in sync with memory
Owned: not in sync with memory, other valid copies in S
Shared bus coherence does not scale well. What is a solution?
Directory centralising cache line information
What does each directory entry in directory-based coherence have?
Present bitmap
Dirty bit (only one owner)
Can the directory dirty bit be unset but the local dirty bit set?
No, because local dirty bit unset means the line is shared and there cannot be a unique owner.
Is using a central directory for directory based coherence optimal?
No, central directory is a serious bottleneck. A solution is to distribute directory and cache it.