skip to main content
10.1145/2247684.2247688acmconferencesArticle/Chapter ViewAbstractPublication PagesmspConference Proceedingsconference-collections
research-article

Can seqlocks get along with programming language memory models?

Published:16 June 2012Publication History

ABSTRACT

Seqlocks are an important synchronization mechanism and represent a significant improvement over conventional reader-writer locks in some contexts. They avoid the need to update a synchronization variable during a reader critical section, and hence improve performance by avoiding cache coherence misses on the lock object itself. Unfortunately, they rely on speculative racing loads inside the critical section. This makes them an interesting problem case for programming-language-level memory models that emphasize data-race-free programming. We analyze a variety of implementation alternatives within the C++11 memory model, and briefly address the corresponding issue in Java. In the process, we observe that there may be a use for "read-dont-modify-write" operations, i. e. read-modify-write operations that atomically write back the original value, without modifying it, solely for the memory model consequences, and that it may be useful for compilers to optimize such operations.

References

  1. S. V. Adve and H.-J. Boehm. Memory models: A case for rethinking parallel languages and hardware. Communications of the ACM, 53(8):90--101, August 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. M. Batty, K. Memarian, S. Owens, S. Sarkar, and P. Sewell. Clarifying and compiling C/C++ concurrency: From C++11 to POWER. In POPL'12, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. M. Batty, S. Owens, S. Sarkar, P. Sewell, and T. Weber. Mathematizing C++ concurrency. In POPL'11, pages 55--66, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. H.-J. Boehm. The atomic_ops atomic operations package. http://www.hpl.hp.com/research/linux/atomic_ops/, 2005.Google ScholarGoogle Scholar
  5. H.-J. Boehm. Reordering constraints for pthread-style locks. In Proc. 12th Symp. Principles and Practice of Parallel Programming, pages 173--182, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. H.-J. Boehm. How to miscompile programs with "benign" data races. In HotPar, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. H.-J. Boehm. Performance implications of fence-based memory models. In MSPC, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. H.-J. Boehm and S. Adve. Foundations of the C++ concurrency memory model. In Proc. Conf. on Programming Language Design and Implementation, pages 68--78, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. A. Dragojevic, R. Guerraoui, and M. Kapalka. Stretching transactional memory. In PLDI, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. S. Hemminger. Fast reader/writer lock for gettimeofday 2.5.30. Linux kernel mailing list August 12, 2002, http://lwn.net/Articles/7388/.Google ScholarGoogle Scholar
  11. ISO JTC1/SC22/WG21. ISO/IEC 14882:2011, information technology --- programming languages --- C++. http://www.iso.org/iso/iso_catalogue/catalogue_tc/catalogue_detail.htm?csnumber=50372 or a close approximation at http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2012/n3376.pdf.Google ScholarGoogle Scholar
  12. C. Lameter. Effective synchronization on Linux/NUMA systems. Proceedings of the May 2005 Gelato Federation Meeting (http://www.lameter.com/gelato2005.pdf), 2005.Google ScholarGoogle Scholar
  13. L. Lamport. How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Transactions on Computers, C-28(9):690--691, 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. D. Lea. jsr166e: Class SequenceLock. http://gee.cs.oswego.edu/dl/jsr166/dist/jsr166edocs/jsr166e/SequenceLock.html, retrieved Mar. 8, 2012.Google ScholarGoogle Scholar
  15. D. Marino, A. Singh, T. Millstein, M. Musuvathi, and S. Narayanasami. A case for an sc-preserving compiler. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. P. E. McKenney. Exploiting Deferred Destruction: An Analysis of Read-Copy-Update Techniques in Operating System Kernels. PhD thesis, OGI School of Engineering at Oregon Health and Science University, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. T. Nkaike and M. Michael. Lock elision for read-only critical sections in java. In PLDI, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. J. Sevcik. Program Transformations in Weak Memory Models. PhD thesis, University of Edinburgh, 2008.Google ScholarGoogle Scholar
  19. J. Sevcik and D. Aspinall. On validity of program transformations in the java memory model. In ECOOP 2008, pages 27--51, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. J. Sevcik and P. Sewell. C/C++11 mappings to processors. http://www.cl.cam.ac.uk/~pes20/cpp/cpp0xmappings.html", retrieved Mar. 3, 2012, 2011.Google ScholarGoogle Scholar
  21. P. Sewell, S. Sarkar, S. Owens, F. Z. Nardelli, and M. O. Myreen. x86-tso: A rigorous and usable programmer's model for x86 multiprocesors. Communications of the ACM, 53(7):89--97, July 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Can seqlocks get along with programming language memory models?

      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
      • Published in

        cover image ACM Conferences
        MSPC '12: Proceedings of the 2012 ACM SIGPLAN Workshop on Memory Systems Performance and Correctness
        June 2012
        82 pages
        ISBN:9781450312196
        DOI:10.1145/2247684
        • General Chair:
        • Lixin Zhang,
        • Program Chair:
        • Onur Mutlu

        Copyright © 2012 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 16 June 2012

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate6of20submissions,30%

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader