Abstract
Current proposals for concurrent shared-memory languages, including C++ and C, provide sequential consistency only for programs without data races (the DRF guarantee). While the implications of such a contract for hardware optimisations are relatively well-understood, the correctness of compiler optimisations under the DRF guarantee is less clear, and experience with Java shows that this area is error-prone.
In this paper we give a rigorous study of optimisations that involve both reordering and elimination of memory reads and writes, covering many practically important optimisations. We first define powerful classes of transformations semantically, in a language-independent trace semantics. We prove that any composition of these transformations is sound with respect to the DRF guarantee, and moreover that they provide basic security guarantees (no thin-air reads) even for programs with data races. To give a concrete example, we apply our semantic results to a simple imperative language and prove that several syntactic transformations are safe for that language. We also discuss some surprising limitations of the DRF guarantee.
- S. V. Adve and M. D. Hill. Weak ordering --- a new definition. In ISCA'90, pages 2--14, 1990. Google Scholar
Digital Library
- Sarita V. Adve and Kourosh Gharachorloo. Shared memory consistency models: A tutorial. Computer, 29(12):66--76, 1996. Google Scholar
Digital Library
- J. Alglave, A. Fox, S. Ishtiaq, M. O. Myreen, S. Sarkar, P. Sewell, and F. Zappa Nardelli. The semantics of Power and ARM multiprocessor machine code. In Proc. DAMP 2009, January 2009. Google Scholar
Digital Library
- M. Batty, S. Owens, S. Sarkar, P. Sewell, and T.Weber. Mathematizing C++ concurrency. In Proc. POPL, 2011. Google Scholar
Digital Library
- P. Becker, editor. Programming Languages --- C++. Final Committee Draft. 2010. ISO/IEC JTC1 SC22 WG21 N3092.Google Scholar
- Hans-J. Boehm and Sarita V. Adve. Foundations of the C++ concurrency memory model. In PLDI '08, pages 68--78, New York, NY, USA, 2008. ACM. Google Scholar
Digital Library
- Gérard Boudol and Gustavo Petri. Relaxed memory models: an operational approach. In POPL '09, pages 392--403, 2009. Google Scholar
Digital Library
- S. Burckhardt, M. Musuvathi, and V. Singh. Verifying local transformations on relaxed memory models. In CC '10, pages 104--123, 2010. Google Scholar
Digital Library
- P. Cenciarelli, A. Knapp, and E. Sibilio. The Java memory model: Operationally, denotationally, axiomatically. In 16th ESOP, 2007. Google Scholar
Digital Library
- J. Gosling, B. Joy, G. Steele, and G. Bracha. Java(TM) Language Specification, The (3rd Edition) (Java Series). Addison-Wesley Professional, July 2005. Google Scholar
Digital Library
- Intel. A formal specification of Intel Itanium processor family memory ordering, 2002. Available from http://www.intel.com/design/ itanium/downloads/251429.htm.Google Scholar
- P. Joisha, R. Schreiber, P. Banerjee, H.-J. Boehm, and D. Chakrabarti. A technique for the effective and automatic reuse of classical compiler optimizations on multithreaded code. Technical Report HPL-2010-81, HP Laboratories, 2010. To appear in POPL 2011. Google Scholar
Digital Library
- Leslie Lamport. Time, clocks, and the ordering of events in a distributed system. Commun. ACM, 21(7):558--565, 1978. Google Scholar
Digital Library
- Doug Lea. The JSR-133 cookbook for compiler writers, 2008. http: //g.oswego.edu/dl/jmm/cookbook.html.Google Scholar
- Jaejin Lee, David A. Padua, and Samuel P. Midkiff. Basic compiler algorithms for parallel programs. In PPOPP, pages 1--12. ACM, 1999. Google Scholar
Digital Library
- J. Manson, W. Pugh, and S. Adve. The Java memory model. In POPL '05, pages 378--391, New York, NY, USA, 2005. ACM Press. Google Scholar
Digital Library
- Samuel P. Midkiff and David A. Padua. Issues in the optimization of parallel programs. In ICPP (2), pages 105--113. Pennsylvania State University Press, 1990.Google Scholar
- Vance Morrison. Understand the impact of low-lock techniques in multithreaded apps. MSDN Magazine, Oct 2005.Google Scholar
- V. Saraswat, R. Jagadeesan, M. Michael, and C. von Praun. A theory of memory models. In PPoPP '07. ACM, Mar 2007. Google Scholar
Digital Library
- S. Sarkar, P. Sewell, F. Zappa Nardelli, S. Owens, T. Ridge, T. Braibant, M. Myreen, and J. Alglave. The semantics of x86-CC multiprocessor machine code. In POPL'09, January 2009. Google Scholar
Digital Library
- J. Ševćík. Program Transformations in Weak Memory Models. PhD thesis, University of Edinburgh, Laboratory for Foundations of Computer Science, 2008.Google Scholar
- J. Ševćík. The Sun Hotspot JVM does not conform with the Java memory model. Technical Report EDI-INF-RR-1252, School of Informatics, University of Edinburgh, 2008.Google Scholar
- J. Ševćík and D. Aspinall. On validity of program transformations in the Java memory model. In ECOOP '08, pages 27--51, 2008. Google Scholar
Digital Library
- Dennis Shasha and Marc Snir. Efficient and correct execution of parallel programs that share memory. ACM Trans. Program. Lang. Syst., 10(2):282--312, 1988. Google Scholar
Digital Library
- Sparc International. Sparc architecture manual, version 9, 2000. Available from http://developers.sun.com/solaris/articles/ sparcv9.html. Google Scholar
Digital Library
- Z. Sura, X. Fang, C. Wong, S. Midkiff, J. Lee, and D. Padua. Compiler techniques for high performance sequentially consistent Java programs. In PPoPP '05, pages 2--13, New York, NY, USA, 2005. ACM. Google Scholar
Digital Library
Index Terms
Safe optimisations for shared-memory concurrent programs
Recommendations
Safe optimisations for shared-memory concurrent programs
PLDI '11: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and ImplementationCurrent proposals for concurrent shared-memory languages, including C++ and C, provide sequential consistency only for programs without data races (the DRF guarantee). While the implications of such a contract for hardware optimisations are relatively ...
Safe open-nested transactions through ownership
PPoPP '09Researchers in transactional memory (TM) have proposed open nesting as a methodology for increasing the concurrency of transactional programs. The idea is to ignore ``low-level'' memory operations of an open-nested transaction when detecting conflicts ...
Safe open-nested transactions through ownership
PPoPP '09: Proceedings of the 14th ACM SIGPLAN symposium on Principles and practice of parallel programmingResearchers in transactional memory (TM) have proposed open nesting as a methodology for increasing the concurrency of transactional programs. The idea is to ignore ``low-level'' memory operations of an open-nested transaction when detecting conflicts ...







Comments