Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

A transaction schedule is serializable if its effect is equivalent to that of so

ID: 3630492 • Letter: A

Question

A transaction schedule is serializable if its effect is equivalent to that of some serial schedule. Consider a bookkeeping operation consisting of 2 transactions, T1 and T2, that are required to keep the sum A + B + C unchanged. Which of the following pairs of transactions will always result in a serializable schedule?

I) T1-> Lock A; A = A - 10; Unlock A; B = B + 10; T2-> Lock B; B = B - 20; Unlock B; C = C + 20;
II) T1-> A = A - 10; Lock B; B = B + 10; Unlock B; T2-> Lock B; B = B - 20; Unlock B; C = C + 20;
III) T1-> Lock A; A = A - 10; Unlock A; B = B + 10; T2-> Lock A; B = B - 20; Unlock A; C = C + 20;

The answer is that II results in a serializable schedule, and that I and III don't. Can someone give a clear explanation why, because I'm not understanding what's going on. Thanks.

Explanation / Answer

The objective of the transaction schedule should be such the end result is as if the 2 transactions were scheduled one after the other. That is, the end result should be that A+B+C should be unchanged no matter how the two transactions are scheduled. Now consider the 1st schedule : For both T1 and T2 the variable "B" is being modified and hence "B" is a shared resource. But in T1, B is being modified outside of the "critical" section since it is not protected by any kind of mutual exclusion lock. So if two threads were to execute T1 and T2 simultaneously, the results would be non-deterministic. Hence, the end result A+B+C would be non-deterministic Same is the case with the 3rd schedule. Only the second schedule ensures that modifications to "B" are serialized hence ensuring that the final value of B is deterministic. This is done by using a mutual exclusion lock before modifying the shared resource "B". Hence, the value of A+B+C will be unchanged no matter how the transactions are scheduled.

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote