Solutions for Exercise no. 11

From "Database System Concepts"

13.1 See the text in the book
Answer:

13.6 See the text in the book
Answer:
A schedule in which all the instructions belonging to one single transaction appear together is called a serial schedule. A serializable schedule has a weaker restriction that it should be equivalent to some serial schedule. There are two definitions of schedule equivalent - conflict equivalent and view equivalent.

13.7 See the text in the book
Answer:
A: There are two possible executions T1, T2 and T2, T1
Case 1:
 
A B
Initially 0 0
After T1 0 1
After T2 0 1

Consistency met: A = 0 Ú B = 0 º T Ú F = T

Case 2:
 
A B
Initially 0 0
After T1 1 0
After T2 1 0

Consistency met: A = 0 Ú B = 0 º T Ú F = T

B: Any interleaving of  T1 and T2 results in a non-serializable schedule.
 
 
T1 T2
read (A)
 

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

write (B)


read (B) 
read (A) 
 

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

C: There is no parallel execution resulting in a serializable schedule. From part a, we know that a serializable schedule results in A=0 or B=0. Suppose we start with T1 read (A). Then when the schedule ends, no matter when we run the steps of T2, B=1. Now suppose we start executing T2 prior to completion of T1. Then T2 read (B) will give B a value of 0. So when T2 completes, A=1. Thus B=1 Ù A=1 ® Ø (A=0 Ú B=0). Similar for starting with T2 read (B)
 

13.9 See the text in the book
Answer:
There is a serializable schedule corresponding to the precedence graph in Figure 13.24, since the graph is acyclic. A possible schedule is obtained by doing a topological sort, that is T1, T2, T3, T4, T5

13.11 See the text in the book
Answer:
A recoverable schedule is one where, for each pair of transactions Ti and Tj such that Tj reads data items previously written by Ti, the commit operation of Ti appears before the commit operation of Tj. Recoverable schedules are desirable because failure of a transaction might otherwise bring the system into an irreversibly inconsistent state. Non recoverable schedules may sometimes be needed when updates must be made visible early due to time constraints, even if they have not yet been committed, which may be required for very long duration transactions.


Best regards,
Kristian Torp