- All stores go through write buffer.
- Loads read from write buffer if possible.
- Redundant stores are cancelled.
- Breaks FIFO-order of stores!
load |
r1, counter |
// counter++; |
add |
r1, r2, 1 |
|
store |
r2, counter |
|
barrier |
|
|
store |
zero, mutex |
// unlock(mutex); |
- Store to mutex can overtake store to
counter.
- Need to use memory barrier.
- Failure to do so will introduce subtle bugs:
- Changing process state after saving context.
- Initiating I/O after setting up parameter buffer.
|