(normally used in the context of databases) Lost updates can happen if two or more processes (or transactions) read and write a piece of data at nearly the same time. Imagine the standard example, a banking account database on which two transactions concurrently run. One adds the value of a check you have given to your bank to cash it in, the other deducts the amount you just got from the ATM. Assume the following execution order:

check transaction               ATM transaction
=================               ===============
float temp=Account.value;
temp+=Check.value;

                                float temp=Account.value;
                                temp-=ATM.withdrawnAmount;

Account.value=temp;

                                Account.value=temp;

Well, the bad news is, you just lost the money you received via the check. Why? ATM transaction reads the amount of money in your account before check transaction had written it. But the update later written by check transaction is immediately overwritten by ATM transaction. You can see that to avoid this problem check transaction had to be executed completely before or completely after ATM transaction. This is called serial execution and the general theory behind it is called serializability.

A lost update is one of the possible effects of a race condition.

Log in or registerto write something here or to contact authors.