Abstract
Transactional memory is a new programming abstraction that simplifies concurrent programming. This paper describes the parallel implementation of a Java extension for writing composable memory transactions in Java. Transactions are composable i.e., they can be combined to generate new transactions, and are first-class values, i.e., transactions can be passed as arguments to methods and can be returned as the result of a method call. We describe how composable memory transactions can be implemented in Java as a state passing monad, in which transactional blocks are compiled into an intermediate monadic language. We show that this intermediated language can support different transactional algorithms, such as TL2 [9] and SWissTM [10]. The implementation described here also provides the high level construct retry, which allows possibly-blocking transactions to be composed in sequence. Although our prototype implementation is in Java using BGGA Closures, it could be implemented in any language that supports objects and closures in some way, e.g. C#, C++, and Python.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
References
Java Closures. WWW page. http://www.javac.info/, December 2008
The Haskell STM Benchmark. WWW page. http://www.bscmsrc.eu/software/haskell-stm-benchmark, October 2010
All About Monads. WWW page. https://wiki.haskell.org/All_About_Monads, June 2015
CMTJava. WWW page. https://github.com/rafaelleao/CMTJava, May 2015
Bieniusa, A., Middelkoop, A., Thiermann, P.: Twilight in haskell: software transactional memory with safe I/O and typed conflict management. In: Preproceedings of IFL 2010, September 2010
Du Bois, A.R., Echevarria, M.: A domain specific language for composable memory transactions in java. In: Taha, W.M. (ed.) DSL 2009. LNCS, vol. 5658, pp. 170–186. Springer, Heidelberg (2009)
Bronson, N.G., Chafi, H., Olukotun, K.: Ccstm: a library-based stm for scala. In: The First Annual Scala Workshop at Scala Days (2010)
Carlstrom, B.D., McDonald, A., Chafi, H., Chung, J., Minh, C.C., Kozyrakis, C., Olukotun, K.: The ATOMOS transactional programming language. ACM SIGPLAN Not. 41(6), 1–13 (2006)
Dice, D., Shalev, O., Shavit, N.N.: Transactional locking II. In: Dolev, S. (ed.) DISC 2006. LNCS, vol. 4167, pp. 194–208. Springer, Heidelberg (2006)
Dragojević, A., Guerraoui, R., Kapalka, M.: Stretching transactional memory. In: Proceedings of PLDI 2009, pp. 155–165. ACM, New York, NY, USA (2009)
Ennals, R.: Software transactional memory should not be obstruction-free. Technical report IRC-TR-06-052, Intel Research Cambridge Technical report, January 2006
McDonald, A., et al.: Characterization of TCC on chip-multiprocessors. In: 14th PACT 2005, pp. 63–74. IEEE Computer Society, Saint Louis, MO, USA, September 2005
Marathe, V.J., et al.: Lowering the overhead of nonblocking software transactional memory. Revised, University of Rochester, Computer Science Department, May 2006
Felber, P., Korland, G., Shavit, N.: Deuce: noninvasive concurrency with a java stm. In: Electronic Proceedings of MULTIPROG, p. 10 (2010)
Halloway, S.: Programming Clojure, 1st edn. Pragmatic Bookshelf, Frisco (2009)
Harris, T., Fraser, K.: Language support for lightweight transactions. ACM SIGPLAN Not. 38(11), 388–402 (2003)
Harris, T., Marlow, S., Peyton Jones, S.: Haskell on a shared-memory multiprocessor. In: Haskell Workshop 2005, pp. 49–61, ACM Press, September 2005
Harris, T., Marlow, S., Peyton Jones, S., Herlihy, M.: Composable memory transactions. In: PPoPP 2005, ACM Press (2005)
Herlihy, M., Luchangco, V., Moir, M.: A flexible framework for implementing software transactional memory. SPNOTICES ACM SIGPLAN Not. 41, 253–262 (2006)
Herlihy, M., Luchangco, V., Moir, M., Scherer III, W.N.: Software transactional memory for dynamic-sized data structures. In: PODC: 22th ACM SIGACT-SIGOPS Symposium on Principles of Distributed Computing (2003)
Herlihy, M., Moss, J.E.B.: Transactional memory: architectural support for lock-free data structures. In: Proceedings of the 20th Annual International Symposium on Computer Architecture, pp. 289–300, May 1993
Herlihy, M., Shavit, N.: The Art of Multiprocessor Programming. Morgan Kaufmann Publishers Inc., San Francisco (2008)
Hoare, C.A.R.: Towards a theory of parallel programming. In: Hoare, C.A.R., Perrott, R.H. (eds.) Operating System Techniques, pp. 61–71. Academic Press, New York (1972)
Huch, F., Kupke, F.: A high-level implementation of composable memory transactions in concurrent haskell. In: Butterfield, A., Grelck, C., Huch, F. (eds.) IFL 2005. LNCS, vol. 4015, pp. 124–141. Springer, Heidelberg (2006)
Hutton, G., Meijer, E.: Monadic parsing in haskell. J. Funct. Program. 8(4), 437–444 (1998)
Igarashi, A., Pierce, B., Wadler, P.: Featherweight java: a minimal core calculus for java and GJ. TOPLAS 23(3), 396–459 (2001)
Marathe, V.J., Spear, M.F., Heriot, C., Acharya, A., Eisenstat, D., Scherer III, W.N., Scott, M.L.: Lowering the overhead of software transactional memory. Technical report TR 893, Computer Science Department, University of Rochester, Mar 2006 (Condensed version submitted for publication)
Peterson, J., Hudak, P., Elliott, C.: Lambda in motion: controlling robots with haskell. In: Gupta, G. (ed.) PADL 1999. LNCS, vol. 1551, pp. 91–105. Springer, Heidelberg (1999)
Peyton Jones, S.: Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in Haskell. In: Engineering Theories of Software Construction, pp. 47–96, IOS Press (2001)
Peyton Jones, S.: Haskell 98 language and libraries: the revised report. J. Funct. Program. 13(1), 1–255 (2003)
Peyton Jones, S.: Beautiful Concurrency. O’Reilly, Sebastopol (2007)
Sonmez, N., Perfumo, C., Stipic, S., Cristal, A., Unsal, O.S., Valero, M.: Unreadtvar: extending haskell software transactional memory for performance. In: Trends in Functional Programming, vol. 8. Intellect Books, Bristol (2008)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2015 Springer International Publishing Switzerland
About this paper
Cite this paper
Bandeira, R., Du Bois, A.R., Pilla, M., Vizzotto, J., Machado, M. (2015). Composable Memory Transactions for Java Using a Monadic Intermediate Language. In: Pardo, A., Swierstra, S. (eds) Programming Languages. SBLP 2015. Lecture Notes in Computer Science(), vol 9325. Springer, Cham. https://doi.org/10.1007/978-3-319-24012-1_10
Download citation
DOI: https://doi.org/10.1007/978-3-319-24012-1_10
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-24011-4
Online ISBN: 978-3-319-24012-1
eBook Packages: Computer ScienceComputer Science (R0)