Software Transactional Memory in Java on Clojure: A Performance Analysis
Antonio J. Tomeu, Alberto Salguero, Manuel I. Capel · IEEE Latin America Transactions · 2018
In the field of concurrency and parallelism, it is known that the use of synchronization techniques based on locks to synchronize threads is dangerous. When locks are used to control the access to a shared resource, the probability of introducing control errors that may rise to security and liveliness problems is very high, and the software correction analysis developed under this paradigm is very complex. An alternative, already consolidated in the scope of research, although not fully assumed in the area of software production, is the Software Transactional Memory (MTS), which protects access to shared data within transactions. When two threads attempt to access the same data in MTS, the transaction handler resolves the conflict, without the need using explicit locks in the code. This results in a more readable and secure software, and with a potentially greater concurrency, since there is no waiting for threads. In this work we analyze an implementation of MTS for Java, supported by the Clojure functional language, and compare its performance with the standard blocking model, that Java supports under critical regions in the standard concurrency API, and by locks of multiple classes in the high-level concurrency API. The results show that the MTS model for Java over Clojure analyzed is far from offering an alternative that provides an equivalent performance to the standard block model.