skip to main content
research-article
Open Access

A data-centric approach to synchronization

Published:04 May 2012Publication History
Skip Abstract Section

Abstract

Concurrency-related errors, such as data races, are frustratingly difficult to track down and eliminate in large object-oriented programs. Traditional approaches to preventing data races rely on protecting instruction sequences with synchronization operations. Such control-centric approaches are inherently brittle, as the burden is on the programmer to ensure that all concurrently accessed memory locations are consistently protected. Data-centric synchronization is an alternative approach that offloads some of the work on the language implementation. Data-centric synchronization groups fields of objects into atomic sets to indicate that these fields must always be updated atomically. Each atomic set has associated units of work, that is, code fragments that preserve the consistency of that atomic set. Synchronization operations are added automatically by the compiler. We present an extension to the Java programming language that integrates annotations for data-centric concurrency control. The resulting language, called AJ, relies on a type system that enables separate compilation and supports atomic sets that span multiple objects and that also supports full encapsulation for more efficient code generation. We evaluate our proposal by refactoring classes from standard libraries, as well as a number of multithreaded benchmarks, to use atomic sets. Our results suggest that data-centric synchronization is easy to use and enjoys low annotation overhead, while successfully preventing data races. Moreover, experiments on the SPECjbb benchmark suggest that acceptable performance can be achieved with a modest amount of tuning.

References

  1. Abadi, M., Flanagan, C., and Freund, S. N. 2006. Types for safe locking: Static race detection for Java. ACM Trans. Program. Lang. Syst. 28, 2, 207--255. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Artho, C., Havelund, K., and Biere, A. 2003. High-level data races. Softw. Test. Verification Reliab. 13, 4, 207--227.Google ScholarGoogle ScholarCross RefCross Ref
  3. Bergan, T., Anderson, O., Devietti, J., Ceze, L., and Grossman, D. 2010. Coredet: A compiler and runtime system for deterministic multithreaded execution. In Proceedings of the Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS). 53--64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Bocchino, R., Adve, V., Dig, D., Adve, S., Heumann, S., Komuravelli, R., Overbey, J., Simmons, P., Sung, H., and Vakilian, M. 2009. A type and effect system for deterministic parallel Java. In Proceedigs of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA). 97--116. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Boyapati, C., Lee, R., and Rinard, M. 2002. Ownership types for safe programming: Preventing data races and deadlocks. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA). 211--230. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Boyapati, C. and Rinard, M. 2001. A parameterized type system for race-free Java programs. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA). 56--69. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Burrows, M. and Leino, K. R. M. 2004. Finding stale-value errors in concurrent programs. Concurrency Pract. Exper. 16, 12, 1161--1172. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. Ceze, L., von Praun, C., Cascaval, C., Montesinos, P., and Torrellas, J. 2008. Concurrency control with data coloring. In Proceedings of the Workshop on Memory Systems Performance and Correctness (MSPC). 6--10. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Cherem, S., Chilimbi, T., and Gulwani, S. 2008. Inferring locks for atomic sections. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI). 304--315. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Clarke, D., Potter, J., and Noble, J. 1998. Ownership types for flexible alias protection. In Proceedings of the Conference on Object-Oriented Programming Languages, and Applications (OOPSLA). 48--64. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Demsky, B. and Lam, P. 2010. Views: Object-inspired concurrency control. In Proceedings of the International Conference on Software Engineering. 395--404. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Deng, X., Dwyer, M. B., Hatcliff, J., and Mizuno, M. 2002. Invariant-based specification, synthesis, and verification of synchronization in concurrent programs. In Proceedings of the International Conference on Software Engineering (ICSE). 442--452. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. Engler, D. R. and Ashcraft, K. 2003. RacerX: Effective, static detection of race conditions and deadlocks. In Proceedings of the Symposium on Operating Systems Principles (SOSP). 237--252. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. Flanagan, C. and Freund, S. N. 2000. Type-based race detection for Java. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI). 219--232. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. Flanagan, C., Freund, S. N., Lifshin, M., and Qadeer, S. 2008. Types for atomicity: Static checking and inference for Java. ACM Trans. Programm. Lang. Syst. 30, 4. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Flanagan, C. and Qadeer, S. 2003. A type and effect system for atomicity. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI). 338--349. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. Greenhouse, A. and Boyland, J. 1999. An object-oriented effects system. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP). 205--229. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Grothoff, C., Palsberg, J., and Vitek, J. 2007. Encapsulating objects with confined types. ACM Trans. Program. Lang. Syst. 29, 6, 32--73. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. Hammer, C., Dolby, J., Vaziri, M., and Tip, F. 2008. Dynamic detection of atomic-set-serializability violations. In Proceedings of the International Conference on Software Engineering (ICSE). 231--240. Google ScholarGoogle ScholarDigital LibraryDigital Library
  20. Harris, T. and Fraser, K. 2003. Language support for lightweight transactions. In Proceedings of the Conference on Object-Oriented Programming Systems Languages, and Applications (OOPSLA) (Nov.). 388--402. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. Herlihy, M. and Moss, J. E. B. 1993. Transactional memory: Architectural support for lock-free data structures. In Proceedings of the International Symposium on Computer Architecture (ISCA). 289--300. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. Hoare, C. A. R. 1974. Monitors: An operating system structuring concept. Comm. ACM 17, 10, 549--557. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Kidd, N., Reps, T., Dolby, J., and Vaziri, M. 2011. Finding concurrency-related bugs using random isolation. Int. J. Softw. Tools Technol. Transfer 13, 495--518. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Kulkarni, A., Liu, Y. D., and Smith, S. F. 2010. Task types for pervasive atomicity. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA). 671--690. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Lai, Z., Cheung, S. C., and Chan, W. K. 2010. Detecting atomic-set serializability violations in multithreaded programs through active randomized testing. In Proceedings of the International Conference on Software Engineering. 235--244. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Leino, K. R. M. 1998. Data Groups: Specifying the modification of extended state. In Proceedings of the Conference on Object-Oriented Programming Systems, Languages and Applications (OOPSLA). 144--153. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Leino, K. R. M., Saxe, J. B., and Stata, R. 1999. Checking Java programs via guarded commands. In Proceedings of the European Conference on Object-Oriented Programming Workshop Reader. 110--111. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. Lu, S., Park, S., Hu, C., Ma, X., Jiang, W., Li, Z., Popa, R. A., and Zhou, Y. 2007. Muvi: Automatically inferring multi-variable access correlations and detecting related semantic and concurrency bugs. In Proceedings of the Symposium on Operating Systems Principles (SOSP). 103--116. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Lu, S., Park, S., Seo, E., and Zhou, Y. 2008. Learning from mistakes: A comprehensive study on real world concurrency bug characteristics. In Proceedings of the Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS). 329--339. Google ScholarGoogle ScholarDigital LibraryDigital Library
  30. Lucia, B., Ceze, L., and Strauss, K. 2010. Colorsafe: Architectural support for debugging and dynamically avoiding multi-variable atomicity violations. In Proceedings of the International Symposium on Computer Architecture (ISCA'10). 222--233. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. McCloskey, B., Zhou, F., Gay, D., and Brewer, E. 2006. Autolocker: Synchronization inference for atomic sections. In Proceedings of the Conference Record of the Symposium on Principles of Programming Languages (POPL). 346--358. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Noble, J., Vitek, J., and Potter, J. 1998. Flexible alias protection. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP). 158--185. Google ScholarGoogle ScholarDigital LibraryDigital Library
  33. O'Callahan, R. and Choi, J.-D. 2003. Hybrid dynamic data race detection. In Proceedings of the Symposium on Principles and Practice of Parallel Programming (PPoPP). 167--178. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Savage, S., Burrows, M., Nelson, G., Sobalvarro, P., and Anderson, T. E. 1997. Eraser: A dynamic data race detector for multi-threaded programs. In Proceedings of the Symposium on Operating Systems Principles (SOSP). 27--37. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. Vaziri, M., Tip, F., and Dolby, J. 2006. Associating synchronization constraints with data in an object-oriented language. In Proceedings of the Conference Record of the Symposium on Principles of Programming Languages (POPL). 334--345. Google ScholarGoogle ScholarDigital LibraryDigital Library
  36. Vitek, J. and Bokowski, B. 2001. Confined types in Java. Softw. Pract. Exper. 31, 6, 507--532. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. von Praun, C. and Gross, T. R. 2004. Static detection of atomicity violations in object-oriented programs. J. Object Technol. 3, 6, 103--122.Google ScholarGoogle ScholarCross RefCross Ref
  38. Wang, L. and Stoller, S. D. 2006a. Accurate and efficient runtime detection of atomicity errors in concurrent programs. In Proceedings of the Symposium on Principles and Practice of Parallel Programming (PPoPP). 137--146. Google ScholarGoogle ScholarDigital LibraryDigital Library
  39. Wang, L. and Stoller, S. D. 2006b. Runtime analysis of atomicity for multithreaded programs. IEEE Trans. Softw. Eng. 32, 2, 93--110. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Wrigstad, T., Pizlo, F., Meawad, F., Zhao, L., and Vitek, J. 2009. Loci: Simple thread-locality for Java. In Proceedings of the European Conference on Object-Oriented Programming (ECOOP). 445--469. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Xu, M., Bodik, R., and Hill, M. D. 2005. A serializability violation detector for shared-memory server programs. In Proceedings of the Conference on Programming Language Design and Implementation (PLDI). 1--14. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. A data-centric approach to synchronization

                Recommendations

                Reviews

                Partha Pratim Das

                Concurrency-related errors, like data races, are very difficult to track down and eliminate in large object-oriented programs. Existing approaches to prevent data races rely on protecting instruction sequences (like critical sections) with synchronization operations. Such control-centric approaches put a heavy burden on the programmer to ensure that all concurrently accessed memory locations are consistently protected. They are often error-prone and brittle. Dolby et al. present a novel data-centric synchronization approach to handle the synchronization problem where atomic sets are defined by grouping fields of various objects. Such sets represent fields that must always be updated atomically. To preserve the consistency of an atomic set, it is associated with an appropriate consistency checker code segment. Synchronization operations are then added automatically by the compiler. A subset of Java, called Atomic Java (AJ), is proposed here as an extension of Java with atomic sets. AJ creates annotations for data-centric concurrency control. It relies on a novel type system that produces atomic sets spanning multiple objects. AJ enables separate compilation and supports full encapsulation, ensuring efficient generation of code. Data-centric synchronization makes code easy to evaluate by refactoring classes from standard libraries and multithreaded benchmarks (SPECjbb) to use atomic sets. The process offers low annotation overhead, while successfully preventing data races. The process requires about 40 annotations per thousand lines of code (KLOC) for the collection class and ranges from 0.6 to 11.5 per KLOC for the other applications. For all but one of the applications, the approach requires fewer annotations than the number of synchronized blocks in the original Java code. The throughput of the tuned AJ version of the SPECjbb benchmark achieves 90.8 percent of that achieved by the original Java implementation when run with 98 threads. However, the prototype implementation has drawbacks, too. It does not support multiple atomic sets in a single class and the type system does not deal with generics. Importantly, AJ does not guarantee complete elimination of programmer errors. When a section of code manipulates data outside of the atomic set, data races or deadlocks can potentially occur. This paper suggests an interesting system that guarantees the ability to serialize atomic sets spanning multiple objects and enables separate compilation at the same time. The low annotation overhead of this approach has been effectively demonstrated by the AJ-to-Java compiler. This makes AJ a good candidate for language-based synchronization design. 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 Transactions on Programming Languages and Systems
                  ACM Transactions on Programming Languages and Systems  Volume 34, Issue 1
                  April 2012
                  225 pages
                  ISSN:0164-0925
                  EISSN:1558-4593
                  DOI:10.1145/2160910
                  Issue’s Table of Contents

                  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: 4 May 2012
                  • Accepted: 1 February 2012
                  • Revised: 1 January 2012
                  • Received: 1 February 2011
                  Published in toplas Volume 34, Issue 1

                  Permissions

                  Request permissions about this article.

                  Request Permissions

                  Check for updates

                  Qualifiers

                  • research-article
                  • Research
                  • Refereed

                PDF Format

                View or Download as a PDF file.

                PDF

                eReader

                View online with eReader.

                eReader