6
write(T1, balx), read(T2, balx), write(T1, balx), commit(T2), abort(T1)

I'm revising for an exam and these are one of the questions that I've been looking over on the mock paper.

According to the Marking Scheme the answer is that the transaction is serializable. But I just don't understand how.

T1 and T2 get trapped in a cycle as T1 points to T2 and then point backs to T1 in a precedence graph, therefore not making it serializable. Is the marking wrong or am I missing something here?

Jacinda
  • 4,932
  • 3
  • 26
  • 37

1 Answers1

2

I think the key thing here is that T1 abort. If I am no mistaken until a transactions commits then it is safe to assume the disk has not been modified. Which means when T1 aborts the state of the database was the same as because this sequence of operation. And this is the T2 is viewing.

Thus, if we had

write(T1, balx), write(T1, balx), abort(T1), read(T2, balx), commit(T2)
read(T2, balx), commit(T2), write(T1, balx), write(T1, balx), abort(T1)

Then the state of the database and of the transactions T2 will be the same as the one in your example. Now if T1 had committed, you will be correct by evoking the precedence graph.

UmNyobe
  • 22,539
  • 9
  • 61
  • 90