skip to main content
10.1145/1250734.1250762acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
Article

Goldilocks: a race and transaction-aware java runtime

Published: 10 June 2007 Publication History

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.
[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.
[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.
[4]
James R. Larus and Ravi Rajwar. Transactional Memory. Synthesis Lectures on Computer Architecture. 1(1):1--226. 2006.
[5]
Jong-Deok Choi, Alexey Loginov, and Vivek Sarkar. Static Datarace Analysis for Multithreaded Object-oriented Programs. Technical Report, RC22146. IBM Research. 2001.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[14]
Maurice Herlihy. SXM1.1: Software Transactional Memory Package for C#. Technical Report, Brown University & Microsoft Research, May, 2005.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[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.
[24]
Tim Wilkinson. Kaffe: A JIT and Interpreting Virtual Machine to Run Java Code. http://www.transvirtual.com/, 1998.
[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.

Cited By

View all
  • (2024)Coarser Equivalences for Causal ConcurrencyProceedings of the ACM on Programming Languages10.1145/36328738:POPL(911-941)Online publication date: 5-Jan-2024
  • (2024)Reorder Pointer Flow in Sound Concurrency Bug PredictionProceedings of the IEEE/ACM 46th International Conference on Software Engineering10.1145/3597503.3623300(1-13)Online publication date: 20-May-2024
  • (2024)Predictive Monitoring with Strong Trace PrefixesComputer Aided Verification10.1007/978-3-031-65630-9_9(182-204)Online publication date: 24-Jul-2024
  • Show More Cited By

Index Terms

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

                        Recommendations

                        Comments

                        Information & Contributors

                        Information

                        Published In

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

                        Sponsors

                        Publisher

                        Association for Computing Machinery

                        New York, NY, United States

                        Publication History

                        Published: 10 June 2007

                        Permissions

                        Request permissions for this article.

                        Check for updates

                        Author Tags

                        1. Java runtime
                        2. data-race detection
                        3. runtime monitoring
                        4. software transactions

                        Qualifiers

                        • Article

                        Conference

                        PLDI '07
                        Sponsor:

                        Acceptance Rates

                        Overall Acceptance Rate 406 of 2,067 submissions, 20%

                        Contributors

                        Other Metrics

                        Bibliometrics & Citations

                        Bibliometrics

                        Article Metrics

                        • Downloads (Last 12 months)32
                        • Downloads (Last 6 weeks)1
                        Reflects downloads up to 17 Jan 2025

                        Other Metrics

                        Citations

                        Cited By

                        View all
                        • (2024)Coarser Equivalences for Causal ConcurrencyProceedings of the ACM on Programming Languages10.1145/36328738:POPL(911-941)Online publication date: 5-Jan-2024
                        • (2024)Reorder Pointer Flow in Sound Concurrency Bug PredictionProceedings of the IEEE/ACM 46th International Conference on Software Engineering10.1145/3597503.3623300(1-13)Online publication date: 20-May-2024
                        • (2024)Predictive Monitoring with Strong Trace PrefixesComputer Aided Verification10.1007/978-3-031-65630-9_9(182-204)Online publication date: 24-Jul-2024
                        • (2023)DDRaceProceedings of the 32nd USENIX Conference on Security Symposium10.5555/3620237.3620397(2849-2866)Online publication date: 9-Aug-2023
                        • (2023)Dynamic Race Detection with O(1) SamplesProceedings of the ACM on Programming Languages10.1145/35712387:POPL(1308-1337)Online publication date: 11-Jan-2023
                        • (2023)When Memory Corruption Met Concurrency: Vulnerabilities in Concurrent ProgramsIEEE Access10.1109/ACCESS.2023.327283311(44725-44740)Online publication date: 2023
                        • (2023)Vamos: Middleware for Best-Effort Third-Party MonitoringFundamental Approaches to Software Engineering10.1007/978-3-031-30826-0_15(260-281)Online publication date: 22-Apr-2023
                        • (2022)Yashme: detecting persistency racesProceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems10.1145/3503222.3507766(830-845)Online publication date: 28-Feb-2022
                        • (2022)A tree clock data structure for causal orderings in concurrent executionsProceedings of the 27th ACM International Conference on Architectural Support for Programming Languages and Operating Systems10.1145/3503222.3507734(710-725)Online publication date: 28-Feb-2022
                        • (2022)Hybrid Static-Dynamic Analysis of Data Races Caused by Inconsistent Locking Discipline in Device DriversIEEE Transactions on Software Engineering10.1109/TSE.2021.3138735(1-1)Online publication date: 2022
                        • Show More Cited By

                        View Options

                        Login options

                        View options

                        PDF

                        View or Download as a PDF file.

                        PDF

                        eReader

                        View online with eReader.

                        eReader

                        Media

                        Figures

                        Other

                        Tables

                        Share

                        Share

                        Share this Publication link

                        Share on social media