September 2016
Intermediate to advanced
408 pages
9h 18m
English
Software Transactional Memory (STM) is the highest-level general concurrency abstraction we will consider. STM provides composable atomic transactions, meaning we can combine reads, writes, and other operations in multiple memory locations into single atomic operations. Transactions can be aborted or retried.
An STM transaction lives in the STM monad:
data STM a instance Monad STM
Transactions are performed with the atomically function:
atomically :: STM a → IO a
Another important primitive is the retry function, which aborts the current transaction and retries it when some of its dependencies have changed (in some other transaction in another thread):
retry :: STM a
Basic transactional variables are provided by the STM ...
Read now
Unlock full access