Extending Software Transactional Memory in Clojure with Side-Effects and Transaction Control

Research output: Contribution to book/anthology/report/conference proceedingArticle in proceedingResearchpeer-review

Abstract

In conjunction with the increase of multi-core processors the use of functional programming languages has increased in recent years. The functional language Clojure has concurrency as a core feature, and provides Software Transactional Memory (STM) as a substitute for locks. Transactions in Clojure do however not support execution of code with side-effects and provide no methods for synchronising threads. Additional concurrency mechanisms on top of STM are needed for these use cases, increasing the complexity of the code. We present multiple constructs allowing functions with side-effects to be executed as part of a transaction. These constructs are made accessible through a uniform interface, making them interchangeable. We present constructs providing explicit control of transactions. Through these constructs transactions can synchronise threads based on the current program state, abort a transaction, and provide an alternative path of execution if a transaction is forced to restart. eClojure is the implementation of these constructs in Clojure 1.8, and it is tested using an additional set of unit tests. With a series of use cases we show that the addition of these constructs provides additional capabilities to Clojure's STM implementation without violating its ACI properties. Through a usability evaluation with a small sample size we show that using these constructs reduces both the number of lines of code and the development time compared to Clojure 1.8. Last we demonstrate through a preliminary performance benchmark that the addition of these constructs adds only a constant overhead to the STM implementation.
Original languageEnglish
Title of host publicationProceedings of the 9th European Lisp Symposium
EditorsIrène Durand
Number of pages8
PublisherEuropean Lisp Scientific Activities Association
Publication date9 May 2016
Pages65-72
Article number8
ISBN (Electronic)978-2-9557474-0-7
Publication statusPublished - 9 May 2016
Event9th European Lisp Symposium - Department of Computer Science, AGH University of Science and Technology , Kraków, Poland
Duration: 9 May 201610 May 2016
https://www.european-lisp-symposium.org/editions/2016/

Conference

Conference9th European Lisp Symposium
LocationDepartment of Computer Science, AGH University of Science and Technology
CountryPoland
CityKraków
Period09/05/201610/05/2016
Internet address

Fingerprint

Data storage equipment
Functional programming
Computer programming languages
Program processors

Keywords

  • Clojure, MVCC, STM, Side-Effects, Transaction Control

Cite this

Jensen, S. K., & Thomsen, L. L. (2016). Extending Software Transactional Memory in Clojure with Side-Effects and Transaction Control. In I. Durand (Ed.), Proceedings of the 9th European Lisp Symposium (pp. 65-72). [8] European Lisp Scientific Activities Association.
Jensen, Søren Kejser ; Thomsen, Lone Leth. / Extending Software Transactional Memory in Clojure with Side-Effects and Transaction Control. Proceedings of the 9th European Lisp Symposium. editor / Irène Durand. European Lisp Scientific Activities Association, 2016. pp. 65-72
@inproceedings{14bf64f78c3542058c8030404b0c4117,
title = "Extending Software Transactional Memory in Clojure with Side-Effects and Transaction Control",
abstract = "In conjunction with the increase of multi-core processors the use of functional programming languages has increased in recent years. The functional language Clojure has concurrency as a core feature, and provides Software Transactional Memory (STM) as a substitute for locks. Transactions in Clojure do however not support execution of code with side-effects and provide no methods for synchronising threads. Additional concurrency mechanisms on top of STM are needed for these use cases, increasing the complexity of the code. We present multiple constructs allowing functions with side-effects to be executed as part of a transaction. These constructs are made accessible through a uniform interface, making them interchangeable. We present constructs providing explicit control of transactions. Through these constructs transactions can synchronise threads based on the current program state, abort a transaction, and provide an alternative path of execution if a transaction is forced to restart. eClojure is the implementation of these constructs in Clojure 1.8, and it is tested using an additional set of unit tests. With a series of use cases we show that the addition of these constructs provides additional capabilities to Clojure's STM implementation without violating its ACI properties. Through a usability evaluation with a small sample size we show that using these constructs reduces both the number of lines of code and the development time compared to Clojure 1.8. Last we demonstrate through a preliminary performance benchmark that the addition of these constructs adds only a constant overhead to the STM implementation.",
keywords = "Clojure, MVCC, STM, Side-Effects, Transaction Control",
author = "Jensen, {S{\o}ren Kejser} and Thomsen, {Lone Leth}",
year = "2016",
month = "5",
day = "9",
language = "English",
pages = "65--72",
editor = "Ir{\`e}ne Durand",
booktitle = "Proceedings of the 9th European Lisp Symposium",
publisher = "European Lisp Scientific Activities Association",

}

Jensen, SK & Thomsen, LL 2016, Extending Software Transactional Memory in Clojure with Side-Effects and Transaction Control. in I Durand (ed.), Proceedings of the 9th European Lisp Symposium., 8, European Lisp Scientific Activities Association, pp. 65-72, 9th European Lisp Symposium, Kraków, Poland, 09/05/2016.

Extending Software Transactional Memory in Clojure with Side-Effects and Transaction Control. / Jensen, Søren Kejser; Thomsen, Lone Leth.

Proceedings of the 9th European Lisp Symposium. ed. / Irène Durand. European Lisp Scientific Activities Association, 2016. p. 65-72 8.

Research output: Contribution to book/anthology/report/conference proceedingArticle in proceedingResearchpeer-review

TY - GEN

T1 - Extending Software Transactional Memory in Clojure with Side-Effects and Transaction Control

AU - Jensen, Søren Kejser

AU - Thomsen, Lone Leth

PY - 2016/5/9

Y1 - 2016/5/9

N2 - In conjunction with the increase of multi-core processors the use of functional programming languages has increased in recent years. The functional language Clojure has concurrency as a core feature, and provides Software Transactional Memory (STM) as a substitute for locks. Transactions in Clojure do however not support execution of code with side-effects and provide no methods for synchronising threads. Additional concurrency mechanisms on top of STM are needed for these use cases, increasing the complexity of the code. We present multiple constructs allowing functions with side-effects to be executed as part of a transaction. These constructs are made accessible through a uniform interface, making them interchangeable. We present constructs providing explicit control of transactions. Through these constructs transactions can synchronise threads based on the current program state, abort a transaction, and provide an alternative path of execution if a transaction is forced to restart. eClojure is the implementation of these constructs in Clojure 1.8, and it is tested using an additional set of unit tests. With a series of use cases we show that the addition of these constructs provides additional capabilities to Clojure's STM implementation without violating its ACI properties. Through a usability evaluation with a small sample size we show that using these constructs reduces both the number of lines of code and the development time compared to Clojure 1.8. Last we demonstrate through a preliminary performance benchmark that the addition of these constructs adds only a constant overhead to the STM implementation.

AB - In conjunction with the increase of multi-core processors the use of functional programming languages has increased in recent years. The functional language Clojure has concurrency as a core feature, and provides Software Transactional Memory (STM) as a substitute for locks. Transactions in Clojure do however not support execution of code with side-effects and provide no methods for synchronising threads. Additional concurrency mechanisms on top of STM are needed for these use cases, increasing the complexity of the code. We present multiple constructs allowing functions with side-effects to be executed as part of a transaction. These constructs are made accessible through a uniform interface, making them interchangeable. We present constructs providing explicit control of transactions. Through these constructs transactions can synchronise threads based on the current program state, abort a transaction, and provide an alternative path of execution if a transaction is forced to restart. eClojure is the implementation of these constructs in Clojure 1.8, and it is tested using an additional set of unit tests. With a series of use cases we show that the addition of these constructs provides additional capabilities to Clojure's STM implementation without violating its ACI properties. Through a usability evaluation with a small sample size we show that using these constructs reduces both the number of lines of code and the development time compared to Clojure 1.8. Last we demonstrate through a preliminary performance benchmark that the addition of these constructs adds only a constant overhead to the STM implementation.

KW - Clojure, MVCC, STM, Side-Effects, Transaction Control

UR - https://github.com/skejserjensen/eclojure

M3 - Article in proceeding

SP - 65

EP - 72

BT - Proceedings of the 9th European Lisp Symposium

A2 - Durand, Irène

PB - European Lisp Scientific Activities Association

ER -

Jensen SK, Thomsen LL. Extending Software Transactional Memory in Clojure with Side-Effects and Transaction Control. In Durand I, editor, Proceedings of the 9th European Lisp Symposium. European Lisp Scientific Activities Association. 2016. p. 65-72. 8