Lecture 4: Shared Memory Multiprocessors, Lecture 6: MESI and MOESI Cache Coherence, Lecture 7: Directory-Based Cache Coherence Flashcards
How does the structure of multiprocessors differ for shared and distributed memory?
Shared memory: all cpus have access to the same memory
Distributed memory: each cpu has its own local memory
Whhich is more prevalent in mutliprocessors, shared or distributed memory, and why? Are there any drawbacks?
Shared memory because its easier to program. Hardware is more complex
What problem does hardware complexity of shared memory multiprocessors lead to?
bus-based cache coherence systems that do not scale well
What are caches?
Fast and small local memory holding recently used data and instruction. Can have different levels (L1, L2 (local), L3 (shared))
Main memory cannot keep up with processor speed
What are two cache functions?
- Fetch data from RAM on cache misses
- Write modified data back to RAM
What is the cache coherency problem?
Inconsistency of shared data across multiple caches in multi-core systems. Can occur when one core updates a value in its cache, leaving outdated copies in other caches.
What is the solution to the cache coherency problem?
cache to cache communication with bus snooping
for performance to avoid involving the slow memory
How does bus snooping work in maintaining cache coherency in multiprocessor systems?
Hardware attached to each core’s cache (one bus). Observes all transactions on the bus and able to modify the cache independently of the core. This hardware can take action on seeing pertinent transactions on the bus
True or false
Cache has 2 control bits for each line it contains, indicating its state
True
How many cache states are there?
Three:
1. Modified
2. Invalid
3. Shared
- Modified state
- Invalid
- Shared
A. Implicit. A valid cache entry exists and the line has the same values as main memory. Several caches can have the same line in that state
B. there may be an address match on this line but the data is not valid. We must go to memory and fetch it or get it from another cache
C. the cache line is valid and has been written to but the latest values have not been updated in memory yet. A line can be in the modified state in at most 1 core
- C
- B
- A
Which of the following states are legal?
a. modified invalid
b. modified modified
c. shared shared
d. invalid shared
e. modified shared
f. invalid invalid
a, c, d, f
What are the aspects of state transitions?
- messages
- access made to main memory
- state changes
What are the messages sent between caches?
- Read messages: 1 core request a cache line from another
- Invalidate messages: 1 core asks another to invalidate one of its cache lines
Describe the state transitions from the following state
modified invalid
Read on core 1: cache hit, served from cache
Write on core 1: cache hit, served from cache
Read on core 2: Overall change to state: shared/shared
Write on core 2: Overall state changes to (a’): invalid/modified