Questions: Cache Coherence Protocols and Memory Consistency

5 questions to test your understanding

Score: 0 / 5
Question 1 Multiple Choice

Under the MESI protocol, Processor A writes a new value to a cache line currently in the Shared state (held by both A and B). What state does Processor B's copy transition to?

AShared — B's copy is automatically updated to the new value via broadcast
BInvalid — B's copy is marked unusable; B must fetch the updated value from A or memory on next access
CModified — B holds the updated copy since A's write propagated to it
DExclusive — B becomes the sole holder once A finishes writing
Question 2 Multiple Choice

Two threads each modify a different variable, X and Y, that happen to be allocated on the same 64-byte cache line. On a multi-core machine, this causes severe performance degradation. What is this phenomenon called, and why does it occur?

ATrue sharing — X and Y are logically dependent, causing serialized access
BFalse sharing — the coherence protocol treats the entire cache line as the unit of coherence, so writes to either variable invalidate the other processor's copy of the whole line
CCache thrashing — the cache is too small to hold both variables simultaneously
DDirectory overflow — the directory-based protocol cannot track two variables in the same entry
Question 3 True / False

Cache coherence and memory consistency are the same concept: both describe what value a processor reads from a shared memory location.

TTrue
FFalse
Question 4 True / False

In a directory-based coherence protocol, a processor that wants to write to a cache line must receive explicit permission from the directory, which then invalidates all other cached copies before granting the write.

TTrue
FFalse
Question 5 Short Answer

What is the difference between cache coherence and a memory consistency model, and why does a system need both?

Think about your answer, then reveal below.