incremented value back to the memory location; release the lock. This strategy works as expected; the lock prevents other threads from updating the value until it is released. However, when compared with direct use of atomic operations, it can suffer from significant overhead due to lock contention. To improve program performance, it may therefore be a good idea to replace simple critical sections with atomic operations for non-blocking synchronization (as we have just done for the counter with compare-and-swap and fetch-and-increment), instead of the other way around, but unfortunately a significant improvement is not guaranteed and lock-free algorithms can easily become too complicated to be worth the effort. See also Atomic transaction Consistency model ACID Read-copy-update (RCU) Read-modify-write Time of check to time of use References Further reading Consistency models Transaction processing Concurrency control