Teaching Software Transactional Memory in Concurrency Courses with Clojure and Java

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10659)


In the field of concurrency and parallelism, it is known that the use of lock-based synchronization mechanisms limits the programming efficiency of concurrent applications and reveals problems in thread synchronization. Software Transactional Memory (STM) is a consolidated concurrency control mechanism that may be considered as an alternative to lock-based constructs for programming critical software, although STM is still not fully accepted as a programming model for the industry. It is our opinion that STM programming must be more emphasized in undergraduate courses on concurrency and parallelism. In this paper we propose an academic experience regarding the introduction of STM programming in concurrency courses by using the Clojure language as the common vehicle for teaching Concurrent Programming. Java, the most popular and extended programming language for teaching concurrency, becomes a second language in our course, and thus our students can take advantage of Clojure API which is defined in Java in order to simplify the development of programming, lectures and assignments.


Clojure Concurrency Java Locks Mutual exclusion Threads Transactions Software Transactional Memory Performance 


  1. 1.
    Brevnov, E., Dolgov, Y., Kuznetsov, B., Yhershov, D., Shakin, V., Chen, D., Menon, V., Srinivas, S.: Practical experiences with Java software transactional memory. In: The 13th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (2008)Google Scholar
  2. 2.
    Carlstrom, B., Chung, J., Chafi, H., McDonald, A., Minh, C., Hammond, L., Kozyrakis, K., Olukotun, K.: Executing Java programs with transactional memory. Sci. Comput. Program. 63, 111–129 (2006)MathSciNetCrossRefMATHGoogle Scholar
  3. 3.
    Cascaval, C., Blundell, C., Michael, M., Cain, H., Wu, P., Chiras, S., Chaterjee, S.: Software transactional memory: why is it only a research toy. Commun. ACM 51(11) (2008).  https://doi.org/10.1145/1400214.1400228
  4. 4.
    Clarke, F., Ekeland, I., Pedrero, M., Gutierrez, E., Romero, S., Plata, O.: Improving transactional memory performance for irregular applications. Procedia Comput. Sci. 51, 2714–2718 (2015)CrossRefGoogle Scholar
  5. 5.
    The Joint Task Force on Computing Curricula, Association for Computing Machinery (ACM) and IEEE Computer Society. Computer Science Curricula 2013 Curriculum Guidelines for Undergraduate Degree Programs in Computer Science. https://www.acm.org/education/CS2013-final-report.pdf. Accessed 27 Mar 2017
  6. 6.
    Dias, R., Vale, T., Lourenço, J.: Efficient support for in-place metadata in Java software transactional memory. Concurr. Comput. Pract. Exp. 25, 2394–2411 (2013).  https://doi.org/10.1002/cpe.3098. Wiley Online LibraryCrossRefGoogle Scholar
  7. 7.
    Diegues, N., Fernandes, S., Cachopo, J.: Parallel nesting in a lock-free multi-version software transactional memory. Technical report RT/2/2012 (2012). http://algos.inesc-id.pt/~jpa/InscI/poisson/varwwwhtml/portal/ficheiros/publicacoes/7621.pdf. Accessed 20 Mar 2017
  8. 8.
    Fernández, J.: Java 7 Concurrency CookBook. Packt Publishing, Birmingham (2012)Google Scholar
  9. 9.
    Gosling, J., Joy, B., Steele, G., Bracha, G., Buckley, A.: The Java Language Specification. Java SE, 8 edn (2015). https://docs.oracle.com/javase/specs/jls/se8/jls8.pdf. Accessed 15 Feb 2017
  10. 10.
    Herlihy, M., Luchangco, V., Moir, M.: A flexible framework for implementing software transactional memory. http://citeseerx.ist.psu.edu/viewdoc/download?doi= Accessed 20 Mar 2017
  11. 11.
    ISO: Working Draft, Standard for Programming Language C++ (2016). http://open-std.org/JTC1/SC22/WG21/docs/papers/2016/n4618.pdf. Accessed 16 Feb 2017
  12. 12.
    Malde, K.: Can software transactional memory make concurrent programs simple and safe? http://cs.brown.edu/~mph/HerlihyLM06/dstm2.pdf. Accessed 20 Mar 2017
  13. 13.
    Mizuno, K., Nakaike, T., Nakatani, T.: Reducing rollbacks of transactional memory using ordered shared locks. In: Sips, H., Epema, D., Lin, H.-X. (eds.) Euro-Par 2009. LNCS, vol. 5704, pp. 704–715. Springer, Heidelberg (2009).  https://doi.org/10.1007/978-3-642-03869-3_66 CrossRefGoogle Scholar
  14. 14.
    Mohamedin, M., Ravindran, B., Palmieri, R.: ByteSTM: Virtual Machine-level Java Software Transactional Memory. http://www.ssrg.ece.vt.edu/papers/coordination_15_CR.pdf. Accessed 20 Mar 2017
  15. 15.
    Nakaike, T., Odaira, R., Nakatani, T., Michael, M.: Real Java applications in software transactional memory. In: IEEE International Symposium on Workload Characterization (2010).  https://doi.org/10.1109/IISWC.2010.5654431
  16. 16.
    Pankratius, V., Adl-Tatabai, A.: Software engineering with transactional memory versus locks in practice. Theory Comput. Syst. 55(3), 555–590 (2013).  https://doi.org/10.1007/s00224-013-9452-5 MathSciNetCrossRefGoogle Scholar
  17. 17.
    Prasad, S.K., et al.: NSF/IEEE-TCPP curriculum initiative on parallel and distributed computing - core topics for undergraduates. https://grid.cs.gsu.edu/~tcpp/curriculum/?q=system/files/NSF-TCPP-curriculum-version1.pdf. Accessed 20 Mar 2017
  18. 18.
    Subramanian, V.: Programming Concurrency on the JVM: Masterig Synchronization, STMA, and Actors. The Pragmatic Bookshelf, Dallas (2011)Google Scholar
  19. 19.
    Yamada, Y., Iwasaki, H., Ugawa, T.: SAW: Java synchronization selection from lock or software transactional memory. In: Proceeding of IEEE 17th International Conference on Parallel and Distributed Systems, pp. 104–111 (2011)Google Scholar
  20. 20.
    Ziarek, L., Welc, A., Adl-Tabatabi, A., Menon, V., Shpeisman, T., Jagannathan, S.: A uniform transactional execution environment for Java. https://www.cs.purdue.edu/homes/suresh/papers/ecoop08.pdf. Accessed 20 Mar 2017

Copyright information

© Springer International Publishing AG, part of Springer Nature 2018

Authors and Affiliations

  1. 1.Dpto. de Ingeniería InformáticaUniversidad de CadizPuerto RealSpain
  2. 2.College of Informatics and TelecommunicationsUniversity of GranadaGranadaSpain

Personalised recommendations