Beautiful Proof - Data-Race-Free Implies Sequential Consistency
刘未鹏(pongba)
C++的罗浮宫(http://blog.youkuaiyun.com/pongba)
Disclaimer: You should first (but not the least) understand the fundamentals of multithreading memory models to be able to read the following text. I personally recommend you start with the related C++0x memory model proposals if you’re a C++ programmer, or the java memory model if you’re a java programmer. That being said, the principles behind the proof apply to all kinds of the so-called data-race-free models.
If it happens that you’ve been slogging through all the glories proposals of C++0x memory model, and found yourself tripped up by the proof in question. Then you’ll find this post useful. Otherwise I suggest you at least read this paper before going on.
I do assume that you have a sufficient understanding of the fact that multithreading is becoming, if not has already become, the next big event and general skill in the programming field. There’re flames all over the places. And since C++ is one of my favorite programming languages, and, unfortunately one that has not included a multithreading memory model of some sort (well, not until C++0x is published), I kept tracking of all the progress that has been made with respect to it. It turns out that multithreading is this extremely tricky yet interesting business.
OK, enough said, let’s get down to business. Just one last thing though, I only write this post to explain the proof informally, so this is not going to be like an “Introduction to C++0x memory model” post (although I do have the plan to write one of those, just so long as there’s enough time), instead, I’ll go without any further preamble. For those of you who’re not familiar with the upcoming, brand-new C++0x memory model, and do consider yourself a C++ programmer (or, you know, a programmer in general), I strongly suggest you start now.