skip to main content
10.1145/1941553.1941573acmconferencesArticle/Chapter ViewAbstractPublication PagesppoppConference Proceedingsconference-collections
research-article

Thread contracts for safe parallelism

Authors Info & Claims
Published:12 February 2011Publication History

ABSTRACT

We build a framework of thread contracts, called Accord, that allows programmers to annotate their concurrency co-ordination strategies. Accord annotations allow programmers to declaratively specify the parts of memory that a thread may read or write into, and the locks that protect them, reflecting the concurrency co-ordination among threads and the reason why the program is free of data-races. We provide automatic tools to check if the concurrency co-ordination strategy ensures race-freedom, using constraint-solvers (SMT solvers). Hence programmers using Accord can both formally state and prove their co-ordination strategies ensure race freedom. The programmer's implementation of the co-ordination strategy may however be correct or incorrect. We show how the formal Accord contracts allow us to automatically insert runtime assertions that serve to check, during testing, whether the implementation conforms to the contract. Using a large class of data-parallel programs that share memory in intricate ways, we show that natural and simple contracts suffice to document the co-ordination strategy amongst threads, and that the task of showing that the strategy ensures race-freedom can be handled efficiently and automatically by an existing SMT solver (Z3). While co-ordination strategies can be proved race-free in our framework, failure to prove the co-ordination strategy race-free, accompanied by counter-examples produced by the solver, indicates the presence of races. Using such counterexamples, we report hitherto undiscovered data-races that we found in the long-tested applu_l benchmark in the Spec OMP2001 suite.

References

  1. NVIDIA CUDA programming guide version 3.0. http://www.nvidia.com/cuda, 2010.Google ScholarGoogle Scholar
  2. S. Adve, M. Hill, B. Miller, and R. Netzer. Detecting data races on weak memory systems. In The 18th Annual International Symposium on Computer Architecture, 1991., pages 234--243, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Z. Anderson, D. Gay, R. Ennals, and E. Brewer. SharC: checking data sharing strategies for multithreaded c. In PLDI'08, pages 149--158. ACM New York, NY, USA, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. D. F. Bacon, R. E. Strom, and A. Tarafdar. Guava: A dialect of java without data races. In OOPSLA '00. ACM Press, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. P. Becker. Working draft, standard for programming language C. Technical report, ISO/IEC JTC 1, Information Technology, Subcommittee SC 22, 2010.Google ScholarGoogle Scholar
  6. R. Bocchino and V. A. et al. A type and effect system for deterministic parallel java. In OOPSLA'09. ACM, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. H.-J. Boehm and S. V. Adve. Foundations of the c concurrency memory model. In PLDI'08, New York, NY, USA, 2008. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. C. Boyapati and M. Rinard. A parameterized type system for race-free java programs. In OOPSLA'01, pages 56--69. ACM, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. J.-D. Choi, K. Lee, A. Loginov, R. O'Callahan, V. Sarkar, and M. Sridharan. Efficient and precise datarace detection for multithreaded object-oriented programs. In PLDI '02, pages 258--269, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. L. de Moura and N. Bjørner. Z3: An efficient smt solver. In Tools and Algorithms for the Construction and Analysis of Systems, volume 4963/2008 of LNCS, pages 337--340. Springer Berlin, April 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. T. Elmas, S. Qadeer, and S. Tasiran. Goldilocks: a race and transaction-aware java runtime. In J. Ferrante and K. S. McKinley, editors, PLDI'07, pages 245--255. ACM, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. C. Flanagan and M. Abadi. Object types against races. In CONCUR, volume 1664 of LNCS, pages 288--303. Springer, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. C. Flanagan and S. N. Freund. Type-based race detection for java. In PLDI '00, pages 219--232, New York, NY, USA, 2000. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. K. R. Leino and P. Müller. A basis for verifying multi-threaded programs. In ESOP'09, pages 378--393, Berlin, Heidelberg, 2009. Springer-Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. R. Lublinerman and S. Tripakis. Checking equivalence of spmd programs using non-interference. Technical Report UCB/EECS-2009-42, EECS Department, University of California, Berkeley, Mar 2009.Google ScholarGoogle Scholar
  16. J. Manson, W. Pugh, and S. Adve. The Java memory model. In POPL'05, pages 378--391. ACM New York, NY, USA, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. B. Meyer. Applying "design by contract". Computer, 25 (10): 40--51, 1992. ISSN 0018-9162. http://dx.doi.org/10.1109/2.161279. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Microsoft Corporation. Code Contracts. http://research.microsoft.com/en-us/projects/contracts/, 2008-10.Google ScholarGoogle Scholar
  19. Parallel@Illinois. Denovo: Rethinking hardware for disciplined parallelism. phhttp://rsim.cs.illinois.edu/denovo/, 2008-10.Google ScholarGoogle Scholar
  20. P. Permandla, M. Roberson, and C. Boyapati. A type system for preventing data races and deadlocks in the java virtual machine language: 1. In LCTES'07, page 10, New York, NY, USA, 2007. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. D. Powers. Parallelized Quicksort and Radixsort with Optimal Speedup. In Proceedings of the International Conference on Parallel Computing Technologies, 1991., pages 167--176, 1991.Google ScholarGoogle Scholar
  22. E. Pozniansky and A. Schuster. Efficient on-the-fly data race detection in multithreaded c programs. In PPoPP'03, pages 179--190, New York, NY, USA, 2003. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. S. Ranise and C. Tinelli. The smt-lib standard: Version 1.2. 2006.Google ScholarGoogle Scholar
  24. J. Reynolds. Separation logic: A logic for shared mutable data structures. In Logic in Computer Science, 2002. Proceedings., pages 55--74, 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. S. Savage, M. Burrows, G. Nelson, P. Sobalvarro, and T. Anderson. Eraser: A dynamic data race detector for multithreaded programs. ACM Transactions on Computer Systems (TOCS), 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. D. Schonberg. On-the-fly detection of access anomalies. In PLDI'89, pages 285--297. ACM New York, NY, USA, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. L. A. Smith and J. M. Bull. A multithreaded java grande benchmark suite. In In Proceedings of the Third Workshop on Java for High Performance Computing, pages 97--105, 2001.Google ScholarGoogle Scholar
  28. M. J. Wolfe. phHigh Performance Compilers for Parallel Computing. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 1995. ISBN 0805327304. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Y. Yu, T. Rodeheffer, and W. Chen. Racetrack: efficient detection of data race conditions via adaptive tracking. SIGOPS Oper. Syst. Rev., 39 (5): 221--234, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Thread contracts for safe parallelism

            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
              PPoPP '11: Proceedings of the 16th ACM symposium on Principles and practice of parallel programming
              February 2011
              326 pages
              ISBN:9781450301190
              DOI:10.1145/1941553
              • General Chair:
              • Calin Cascaval,
              • Program Chair:
              • Pen-Chung Yew
              • cover image ACM SIGPLAN Notices
                ACM SIGPLAN Notices  Volume 46, Issue 8
                PPoPP '11
                August 2011
                300 pages
                ISSN:0362-1340
                EISSN:1558-1160
                DOI:10.1145/2038037
                Issue’s Table of Contents

              Copyright © 2011 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: 12 February 2011

              Permissions

              Request permissions about this article.

              Request Permissions

              Check for updates

              Qualifiers

              • research-article

              Acceptance Rates

              Overall Acceptance Rate230of1,014submissions,23%

            PDF Format

            View or Download as a PDF file.

            PDF

            eReader

            View online with eReader.

            eReader