skip to main content
research-article

Safe optimisations for shared-memory concurrent programs

Published:04 June 2011Publication History
Skip Abstract Section

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.

References

  1. S. V. Adve and M. D. Hill. Weak ordering --- a new definition. In ISCA'90, pages 2--14, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Sarita V. Adve and Kourosh Gharachorloo. Shared memory consistency models: A tutorial. Computer, 29(12):66--76, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  4. M. Batty, S. Owens, S. Sarkar, P. Sewell, and T.Weber. Mathematizing C++ concurrency. In Proc. POPL, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. P. Becker, editor. Programming Languages --- C++. Final Committee Draft. 2010. ISO/IEC JTC1 SC22 WG21 N3092.Google ScholarGoogle Scholar
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. Gérard Boudol and Gustavo Petri. Relaxed memory models: an operational approach. In POPL '09, pages 392--403, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. S. Burckhardt, M. Musuvathi, and V. Singh. Verifying local transformations on relaxed memory models. In CC '10, pages 104--123, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. P. Cenciarelli, A. Knapp, and E. Sibilio. The Java memory model: Operationally, denotationally, axiomatically. In 16th ESOP, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. J. Gosling, B. Joy, G. Steele, and G. Bracha. Java(TM) Language Specification, The (3rd Edition) (Java Series). Addison-Wesley Professional, July 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Intel. A formal specification of Intel Itanium processor family memory ordering, 2002. Available from http://www.intel.com/design/ itanium/downloads/251429.htm.Google ScholarGoogle Scholar
  12. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  13. Leslie Lamport. Time, clocks, and the ordering of events in a distributed system. Commun. ACM, 21(7):558--565, 1978. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Doug Lea. The JSR-133 cookbook for compiler writers, 2008. http: //g.oswego.edu/dl/jmm/cookbook.html.Google ScholarGoogle Scholar
  15. Jaejin Lee, David A. Padua, and Samuel P. Midkiff. Basic compiler algorithms for parallel programs. In PPOPP, pages 1--12. ACM, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. 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 ScholarGoogle Scholar
  18. Vance Morrison. Understand the impact of low-lock techniques in multithreaded apps. MSDN Magazine, Oct 2005.Google ScholarGoogle Scholar
  19. V. Saraswat, R. Jagadeesan, M. Michael, and C. von Praun. A theory of memory models. In PPoPP '07. ACM, Mar 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. J. Ševćík. Program Transformations in Weak Memory Models. PhD thesis, University of Edinburgh, Laboratory for Foundations of Computer Science, 2008.Google ScholarGoogle Scholar
  22. 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 ScholarGoogle Scholar
  23. J. Ševćík and D. Aspinall. On validity of program transformations in the Java memory model. In ECOOP '08, pages 27--51, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  25. Sparc International. Sparc architecture manual, version 9, 2000. Available from http://developers.sun.com/solaris/articles/ sparcv9.html. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Safe optimisations for shared-memory concurrent programs

        Recommendations

        Comments

        Login options

        Check if you have access through your login credentials or your institution to get full access on this article.

        Sign in

        Full Access

        • Published in

          cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 46, Issue 6
          PLDI '11
          June 2011
          652 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/1993316
          Issue’s Table of Contents
          • cover image ACM Conferences
            PLDI '11: Proceedings of the 32nd ACM SIGPLAN Conference on Programming Language Design and Implementation
            June 2011
            668 pages
            ISBN:9781450306638
            DOI:10.1145/1993498
            • General Chair:
            • Mary Hall,
            • Program Chair:
            • David Padua

          Copyright © 2011 ACM

          Publisher

          Association for Computing Machinery

          New York, NY, United States

          Publication History

          • Published: 4 June 2011

          Check for updates

          Qualifiers

          • research-article

        PDF Format

        View or Download as a PDF file.

        PDF

        eReader

        View online with eReader.

        eReader
        About Cookies On This Site

        We use cookies to ensure that we give you the best experience on our website.

        Learn more

        Got it!