Trouble understanding serializability

From: Stevens <auto87829_at_hushmail.com>
Date: Sun, 13 Jun 2004 22:42:58 +1000
Message-ID: <40cc4bd3$0$11523$afc38c87_at_news.optusnet.com.au>



This is a question out of Database System Concepts by Silberchatz.

Consider the following two transactions, T1 and T2

T1: read(A)

    read(B)
    if A=1 then B:=B-1
    write(B)

T2: read(B)

    read(A)
    if B=1 then A:=A-1
    write(A)

Initial values are A=B=1 and the consistency condition is (A=1) OR (B=1)

The question: is there a concurrent execution of T1 and T2 that produces a serializable schedule? Prove your answer.

Now to me this is confusing ... you'd only have to ensure the T1 reads(A) before T2 writes(A) or T2 reads(B) before T2 writes(B). No other operations seem to conflict. What's the answer to this?

Cheers,

David Received on Sun Jun 13 2004 - 14:42:58 CEST

Original text of this message