logo

Quotes About Atomicity

Locking can guarantee both visibility and atomicity; volatile variables can only guarantee visibility.
~ Brian Goetz
it is a common misconception that synchronized is only about atomicity or demarcating "critical sections". Synchronization also has another significant, and subtle, aspect: memory visibility. We want not only to prevent one thread from modifying the state of an object when another is using it, but also to ensure that when a thread modifies the state of an object, other threads can actually see the changes that were made.
~ Brian Goetz
The other end-run around the need to synchronize is to use immutable objects [EJ Item 13]. Nearly all the atomicity and visibility hazards we've described so far, such as seeing stale values, losing updates, or observing an object to be in an inconsistent state, have to do with the vagaries of multiple threads trying to access the same mutable state at the same time. If an object's state cannot be modified, these risks and complexities simply go away. An
~ Brian Goetz
Clauses in a smart contract can cause a transaction to fail and thereby revert all previous steps of the transaction; as a result, transactions are atomic. Atomicity is a critical feature of transactions because funds can move between many contracts (i.e., exchange hands) with the knowledge and security that if one of the conditions is not met, the contract terms reset as if the money never left the starting point.
~ Campbell R. Harvey