skip to main content
article

Goldilocks: a race and transaction-aware java runtime

Published:10 June 2007Publication History
Skip Abstract Section

Abstract

Data races often result in unexpected and erroneous behavior. In addition to causing data corruption and leading programs to crash, the presence of data races complicates the semantics of an execution which might no longer be sequentially consistent. Motivated by these observations, we have designed and implemented a Java runtime system that monitors program executions and throws a DataRaceException when a data race is about to occur. Analogous to other runtime exceptions, the DataRaceException provides two key benefits. First, accesses causing race conditions are interruptedand handled before they cause errors that may be difficult to diagnose later. Second, if no DataRaceException is thrown in an execution, it is guaranteed to be sequentially consistent. This strong guarantee helps to rule out many concurrency-related possibilities as the cause of erroneous behavior. When a DataRaceException is caught, the operation, thread, or program causing it can be terminated gracefully. Alternatively, the DataRaceException can serve as a conflict-detection mechanism inoptimistic uses of concurrency.

We start with the definition of data-race-free executions in the Java memory model. We generalize this definition to executions that use transactions in addition to locks and volatile variables for synchronization. We present a precise and efficient algorithm for dynamically verifying that an execution is free of data races. This algorithm generalizes the Goldilocks algorithm for data-race detectionby handling transactions and providing the ability to distinguish between read and write accesses. We have implemented our algorithm and the DataRaceException in the Kaffe Java Virtual Machine. We have evaluated our system on a variety of publicly available Java benchmarks and a few microbenchmarks that combine lock-based and transaction-based synchronization. Our experiments indicate that our implementation has reasonable overhead. Therefore, we believe that inaddition to being a debugging tool, the DataRaceException may be a viable mechanism to enforce the safety of executions of multithreaded Java programs.

References

  1. Martin Abadi, Cormac Flanagan, and Stephen N. Freund. Types for Safe Locking: Static Race Detection for Java. ACM Transactions on Programming Languages and Systems, 28(2):207--255, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. S. Browne, J. Dongarra, N. Garner, G. Ho, and P. Mucci. A Portable Programming Interface for Performance Evaluation on Modern Processors. The Intl. Journal of High Performance Computing Applications, 14(3):189--204, Fall 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  3. Guang-Ien Cheng, Mingdong Feng, Charles E. Leiserson, Keith H. Randall, and Andrew F. Stark. Detecting Data Races in Cilk Programs That Use Locks. In SPAA 98: Annual ACM Symposium on Parallel Algorithms and Architectures. pages 298--309, Puerto Vallarta, Mexico, June 28-July 2, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. James R. Larus and Ravi Rajwar. Transactional Memory. Synthesis Lectures on Computer Architecture. 1(1):1--226. 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Jong-Deok Choi, Alexey Loginov, and Vivek Sarkar. Static Datarace Analysis for Multithreaded Object-oriented Programs. Technical Report, RC22146. IBM Research. 2001.Google ScholarGoogle Scholar
  6. Jong-Deok Choi, Keunwoo Lee, Alexey Loginov, Robert O'Callahan, Vivek Sarkar, and Manu Sridharan. Efficient and Precise Datarace Detection for Multithreaded Object-oriented Programs. In PLDI '02: Proc. ACM SIGPLAN 2002 Conf. on Programming Language Design and Implementation, pp. 258--269, New York, NY, USA, ACM 2002. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Mark Christiaens and Koenraad De Bosschere. TRaDe: Data race detection for Java. In Proc. of the Intl. Conference on Computational Science - ICCS2001, number 2074, pp. 761--770, San Francisco, May 2001. Springer Verlag. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Tayfun Elmas, Shaz Qadeer, and Serdar Tasiran. Goldilocks: Efficiently Computing the Happens-before Relation Using Locksets. In Proc. of the Workshop on Formal Approaches to Testing and Runtime Verification (FATES/RV 2006). 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Tayfun Elmas, Shaz Qadeer, and Serdar Tasiran. Goldilocks: Efficiently Computing the Happens-before Relation Using Locksets. Technical Report MSR-TR-2006-163, Microsoft Research, 2006.Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Tayfun Elmas, Serdar Tasiran, and Shaz Qadeer. Vyrd: Verifying Concurrent Programs by Runtime Refinement-Violation Detection. In PLDI '05: Proc. of the 2005 ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 27--37, New York, NY, USA, ACM 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Dan Grossman, Jeremy Manson, and William Pugh. What Do High level Memory Models Mean for Transactions? In MSPC'06: Proc. of the 2006 Workshop on Memory System Performance and Correctness, pp. 62--69, New York, NY, USA, 2006. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Tim Harris and Keir Fraser. Language Support for Lightweight Transactions. In OOPSLA '03: Proc. of the 18th annual ACM SIGPLAN Conference on Object-oriented Programing, Systems, Languages, and Applications, pp. 388--402, New York, NY, USA, ACM 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Tim Harris, Simon Marlow, Simon Peyton-Jones, and Maurice Herlihy. Composable Memory Transactions. In PPoPP '05: Proc. of the 10th ACM SIGPLAN symposium on Principles and practice of parallel programming, pp. 48--60, New York, NY, USA, ACM 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Maurice Herlihy. SXM1.1: Software Transactional Memory Package for C#. Technical Report, Brown University & Microsoft Research, May, 2005.Google ScholarGoogle Scholar
  15. Benjamin Hindman and Dan Grossman. Atomicity via Source-to source Translation. In MSPC'06: Proc. of the 2006 Workshop on Memory System Performance and Correctness, pp. 82--91, New York, NY, USA, 2006. ACM Press. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Friedemann Mattern. Virtual Time and Global States of Distributed Systems. In Parallel and Distributed Algorithms: Proceedings of the Intl. Workshop on Parallel and Distributed Algorithms. 1988.Google ScholarGoogle Scholar
  17. Mayur Naik, Alex Aiken, and John Whaley. Effective Static Race Detection for Java. In PLDI'06: Proc. of the 2006 ACM SIGPLAN Conference on Programming Language Design and Implementation, pp. 308--319, New York, NY, USA, ACM 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Eli Pozniansky and Assaf Schuster. Efficient On-the-fly Data Race Detection in Multithreaded C++ Programs. In PPoPP'03: Proc. of the 9th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, pp. 179--190, New York, NY, USA, ACM 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Michiel Ronsse and Koen De Bosschere. RecPlay: A Fully Integrated Practical Record/Replay System. ACM Transactions on Computer Systems, 17(2):133--152, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Stefan Savage, Michael Burrows, Greg Nelson, Patrick Sobalvarro, and Thomas Anderson. Eraser: A Dynamic Data Race Detector for Multithreaded Programs. ACM Transactions on Computer Systems, 15(4):391--411, 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Edmond Schonberg. On-the-fly Detection of Access Anomalies. In Proc. of the ACM SIGPLAN'89 Conference on Programming Language Design and Implementation, volume 24, pp. 285--297, Portland, OR, June 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Nir Shavit and Dan Touitou. Software Transactional Memory. In Proc. of the 14th Annual ACM Symposium on Principles of Distributed Computing, pp. 204--213, ACM 1995. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Christoph von Praun and Thomas R. Gross. Object race detection. In OOPSLA'01: Proc. of the 16th ACM SIGPLAN Conference on Object-oriented Programming, Systems, Languages, and Applications, pp. 70--82, New York, NY, USA, ACM 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Tim Wilkinson. Kaffe: A JIT and Interpreting Virtual Machine to Run Java Code. http://www.transvirtual.com/, 1998.Google ScholarGoogle Scholar
  25. Yuan Yu, Tom Rodeheffer, and Wei Chen. Racetrack: Efficient Detection of Data Race Conditions via Adaptive Tracking. In SOSP'05: Proc. of the 20th ACM symposium on Operating systems principles, pp. 221--234, New York, NY, USA, ACM 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Goldilocks: a race and transaction-aware java runtime

                        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 42, Issue 6
                          Proceedings of the 2007 PLDI conference
                          June 2007
                          491 pages
                          ISSN:0362-1340
                          EISSN:1558-1160
                          DOI:10.1145/1273442
                          Issue’s Table of Contents
                          • cover image ACM Conferences
                            PLDI '07: Proceedings of the 28th ACM SIGPLAN Conference on Programming Language Design and Implementation
                            June 2007
                            508 pages
                            ISBN:9781595936332
                            DOI:10.1145/1250734

                          Copyright © 2007 ACM

                          Publisher

                          Association for Computing Machinery

                          New York, NY, United States

                          Publication History

                          • Published: 10 June 2007

                          Check for updates

                          Qualifiers

                          • 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!