Previous | Next --- Slide 40 of 75
Back to Lecture Thumbnails

With write buffers, r1 or / and r2 can be 0. As was explained in the lecture, the writes to A and B will go to the respective write buffers and can be executed at any time. There is no guarantee that r1 and r2 will not be set after the write statements (1) and (3) have completed in the write buffer.


(1) and (3) are read / write to the same memory address, but their ordering can be changed, either ordering respects memory coherence.


I'm confused at how we can allow r1 = r2 = 0 because wouldn't that violate program correctness? If we allow (2) to proceed before (1), then if we have some future calculations using r1 then wouldn't that lead to an incorrect answer since r1 was never set to 1 correctly? I'm not sure how write buffers avoid this issue?


@derrick I think the idea is that --- Proc 0 is executing A = 1 and r1 = B. At this point, depending on really minor details like how fast Proc 1 is running, B could have been 0 or 1. For Proc 1, the situation is the same for A. So it seems reasonable enough that /both/ could be 0, even though this isn't possible in the sequential consistency model. This example is a bit confusing to me because this feels somewhat separated from application


I'm curious about the real world impact of using these write buffers - how long do writes usually stay in the write buffer for? Are there performance impacts of doing this?

Please log in to leave a comment.