skip to main content
research-article

Library abstraction for C/C++ concurrency

Published:23 January 2013Publication History
Skip Abstract Section

Abstract

When constructing complex concurrent systems, abstraction is vital: programmers should be able to reason about concurrent libraries in terms of abstract specifications that hide the implementation details. Relaxed memory models present substantial challenges in this respect, as libraries need not provide sequentially consistent abstractions: to avoid unnecessary synchronisation, they may allow clients to observe relaxed memory effects, and library specifications must capture these.

In this paper, we propose a criterion for sound library abstraction in the new C11 and C++11 memory model, generalising the standard sequentially consistent notion of linearizability. We prove that our criterion soundly captures all client-library interactions, both through call and return values, and through the subtle synchronisation effects arising from the memory model. To illustrate our approach, we verify implementations against specifications for the lock-free Treiber stack and a producer-consumer queue. Ours is the first approach to compositional reasoning for concurrent C11/C++11 programs.

Skip Supplemental Material Section

Supplemental Material

r1d2_talk3.mp4

mp4

183.8 MB

References

  1. M. Batty, M. Dodds, and A. Gotsman. Library abstraction for C/C++ concurrency (extended version). University of York Technical Report YCS-2012-479, 2012.Google ScholarGoogle Scholar
  2. M. Batty, S. Owens, S. Sarkar, P. Sewell, and T.Weber. Mathematizing C++ concurrency. In POPL, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. H.-J. Boehm. Can seqlocks get along with programming language memory models? In MSPC, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. H.-J. Boehm and S. V. Adve. Foundations of the C++ concurrency memory model. In PLDI, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. S. Burckhardt, A. Gotsman, M. Musuvathi, and H. Yang. Concurrent library correctness on the TSO memory model. In ESOP, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. S. Burckhardt, D. Leijen, M. Fahndrich, and M. Sagiv. Eventually consistent transactions. In ESOP, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. I. Filipović, P. O'Hearn, N. Rinetzky, and H. Yang. Abstraction for concurrent objects. In ESOP, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. I. Filipović, P. O'Hearn, N. Torp-Smith, and H. Yang. Blaiming the client: On data refinement in the presence of pointers. FAC, 22, 2010. Google ScholarGoogle ScholarCross RefCross Ref
  9. A. Gotsman and H. Yang. Liveness-preserving atomicity abstraction. In ICALP, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. A. Gotsman and H. Yang. Linearizability with ownership transfer. In CONCUR, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. M. P. Herlihy and J. M. Wing. Linearizability: a correctness condition for concurrent objects. TOPLAS, 12, 1990. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. ISO/IEC. Programming Languages -- C++, 14882:2011.Google ScholarGoogle Scholar
  13. ISO/IEC. Programming Languages -- C, 9899:2011.Google ScholarGoogle Scholar
  14. M. Kuperstein,M. T. Vechev, and E. Yahav. Partial-coherence abstractions for relaxed memory models. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. L. Lamport. How to make a multiprocessor computer that correctly executes multiprocess programs. IEEE Trans. Comp., 28, 1979. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. Manson. The Java memory model. PhD Thesis. Department of Computer Science, University of Maryland, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. M. Michael. Scalable lock-free dynamic memory allocation. In PLDI, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. M. Michael, M. T. Vechev, and V. A. Saraswat. Idempotent work stealing. In PPOPP, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. S. Owens, S. Sarkar, and P. Sewell. A better x86 memory model: x86- TSO. In TPHOLs, 2009.. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. T. Ridge. A rely-guarantee proof system for x86-TSO. In VSTTE, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. S. Sarkar, P. Sewell, J. Alglave, L. Maranget, and D.Williams. Understanding POWER multiprocessors. In PLDI, 2011. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. R. K. Treiber. Systems programming: Coping with parallelism. Technical Report RJ 5118, IBM Almaden Research Center, 1986.Google ScholarGoogle Scholar
  23. . Wehrman and J. Berdine. A proposal for weak-memory local reasoning. In LOLA, 2011.Google ScholarGoogle Scholar

Index Terms

  1. Library abstraction for C/C++ concurrency

              Recommendations

              Reviews

              Andrea F Paramithiotti

              Abstraction is a useful concept in programming, in that programmers often only need to know what a given module does without being concerned about the internals of that module. This is key to modularization, or building software applications by putting together pieces of existing code, saving time and effort. Modularization often involves building libraries, or sets of predefined functions. Libraries have been in use since the beginning in many programming languages, especially in C/C++. C/C++ libraries, however, usually provide sequentially consistent abstractions, where tasks are performed one after the other. On the other hand, many modern programs and applications require concurrency, enabling the performance of tasks in no particular order. Current libraries do not provide many such services. This paper proposes a model for such libraries. Of course, this is academic work. The authors describe a model, not a set of libraries readily downloadable from a website. It is part of ongoing work by the authors in response to challenges from the academic world at large. It also provides some practical advice about program verification: it should be used not to ensure that software behaves as expected (which is simply impossible!), but merely to determine if it conforms to its specifications. Online Computing Reviews Service

              Access critical reviews of Computing literature here

              Become a reviewer for Computing Reviews.

              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 48, Issue 1
                POPL '13
                January 2013
                561 pages
                ISSN:0362-1340
                EISSN:1558-1160
                DOI:10.1145/2480359
                Issue’s Table of Contents
                • cover image ACM Conferences
                  POPL '13: Proceedings of the 40th annual ACM SIGPLAN-SIGACT symposium on Principles of programming languages
                  January 2013
                  586 pages
                  ISBN:9781450318327
                  DOI:10.1145/2429069

                Copyright © 2013 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: 23 January 2013

                Check for updates

                Qualifiers

                • research-article

              PDF Format

              View or Download as a PDF file.

              PDF

              eReader

              View online with eReader.

              eReader