A transaction is just an abstraction: it is a form of looking at concurrency that satisfies these four constraints which are useful for the programmer, but gives you less fine grained control over locks (illustrated later).
The atomicity reminds me of Solidity programming, where if a transaction fails, it's as if the transaction never happened. This is a useful abstraction for the programmer. How is atomic optimized for runtime under the hood, while achieving all of these four properties?
On a related note, in the database world, transactions are meant to be ACID (Atomic, Consistent, Isolated, and Durable). Interestingly, while serializability here maps to being consistent, there is no notion of thread memory transactions being durable (persistent even after the program terminates or power is lost suddenly). This is because all updates are ultimately made to main memory, not to disk/persistent storage, and main memory is usually volatile and non-persistent.
A lot of the terminology and semantics here of transactions reminds me of how GitHub works (i.e. memory transactions are code commits, isolation is much like a branch, and serializiability is met when branches are merged). Its helpful for me to think about transactional memory in this context.
Please log in to leave a comment.
Kayvon's answer to the question "how are isolation and serialization different":