How does software transactional memory (STM) work?
STM is a run-time library that manages memory accesses executed inside transactions. The run-time library ensures that the memory state of a transaction is visible to other threads only after the transaction commits. The run-time library relies on the compiler to instrument memory references in transactions into STM run-time calls to be monitored by the run-time environment.