Lost update (source code)

= Lost update

A change that is overwritten by another update based on an older value. In <mutual exclusion>, both <software threads> read $0$ and later write $1$, so one intended increment is lost. This <race condition> can occur with individually atomic reads and writes and therefore need not involve a <data race>. Its repair must cover the complete update, using a <critical section> or an appropriate <atomic read-modify-write>.