I have a particular question in my mind for some moment, let's say I have a schedule like this:
S2(A), R2(A), U2(A), X1(A), W1(A), Commit1(A), U1(A), S2(A), R2(A), U2(A)
Even if I have shared lock and exclusive lock here, I still get different value of A in transaction 2, which happens at the very beginning and ending - since transaction 1 changes value of A in the middle.
In this case, does that mean locks cannot prevent unrepeatable reads at all?
Slocks locks the value of A and wont allow you to set an Xlock so you cant write the new value of A unless you reamove the Slock is removed.
and Xlocks won't allow both reading and writing the value of A unless its removed.