Questions tagged [transactional-memory]

In computer science, transactional memory (TM) is a concurrency control mechanism analogous to database transactions for controlling access to shared memory in concurrent computing. It is an alternative to lock-based synchronization. It is typically divided into hardware and software implementations (HTM and STM respectively)

49 questions
32
votes
3 answers

How does Clojure STM differ from Haskell STM?

I am trying to find the differences between what Clojure calls an STM and what is implemented in Haskell as STM. Taking the actual language semantic differences aside I am a little confused as Rich Hickey says in his speech that Clojure's…
yazz.com
  • 52,748
  • 62
  • 227
  • 363
20
votes
2 answers

What advantage does the new feature, "synchronized" block, in C++ provide?

There's a new experimental feature (probably C++20), which is the "synchronized block". The block provides a global lock on a section of code. The following is an example from cppreference. #include #include #include int…
The Quantum Physicist
  • 21,050
  • 13
  • 77
  • 143
17
votes
4 answers

Software Transactional Memory - Composability Example

One of the major advantages of software transactional memory that always gets mentioned is composability and modularity. Different fragments can be combined to produce larger components. In lock-based programs, this is often not the case. I am…
dbyrne
  • 52,081
  • 13
  • 82
  • 102
17
votes
3 answers

What is transactional memory?

I'm confused because from reading the wiki page it seems like just having a checkValidate and commit system for loads and stores. Is the purpose to solve synchronization problems? Is it a software programming thing build on-top of current hardware,…
JDS
  • 14,991
  • 41
  • 142
  • 202
16
votes
5 answers

Will runtimes like CLR and JVM be able to use Haswell TSX instructions?

After reading Anandtech on 'Haswell TSX' (tranactional memory barriers) I immediately wondered if CLR/JVM will be able to make use of these in C#/Java/Scala/F# for heavily parallel applications (C# Rx/TPL/TFD).
yzorg
  • 3,673
  • 3
  • 32
  • 49
15
votes
3 answers

What algorithms are used in Clojure, Haskell (and other languages) for STM?

As I understand there are several different algorithms for implementing Software Transactional Memory (and this is a quite active research area). Where can I find (without having to dive into source code) which are used in different languages and…
Jay
  • 9,293
  • 6
  • 44
  • 67
14
votes
2 answers

A way to form a 'select' on MVars without polling

I have two MVars (well an MVar and a Chan). I need to pull things out of the Chan and process them until the other MVar is not empty any more. My ideal solution would be something like the UNIX select function where I pass in a list of (presumably…
John F. Miller
  • 25,556
  • 8
  • 66
  • 120
14
votes
3 answers

STM monad problem

This is just a hypothetical scenario to illustrate my question. Suppose that there are two threads and one TVar shared between them. In one thread there is an atomically block that reads the TVar and takes 10s to complete. In another thread is an…
Alex
  • 1,451
  • 1
  • 17
  • 29
10
votes
5 answers

Has anyone tried transactional memory for C++?

I was checking out Intel's "whatif" site and their Transactional Memory compiler (each thread has to make atomic commits or rollback the system's memory, like a Database would). It seems like a promising way to replace locks and mutexes but I can't…
Robert Gould
  • 65,529
  • 58
  • 177
  • 269
10
votes
1 answer

How to make Haskell's TChan defer messages like Erlang's message queues can?

Consider the following Erlang code: -module(testit). -export([testit/0]). testit() -> Pid = spawn(fun testit_proc/0), Pid ! final, Pid ! one, Pid ! two, io:format("Root finished~n"). testit_proc() -> receive one …
me2
  • 2,959
  • 2
  • 24
  • 32
7
votes
2 answers

Choosing a consistency model for a concurrent programming language

I am in the design phase of a programming language, currently thinking about the concurrency aspects. I need to figure out a consistency model, i.e. how data is handled by concurrent processes programmed in this language. There are two important…
6
votes
1 answer

mysterious rtm abort using haswell tsx

I'm experimenting with the tsx extensions in haswell, by adapting an existing medium-sized (1000's of lines) codebase to using GCC transactional memory extensions (which indirectly are using haswell tsx in this machine) instead of coarse grained…
orm
  • 2,445
  • 1
  • 17
  • 33
6
votes
3 answers

Is Software Transactional Memory the same as database transactions?

I have read alot about Software Transactional Memory, especially in relation to Haskell but I am trying to figure how it is different from database transactions? Are there some advantages I do not understand with STM?
yazz.com
  • 52,748
  • 62
  • 227
  • 363
5
votes
1 answer

How to add a finalizer on a TVar

Background In response to a question, I built and uploaded a bounded-tchan (wouldn't have been right for me to upload jnb's version). If the name isn't enough, a bounded-tchan (BTChan) is an STM channel that has a maximum capacity (writes block if…
Thomas M. DuBuisson
  • 62,520
  • 7
  • 101
  • 163
5
votes
0 answers

What is transactional memory and what would it change in C++ programming (C++20)

One of the proposed features for C++20 is transactional memory. What is it? Is it going to simplify multithreaded programming in C++?
Nisba
  • 2,502
  • 1
  • 20
  • 39
1
2 3 4