skip to main content
research-article
Open access

Semantics of transactional memory and automatic mutual exclusion

Published: 25 January 2011 Publication History

Abstract

Software Transactional Memory (STM) is an attractive basis for the development of language features for concurrent programming. However, the semantics of these features can be delicate and problematic. In this article we explore the trade-offs semantic simplicity, the viability of efficient implementation strategies, and the flexibility of language constructs. Specifically, we develop semantics and type systems for the constructs of the Automatic Mutual Exclusion (AME) programming model; our results apply also to other constructs, such as atomic blocks. With this semantics as a point of reference, we study several implementation strategies. We model STM systems that use in-place update, optimistic concurrency, lazy conflict detection, and rollback. These strategies are correct only under nontrivial assumptions that we identify and analyze. One important source of errors is that some efficient implementations create dangerous “zombie” computations where a transaction keeps running after experiencing a conflict; the assumptions confine the effects of these computations.

References

[1]
Abadi, M. 2008. Automatic mutual exclusion and atomicity checks. In Concurrency, Graphs and Models, Essays Dedicated to Ugo Montanari on the Occasion of His 65th Birthday, P. Degano, R. D. Nicola, and J. Meseguer, Eds. Lecture Notes in Computer Science, vol. 5065. Springer-Verlag, 510--526.
[2]
Abadi, M., Birrell, A., Harris, T., Hsieh, J., and Isard, M. 2008. Dynamic separation for transactional memory. Tech. rep. MSR-TR-2008-43, Microsoft Research.
[3]
Abadi, M., Birrell, A., Harris, T., Hsieh, J., and Isard, M. 2009. Implementation and use of transactional memory with dynamic separation. In Proceedings of the 18th International Conference on Compiler Construction (CC'09), O. de Moor and M. I. Schwartzbach, Eds. Lecture Notes in Computer Science, vol. 5501. Springer-Verlag, 63--77.
[4]
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.
[5]
Abadi, M., Harris, T., and Moore, K. F. 2008. A model of dynamic separation for transactional memory. In Proceedings of the 19th International Confernece on Concurrency Theory (CONCUR'08), F. van Breugel and M. Chechik, Eds. Lecture Notes in Computer Science, vol. 5201. Springer-Verlag, 6--20.
[6]
Adl-Tabatabai, A.-R., Lewis, B. T., Menon, V., Murphy, B. R., Saha, B., and Shpeisman, T. 2006. Compiler and runtime support for efficient software transactional memory. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'06). 26--37.
[7]
Adve, S. V. and Hill, M. D. 1990. Weak ordering--a new definition. SIGARCH Comput. Archit. News 18, 3a, 2--14.
[8]
Adya, A., Howell, J., Theimer, M., Bolosky, W. J., and Douceur, J. R. 2002. Cooperative task management without manual stack management. In Proceedings of the USENIX Annual Technical Conference (USENIX'02). 289--302.
[9]
Allen, E., Chase, D., Hallett, J., Luchangco, V., Maessen, J.-W., Ryu, S., Steele Jr., G. L., and Tobin-Hochstadt, S. 2007. The Fortress language specification, v1.0β. Tech. rep., Sun Microsystems.
[10]
Blundell, C., Lewis, E. C., and Martin, M. M. K. 2006. Subtleties of transactional memory atomicity semantics. Comput. Archit. Lett. 5, 2.
[11]
Bronson, N. G., Kozyrakis, C., and Olukotun, K. 2009. Feedback-directed barrier optimization in a strongly isolated STM. In Proceedings of the 36th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'09). 213--225.
[12]
Carlstrom, B. D., McDonald, A., Chafi, H., Chung, J., Minh, C. C., Kozyrakis, C., and Olukotun, K. 2006. The Atomos transactional programming language. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'06). 1--13.
[13]
Cohen, A., O'Leary, J. W., Pnueli, A., Tuttle, M. R., and Zuck, L. D. 2007. Verifying correctness of transactional memories. In Proceedings of the 7th International Conference on Formal Methods in Computer-Aided Design (FMCAD'07). 37--44.
[14]
Dalessandro, L. and Scott, M. L. 2009. Strong isolation is a weak idea. In Proceedings of the 4th Workshop on Transactional Computing (TRANSACT'09).
[15]
Dice, D., Shalev, O., and Shavit, N. 2006. Transactional locking II. In Proceedings of the 20th International Symposium on Distributed Computing (DISC'06), S. Dolev, Ed., Lecture Notes in Computer Science, vol. 4167. Springer, 194--208.
[16]
Dice, D. and Shavit, N. 2006. What really makes transactions faster? In Proceedings of the ACM SIGPLAN Workshop on Languages, Compilers, and Hardware Support for Transactional Computing (TRANSACT'06). http://hdl.handle.net/1802/4051.
[17]
Grossman, D., Manson, J., and Pugh, W. 2006. What do high-level memory models mean for transactions? In Proceedings of the Workshop on Memory System Performance and Correctness (MSPC'06). 62--69.
[18]
Guerraoui, R., Henzinger, T., and Singh, V. 2008a. Model checking transactional memories. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'08). 372--382.
[19]
Guerraoui, R., Henzinger, T. A., and Singh, V. 2008b. Completeness and nondeterminism in model checking transactional memories. In Proceedings of the 19th International Confernece on Concurrency Theory (CONCUR'08), F. van Breugel and M. Chechik, Eds. Lecture Notes in Computer Science, vol. 5201. Springer-Verlag, 21--35.
[20]
Harris, T. and Fraser, K. 2003. Language support for lightweight transactions. In Proceedings of the 18th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'03). 388--402.
[21]
Harris, T., Marlow, S., Peyton Jones, S., and Herlihy, M. 2005. Composable memory transactions. In Proceedings of the 10th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP'05). 48--60.
[22]
Harris, T., Plesko, M., Shinnar, A., and Tarditi, D. 2006. Optimizing memory transactions. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'06). 14--25.
[23]
Igarashi, A., Pierce, B. C., and Wadler, P. 2001. Featherweight Java: a minimal core calculus for Java and GJ. ACM Trans. Program. Lang. Syst. 23, 3, 396--450.
[24]
Isard, M. and Birrell, A. 2007. Automatic mutual exclusion. In Proceedings of the 11th Workshop on Hot Topics in Operating Systems (HotOS'07).
[25]
Jagannathan, S., Vitek, J., Welc, A., and Hosking, A. 2005. A transactional object calculus. Sci. Comput. Program. 57, 2, 164--186.
[26]
Kuszmaul, B. C. and Leiserson, C. E. 2003. Transactions everywhere. Tech. rep., MIT. http://hdl.handle.net/1721.1/3692.
[27]
Liblit, B. 2006. An operational semantics for LogTM. Tech. rep. 1571, University of Wisconsin--Madison. Version 1.0.
[28]
Manson, J., Baker, J., Cunei, A., Jagannathan, S., Prochazka, M., Xin, B., and Vitek, J. 2005. Preemptible atomic regions for real-time Java. In Proceedings of the 26th IEEE Real-Time Systems Symposium (RTSS'05). 62--71.
[29]
Manson, J., Pugh, W., and Adve, S. V. 2005. The Java memory model. In Proceedings of the 32nd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'05). 378--391.
[30]
Menon, V., Balensiefer, S., Shpeisman, T., Adl-Tabatabai, A.-R., Hudson, R., Saha, B., and Welc, A. 2008. Practical weak-atomicity semantics for Java STM. In Proceedings of the 20th Annual Symposium on Parallelism in Algorithms and Architectures (SPAA'08). 314--325.
[31]
Moore, K. E., Bobba, J., Moravan, M. J., Hill, M. D., and Wood, D. A. 2006. LogTM: Log-based transactional memory. In Proceedings of the 12th International Symposium on High-Performance Computer Architecture (HPCA'06). 254--265.
[32]
Moore, K. F. and Grossman, D. 2008. High-level small-step operational semantics for transactions. In Proceedings of the 35th ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages (POPL'08). 51--62.
[33]
Naik, M., Aiken, A., and Whaley, J. 2006. Effective static race detection for Java. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'06). 308--319.
[34]
Saha, B., Adl-Tabatabai, A.-R., Hudson, R. L., Minh, C. C., and Hertzberg, B. 2006. McRT-STM: a high performance software transactional memory system for a multi-core runtime. In Proceedings of the 11th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP'06). 187--197.
[35]
Schneider, F. T., Menon, V., Shpeisman, T., and Adl-Tabatabai, A.-R. 2008. Dynamic optimization for efficient strong atomicity. In Proceedings of the 23rd ACM SIGPLAN Conference on Object-Oriented Programming Systems Languages and Applications (OOPSLA'08). 181--194.
[36]
Scott, M. L. 2006. Sequential specification of transactional memory semantics. In Proceedings of the 1st ACM SIGPLAN Workshop on Languages, Compilers, and Hardware Support for Transactional Computing (TRANSACT'06). http://hdl.handle.net/1802/4050.
[37]
Shavit, N. and Touitou, D. 1995. Software transactional memory. In Proceedings of the 14th ACM Symposium on Principles of Distributed Computing (PODC'95). 204--213.
[38]
Shpeisman, T., Menon, V., Adl-Tabatabai, A.-R., Balensiefer, S., Grossman, D., Hudson, R. L., Moore, K. F., and Saha, B. 2007. Enforcing isolation and ordering in STM. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI'07). 78--88.
[39]
Spear, M. F., Dalessandro, L., Marathe, V., and Scott, M. L. 2008. Ordering-based semantics for software transactional memory. In Proceedings of the 12th International Conference on Principles of Distributed Systems (OPODIS'08), T. P. Baker, A. Bui, and S. Tixeuil, Eds. Lecture Notes in Computer Science, vol. 972. Springer, 275--294.
[40]
Spear, M. F., Marathe, V. J., Dalessandro, L., and Scott, M. L. 2007. Privatization techniques for software transactional memory. Tech. rep. 915, University of Rochester.
[41]
Sterling, N. 1993. Warlock: A static data race analysis tool. In Proceedings of the USENIX Winter Technical Conference. 97--106.
[42]
Tasiran, S. 2008. A compositional method for verifying software transactional memory implementations. Tech. rep. MSR-TR-2008-56, Microsoft Research.
[43]
Wang, C., Chen, W.-Y., Wu, Y., Saha, B., and Adl-Tabatabai, A.-R. 2007. Code generation and optimization for transactional memory constructs in an unmanaged language. In Proceedings of the International Symposium on Code Generation and Optimization (CGO'07). 34--48.
[44]
Welc, A., Jagannathan, S., and Hosking, A. 2005. Safe futures for Java. In Proceedings of the 20th Annual ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA'05). 439--453.
[45]
Wright, A. K. and Felleisen, M. 1994. A syntactic approach to type soundness. Inform. Computat. 115, 1, 38--94.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Transactions on Programming Languages and Systems
ACM Transactions on Programming Languages and Systems  Volume 33, Issue 1
January 2011
218 pages
ISSN:0164-0925
EISSN:1558-4593
DOI:10.1145/1889997
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]

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 25 January 2011
Accepted: 01 January 2010
Revised: 01 August 2009
Received: 01 November 2008
Published in TOPLAS Volume 33, Issue 1

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. Atomicity
  2. correctness

Qualifiers

  • Research-article
  • Research
  • Refereed

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)75
  • Downloads (Last 6 weeks)15
Reflects downloads up to 04 Feb 2025

Other Metrics

Citations

Cited By

View all

View Options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Login options

Full Access

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media