Dbms S5
Dbms S5
Dbms S5
Solutions
1. Consider three data items D1, D2 and D3 and D3 and the following execution schedule of
transactions T1, T2 and T3. In the diagram, R(D) and W(D) denotes the actions reading and
writing the data item D respectively.
T1 T2 T3
R(D3);
R(D2);
W(D2);
R(D2);
R(D3);
R(D1);
W(D1);
R(D1);
R(D2);
W(D2);
W(D1);
(a) The schedule is serializable as T2; T3; T1 (b) The schedule is serializable as T2; T1; T3
(c) The schedule is serializable as T3; T2; T1 (d) The schedule is not serializable
read(x);
x:= x-50;
write(x);
read(y);
y:=y+50;
write(y);
The constraint that the sum of the accounts x and y should remain constant is that of:
1
Solution: Option (b)
3. Consider the following partial schedule S involving 2 transactions T1 and T2. Only the read
and write operations have been shown. The read operation on data item P is denoted by r(P)
and write by w(P):
Transaction_id
Time
T1 T2
1 r(A)
2 w(A)
3 r(C)
4 w(C)
5 r(B)
6 w(B)
7 r(A)
8 Commit
9 r(B)
Suppose that the transaction T1 fails immediately after time instance 9. Which one of the
following statements is correct?
(a) T2 must be aborted and then both T1 and T2 must be restarted to ensure transaction
atomicity
(b) Schedule S is non-recoverable and cannot ensure transaction atomicity
(c) Only T2 must be aborted and then restarted to ensure transaction atomicity
(d) Schedule S is recoverable and can ensure atomicity and nothing else needs to be done
4. How many concurrent schedules can be formed with 3 transactions having 3, 2, 1 operations?
Solution: 60
3+2+1 !
Using the formula-→ =60
3!2!1!
2
COMMON DATA QUESTIONS
(a) S1 (b) S2
(c) S1, S2 (d) None of these
S: r1(a), r2(b), w2(a), w2(b),w3(a), r3(c), w3(b), r1(c), w4(b), w3(c), r4(a), r4(c), w4(c); commit1,
commit2, commit3, commit4
3
(a) S is conflict serializable with sequence <T1 T2 T3 T4>
(b) S is view serializable but not conflict serializable
(c) S is neither conflict serializable nor view serializable
(d) S is conflict serializable with <T2 T1 T3 T4>
9. The time stamp of 2 transactions T1 and T2 are 10 and are 10 and 15 respectively. Consider
the following with T1 and T2 operations.
(a) S holds in Basic time stamp protocol (b) S holds under Thomas Write rule
(c) Both A and B (d) None of these
10. Which problem among the following is encountered in the given schedule?
T1 T2
R(A)
R(B)
B=A
W(B)
R(A)
A= A+10
W(A)
Commit
R(A)
R(C)
C=A
W(C)
4
11. Consider the following scenarios:
T1 T2
R(A)
R(B)
R(C)
R(A)
R(B)
P:___
Q:___
R(C)
The possible values of P and Q allowed under Thomas Write Rule but not under basic time
stamp ordering protocol if TS(T2) > TS(T1)
Which of the following is the valid locking sequence for true based protocol?
5
Solution: Option (c)
T1 T2
R(A)
A=A+10
R(B)
A=B+10
W(A)
R(B)
B=B+10
R(A)
B=A+10
W(B)
Commit
Commit
14. The precedence graph of a schedule with 3 transactions T1, T2, T3 is:
6
7