Memory Consistency Flashcards
What is memory consistency?
Memory consistency defines the order of access to different addresses.
When do memory consistency issues happen?
When the processor reorders instructions and interleaved instructions from different cores can result in an output that is not possible if executed in program order
What is sequential consistency?
The result of any execution should be as if accesses executed by each processor were executed in-order and accesses among different processors were arbitrarily interleaved
How to implement sequential consistency
- Core can reorder loads, detects when there is a problem and fix it
- Use ROB to keep track of program order
- If there is a write to an address that we loaded out of order, then can drop all the entries in the ROB after that load (since it hasn’t been committed yet)
- Must snoop traffic on bus for any writes to an address that we loaded out of order
- Only way to get memory inconsistency is to have a write to an address that we loaded out of order
What is relaxed consistency?
Class of consistency that is more relaxed than sequential, but better than nothing.
What are the 4 types of ordering?
WR A -> WR B
WR A -> RD B
RD A -> WR B
RD A -> RD B
What is the MSYNC instruction?
special x86 instruction that guarantees that all accesses are completed before MSYNC, and that MSYNC happens before all subsequent accesses
What is a data-race free program?
Use barriers to achieve sequential consistency, even if hardware is not using it