Question # 1 (28 Points) Given the following twotransactions, order the operatio
ID: 3608558 • Letter: Q
Question
Question # 1 (28 Points)
Given the following twotransactions, order the operations within these transactions inorder to demonstrate the following problems of Lost Updates andDirty Read. Indicate the wrong value of x, and the correct value ofx for the offending operation or output.
T1
T2
read(x)
read(x)
x _ x+ 1
x _ x+ 1
write(x)
write(x)
read(x)
x _ x+ 1
abort(T1) orcommit(T1)
write(x)
commit(T2)
T1
T2
read(x)
read(x)
x _ x+ 1
x _ x+ 1
write(x)
write(x)
read(x)
x _ x+ 1
abort(T1) orcommit(T1)
write(x)
commit(T2)
Explanation / Answer
T1
T2
read(x)
x _ x+ 1
write(x)
read(x)
x _ x+ 1
write(x) //here lost of x occur, written by T1
x _ x+ 1
write(x)
commit(T2)
T1
T2
read(x)
x _ x+ 1
write(x)
read(x) //It is dirty read, as previous x will belost because of T1 abort.
x _ x+ 1
write(x)
x _ x+ 1
write(x)
commit(T2)
T1
T2
read(x)
x _ x+ 1
write(x)
commit(T1)
read(x)
x _ x+ 1
write(x) //here lost of x occur, written by T1
x _ x+ 1
write(x)
commit(T2)