December 2 Answer 1 - ndgriffeth/Class-Notes-and-Lectures GitHub Wiki
No. Suppose someone is transferring money from Account 7 to Account 8. This requires two database updates, one to subtract from account 7 and the other to add to Account 8. Meanwhile, suppose the bank is preparing a report that includes the total amount of all the accounts in the bank. Then the actions could take place in the following order:
Report: Set report total to 0. Report: Read account 1 and add amount to report total. ... Report: Read account 6 and add amount to report total. Transfer: Subtract $100 from Account 7. Report: Read account 7 and add amount to report total. Report: Read account 8 and add amount to report total. Transfer: Add $100 to Account 8. Report: Read account 9 and add amount to report total. ... Print report total.
The transfer will be done correctly, but the amount printed will be wrong -- in fact, will understate the amount in the bank by $100.