Multicore & Synchronization
Two cores each hold a copy of variable x in their own caches. After core 0 writes x, what problem could occur when core 1 reads x if there were no cache coherence mechanism?
- ACore 1 reads the stale value left in its own cache
- BCore 1's read is always faster than core 0's write
- Cx is read as double its value
Show answer and explanation
Answer: A. Core 1 reads the stale value left in its own cache
In a multicore CPU, each core's cache can hold a copy of the same address. If core 0 updates x only in its own cache, core 1's cache keeps the old value and core 1 reads it. A cache coherence mechanism, for example by invalidating other cores' copies on a write, ensures that every core sees the latest value.
- A. Correct. The copies fall out of sync.
- B. It is a question of correctness, not speed.
- C. Values do not change by themselves.