1 1 vote Databases databases transaction-and-concurrency + – neha pawar 2.8k views answer comment Share Follow Print 0 reply Please log in or register to add a comment.
Best answer 4 4 votes Lost update problem is really simple. Deposit (10) A = A+10; View Balance: print A Now, suppose initial balance A is 100 someone deposits 20 by calling Deposit(10) two times and then called View Balance to view the updated balance. If they are called sequentially no problem here. But suppose they are called concurrently: Suppose in first call to Deposit, A = A + 10; Here, A is read, 10 is added to it and A+10 is stored back to A. Similarly happens in next call to Deposit. But if the read of A in second happens before the final store to A in first call, the first call of Deposit has no effect. The update done by first Deposit is lost (when the second Deposit stores the value it will be 110 and not 120 as it has read 100 instead of 110)- and this is called Lost update problem. WW problem Arjun answered Nov 4, 2014 • selected Dec 11, 2015 by Akash Kanase Arjun comment Share Follow See all 5 Comments 5 5 Comments reply Show 2 previous comments Shubhanshu commented Oct 22, 2017 reply Follow flag @Arjun Sir, from the Deposit example what I get is the following story:- Initially the data variable A = 100. Sequentially means same transaction same data item:- Transaction T1 reads the data item A = 100, from the Data base file stored in Disk. and make it A = A + 10 i.e. A = 100 + 10 finally A = 110, Now, if T1 again wants to call deposit 10 it will read A from the buffer not from the data file stored in the Disk. and add 10 to it. So, finally A = 110. NO PROBLEM WORKS FINE. Concurrent schedule means different transactions same data item:- T1 reads A as 100, add 10 to it makes A = 110 stored in the buffer but not in the disk because this transaction is not COMMITTED till now. As a result A = 100 in the Disk database file. T2 reads A as 100, from the disk database file, not from the buffer of T1, {Please correct this if it is wrong :- BECAUSE BUFFERS ARE LOCAL TO TRANSCATION} add 10 to it finally, make it A = 110 stores into the buffer not in the disk, At this stage If T1 commit after T2 commit then T2 update lost, or if T2 commit after then T1 commit then T1 update lost. Which leads to Lost update problem. Solution:- Strict Recoverable Schedule. 0 0 replyShare Subbu. commented Jan 28, 2022 reply Follow flag @Arjun R(A) W(A) R(A) W(A) will it comes under lost update ??. 0 0 replyShare Subbu. commented Jan 28, 2022 reply Follow flag @Arjun R(A) W(A) R(A) W(A) will it comes under lost update ??. 0 0 replyShare Please log in or register to add a comment.