Software Transactional Memory
- Enclose transactional code inside
atomic
block
- Create a transaction data structure (a log)
- Instrument all reads and writes inside the
atomic
block
- At the end of the block, try to atomically commit the transaction. If fails, retry.
- Commit can only fail, if another transaction successfully committed (overwrote shared memory)
- Guaranteed progress
- No deadlocks (non-blocking)
- Disjoint access parallelism (no contention for disjoint access)