skip to main content
10.1145/3546189.3549924acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Open transactional actions: interacting with non-transactional resources in STM Haskell

Published: 06 September 2022 Publication History

Abstract

This paper addresses the problem of accessing external resources from inside transactions in STM Haskell, and for that purpose introduces a new abstraction called Open Transactional Actions (OTAs) that provides a framework for wrapping non-transactional resources in a transactional layer. OTAs allow the programmer to access resources through IO actions, from inside transactions, and also to register commit and abort handlers: the former are used to make the accesses to resources visible to other transactions at commit time, and the latter to undo changes in the resource if the transaction has to roll back. OTAs, once started, are guaranteed to be executed completely before the hosting transaction can be aborted, guarantying that if a resource is accessed, its respective commit and abort actions will be properly registered. We believe that OTAs could be used by expert programmers to implement useful system libraries and also to give a transactional semantics to fast linearizable data structures, i.e., transactional boosting. As a proof of concept, we present examples that use OTAs to implement transactional file access and transactional boosted data types that are faster than pure STM Haskell in most cases.

References

[1]
2022. atomic-primops: A safe approach to CAS and other atomic ops in Haskell. WWW page, https://hackage.haskell.org/package/atomic-primops-0.6.
[2]
2022. Fair Read/Write Locks. WWW page, https://hackage.haskell.org/package/SafeSemaphore-0.10.1/docs/Control-Concurrent-FairRWLock.html.
[3]
2022. flock Man Page. WWW page, https://man7.org/linux/man-pages/man2/flock.2.html.
[4]
2022. Open Transactional Actions. WWW page, https://github.com/researchanon/ota.
[5]
2022. The Glasgow Hasekll Compiler. WWW page, https://www.haskell.org/ghc/.
[6]
Kunal Agrawal, I-Ting Angelina Lee, and Jim Sukha. 2009. Safe Open-Nested Transactions through Ownership. In Proceedings of the 14th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP ’09). Association for Computing Machinery, New York, NY, USA. 151–162. isbn:9781605583976 https://doi.org/10.1145/1504176.1504200
[7]
Takano Akio. 2022. System.FileLock library. WWW page, https://hackage.haskell.org/package/filelock-0.1.1.5/docs/System-FileLock.html.
[8]
Lee Baugh and Craig Zilles. 2008. An Analysis of I/O And Syscalls In Critical Sections And Their Implications For Transactional Memory. In ISPASS 2008 - IEEE International Symposium on Performance Analysis of Systems and software. 54–62. https://doi.org/10.1109/ISPASS.2008.4510738
[9]
Annette Bieniusa. 2010. Twilight in Haskell: Software Transactional Memory with Safe I/O and Typed Conflict Management. Draft proc. of IFL.
[10]
Annette Bieniusa. 2011. Consistency, Isolation, and Irrevocability in Software Transactional Memory. Ph. D. Dissertation. Albert-Ludwigs-Universität Freiburg im Breisgau.
[11]
Lewis E.C. Martin M. Blundell, C. 2006. Unrestricted transactional memory: Supporting i/o and system calls within transactions. Technical Report CIS-06-09, University of Pennsylvania, Department of Comp. and Info. Science.
[12]
André Rauber Du Bois, Maurício Lima Pilla, and Rodrigo Medeiros Duarte. 2014. Transactional Boosting for Haskell. In Programming Languages - 18th Brazilian Symposium, SBLP 2014, Maceio, Brazil, October 2-3, 2014. Proceedings, Fernando Magno Quintão Pereira (Ed.) (Lecture Notes in Computer Science, Vol. 8771). Springer, 145–159. https://doi.org/10.1007/978-3-319-11863-5_11
[13]
Alejandro Buchmann. 2009. Open Nested Transaction Models. Springer US, Boston, MA. 1978–1981. isbn:978-0-387-39940-9 https://doi.org/10.1007/978-0-387-39940-9_717
[14]
Rodrigo Medeiros Duarte, André Rauber Du Bois, Maurício Lima Pilla, Gerson Geraldo H. Cavalheiro, and Renata Hax Sander Reiser. 2019. Comparing the performance of concurrent hash tables implemented in Haskell. Science of Computer Programming, 173 (2019), 56–70.
[15]
Keir Fraser. 2004. Practical Lock-Freedom. Ph. D. Dissertation. Computer Laboratory, University of Cambridge.
[16]
Tim Harris. 2005. Exceptions and side-effects in atomic blocks. Science of Computer Programming, 58, 3 (2005), 325–343. issn:0167-6423 https://doi.org/10.1016/j.scico.2005.03.005 Special Issue on Concurrency and synchonization in Java programs
[17]
Tim Harris, James Larus, and Ravi Rajwar. 2010. Transactional Memory, 2nd edition. Morgan and Claypool Publishers.
[18]
Tim Harris, Simon Marlow, Simon Peyton Jones, and Maurice Herlihy. 2005. Composable Memory Transactions. In PPoPP’05. ACM Press.
[19]
Ahmed Hassan, Roberto Palmieri, and Binoy Ravindran. 2014. Optimistic Transactional Boosting. In Proceedings of the 19th ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming (PPoPP ’14). Association for Computing Machinery, New York, NY, USA. 387–388. isbn:9781450326568 https://doi.org/10.1145/2555243.2555283
[20]
Maurice Herlihy and Eric Koskinen. 2008. Transactional Boosting: A Methodology for Highly-Concurrent Transactional Objects. Proceedings of the ACM SIGPLAN Symposium on Principles and Practice of Parallel Programming, PPOPP, 207–216.
[21]
Maurice Herlihy, Victor Luchangco, Mark Moir, and William N. Scherer. 2003. Software Transactional Memory for Dynamic-Sized Data Structures. PODC ’03. ACM, 92–101.
[22]
Marino Miculan, Marco Peressotti, and Andrea Toneguzzo. 2015. Open Transactions on Shared Memory. In DISCOTEC.
[23]
Yang Ni, Vijay S. Menon, Ali-Reza Adl-Tabatabai, Antony L. Hosking, Richard L. Hudson, J. Eliot B. Moss, Bratin Saha, and Tatiana Shpeisman. 2007. Open Nesting in Software Transactional Memory. PPoPP ’07. Association for Computing Machinery, New York, NY, USA. 68–78. isbn:9781595936028
[24]
Nehir Sönmez, Cristian Perfumo, Srdjan Stipic, Adrián Cristal, Osman S. Unsal, and Mateo Valero. 2007. unreadTVar: Extending Haskell Software Transactional Memory for Performance. In Proceedings of the Eighth Symposium on Trends in Functional Programming, TFP 2007, New York City, New York, USA, April 2-4. 2007, Marco T. Morazán (Ed.) (Trends in Functional Programming, Vol. 8). Intellect, 89–104.
[25]
Martin Sulzmann, Edmund S.L. Lam, and Simon Marlow. 2009. Comparing the Performance of Concurrent Linked-List Implementations in Haskell. In Proceedings of the 4th Workshop on Declarative Aspects of Multicore Programming (DAMP ’09). Association for Computing Machinery, New York, NY, USA. 37–46.
[26]
Haris Volos, Andres Jaan Tack, Neelam Goyal, Michael M. Swift, and Adam Welc. 2009. XCalls: Safe I/O in Memory Transactions. In Proceedings of the 4th ACM European Conference on Computer Systems (EuroSys ’09). Association for Computing Machinery, New York, NY, USA. 247–260. isbn:9781605584829 https://doi.org/10.1145/1519065.1519093
[27]
Thomas Zimmermann. 2009. Transactional Execution of System-Library Functions. Ph. D. Dissertation. Diploma Thesis, Dresden University of Technology.

Index Terms

  1. Open transactional actions: interacting with non-transactional resources in STM Haskell

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Conferences
      Haskell 2022: Proceedings of the 15th ACM SIGPLAN International Haskell Symposium
      September 2022
      136 pages
      ISBN:9781450394383
      DOI:10.1145/3546189
      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 the author(s) 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].

      Sponsors

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 06 September 2022

      Permissions

      Request permissions for this article.

      Check for updates

      Author Tags

      1. Haskell
      2. functional programming
      3. transactional boosting
      4. transactional memory

      Qualifiers

      • Research-article

      Conference

      Haskell '22
      Sponsor:
      Haskell '22: 15th ACM SIGPLAN International Haskell Symposium
      September 15 - 16, 2022
      Ljubljana, Slovenia

      Acceptance Rates

      Overall Acceptance Rate 57 of 143 submissions, 40%

      Upcoming Conference

      ICFP '25
      ACM SIGPLAN International Conference on Functional Programming
      October 12 - 18, 2025
      Singapore , Singapore

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • 0
        Total Citations
      • 127
        Total Downloads
      • Downloads (Last 12 months)3
      • Downloads (Last 6 weeks)0
      Reflects downloads up to 19 Feb 2025

      Other Metrics

      Citations

      View Options

      Login options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Figures

      Tables

      Media

      Share

      Share

      Share this Publication link

      Share on social media