Software transactional memory (STM) is a mechanism for synchronization in concurrent programming, which can perform groups of memory operations atomically. Using transactional memory (implemented by optimistic synchronization) instead of locks removes the risk of a deadlock.
Questions tagged [stm]
190 questions
0
votes
1 answer
Understanding stress-ref in The Joy of Clojure Chapter 11
I can't completely understand the behaviour of `stress-ref' in The Joy of Clojure 11.2.5. My question is, why the reading of r require a large history?

kbridge4096
- 901
- 1
- 11
- 22
0
votes
2 answers
How to get long running transactions to fail fast in clojure
Assuming that the ref in the following code is modified in other transactions as well as the one below,
my concern is that this transaction will run until it's time to commit, fail on commit, then re-run the transaction.
(defn modify-ref [my-ref]
…

Jason
- 11,709
- 9
- 66
- 82
0
votes
2 answers
How to write F# stm as >>= pipeline
Can somebody please explain how to write this FSharpx stm as a pipeline?
stm {
let! allTops = readTVar tAllTops
let! thisPlayerTops = mapM removeOtherPlayersScores allTops
let! markedTops = mapM markAsNonEmpty…

vidi
- 2,056
- 16
- 34
0
votes
1 answer
Clojure STM: non consistent remove
Consider a very simple hashtable, with the following structure:
(defn make-hashtable
[cap]
(let
[tablesize (int (Math/ceil (* cap 1.30)))]
{:tablesize tablesize
:capacity cap
:size (ref 0)
:vector (vec (map (fn [_]…

froginvasion
- 833
- 6
- 19
0
votes
0 answers
Is deuce STM type safe?
I have written a JAVA library for pi calculus which utilizes Deuce STM for managing concurrent processes.
I further wish to prove the type safety of my library.
Is Deuce STM library type safe? If yes, some links for the same would be appreciated.

tranquil
- 499
- 7
- 13
0
votes
1 answer
Measuring TChan length
I need to store a buffer of some values in STM. Writer threads need to monitor the buffer's size. I started to implement this thing using TChan but than I found out that the API does not provide a way to measure the length of the channel. Being a…

Nikita Volkov
- 42,792
- 11
- 94
- 169
0
votes
1 answer
Selective send on TChan?
AFAIK TChan acts as a hub, every message sent is seen by others right ?!
i want a TChan that acts as a switch to send a message to specific thread, and also support broadcasting.
is there such thing ?

user1748906
- 526
- 4
- 13
0
votes
1 answer
Functional Banana Traveller - Input Handling
This is a sub-problem from my Traveller project.
I've put together the rudementary code that will handle input. It works, until I introduce a TChan to the mix. Below is the working code, with an example of how to use it. Then, I will change it and…
user1198582
-1
votes
1 answer
TVar constructor? I can't get a TVar
I'm new at Haskell and stm and I wanted to make a simple rwlock. First I created the 4 main functions (wlock, wunlock, rlock, runlock) that requires 2 TVar Integers: the amount of reading threads and writing threads.
At this point I can't use it as…

Pernoctador
- 108
- 8
-2
votes
1 answer
Haskell STM : How to implement Obstruction Free STM using Haskell?
I want to implement Obstruction Free STM (OFTM) using Haskell to benchmark various available contention management policies. For example, a Transaction T1 acquires a Tvar, say X and yet to commit. Now another Transaction T2 wants to access X. In…

Ammlan Ghosh
- 365
- 3
- 12