CMSC661 - Homework Assignment 5

Due November 28 beginning of class

(Late homework will not be accepted; all homework must be done independently)

Following problems are from Ullman Text.

Page 535: 9.1, 9.2, 9.3
Page 536: 9.6, 9.7
Page 539: 9.23, 9.26

Problem: Consider the following two transactions:
 
                    T1 :     read(A);
                                 read(B);
                                 if A = 0 then B := B + 1;
                                 write(B).
                    T2 :      read(B);
                                  read(A);
                                  if B = 0 then A := A + 1;
                                  write(A).

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

(a) Show that every serial execution involving these two transactions preserves the consistency of the database.

(b) Show a concurrent execution of T1 and T2 that produces a nonserializable schedule.

(c) Is there a concurrent execution of T1 and T2 that produces a serializable schedule.