Vous êtes sur la page 1sur 2

Exercise: Transactions

Name: ___________________________________
Section: ___________________________________

1. Consider the following transactions:

T1: read(A) T2: read(B)


read(B) read(A)
if A = 0 then B := B + 1 if B = 0 then A := A + 1
write(B) write(A)

Let the consistency requirement be A = 0 or B = 0, with A = B = 0 as the initial values.

a. Does every serial schedule involving these two transactions preserve the consistency of
the database? Yes No (Encircle only one answer.)
b. Is there a concurrent execution of T1 and T2 that produces a serializable schedule?
Yes No (Encircle only one answer.)

2. Consider the precedence graph below.

Is the corresponding schedule conflict serializable?

Yes No (Encircle only one answer.)

If you answered yes to the question above, write down


the equivalent serial schedule(s) on the space below.
3. Consider the following schedule:

T1 T2 T3
read(X)
read(Z)
read(Z)
read(X)
read(Y)
write(X)
write(Y)
read(Y)
write(Z)
write(Y)

Draw the precedence graph for the schedule on Is the schedule conflict serializable?
the space below.
Yes No (Encircle only one answer.)

If you answered yes to the question above,


write down the equivalent serial schedule(s) on
the space below.

Vous aimerez peut-être aussi