DRFx: A Simple and Efficient Memory Model for Concurrent Programming Languages
The most intuitive memory model for shared-memory multithreaded programming is Sequential Consistency (SC), but it disallows the use of many compiler and hardware optimizations thereby impacting performance. Data-Race-Free (DRF) models, such as the proposed C++0x memory model, guarantee SC execution for data-race-free programs. But these models provide no guarantee at all for racy programs, compromising the safety and debuggability of such programs. To address the safety issue, the Java memory model, which is also based on the DRF model, provides a weak semantics for racy executions. However, this semantics is subtle and complex, making it difficult for programmers to reason about their programs and for compiler writers to ensure the correctness of compiler optimizations.