Professional Documents
Culture Documents
Dbms S4
Dbms S4
Solutions
1. Consider the following schedule:
S1: R1 (A); R1(C); R2 (B); W2 (B); R3 (B); R1 (A); R3(C); W3(C); W1 (A)
S2: R2 (A); R1(C); R2 (B); R3 (B); W2 (B); R1 (A); R3(C); W3(C); W1 (A)
1
In the above precedence graph cycle is present. Therefore S2 is not conflict serializable.
How many minimum number of moves (where a move consisting of changing the position of
one of the operations) are required to convert S into a conflict serializable schedule?
(a) 1 (b) 2
(b) 3 (d) 4
If W1 (B) is shifted after r1 (B) then the schedule is r2(A), r1(B), w1(B), w2(A), r2(B), r3(A),
w3(A), w2(B),then precedence graph becomes:
2
Now S is serializable schedule.
3. Consider 2 schedules S1 and S2 with same set of transactions and precedence graph of S1 is
(a) Both S1 and S2 are conflict equal and conflict serializable schedule
(b) Both S1 and S2 are conflict equal but may not conflict serializable schedule
(c) Both S1 and S2 are conflict equal but may not equal schedules
(d) Both S1 and S2 are conflict equal and but may not view equivalent
Both S1 and S2 are conflict equal but may not conflict serializable schedule.
S1: r1(x), r2(z), r1(z), r3(x), r3(y), w1(x), C1, w3(y), C3, r2(y), w2(y), w2(z), C2
S2: r1(x), r2(z), r1(z), r3(x), r3(y), w1(x), w3(y), r2(y), w2(z), w2(y), C1, C2, C3
S3: r1(x), r2(z), r3(x), r1(z), r2(y), r3(y), w1(x), C1, w2(z), w3(y), w2(y), C3, C2
We know that in recoverable, if Ti reads a value written by Tj, then Ti must commit after Tj
commits.
In S2: w3(y) is first and r2(y) appears second. Hence, C2 should appear after C3.But here
C3 is appearing after C2. So, S2 is not recoverable. S1 and S3 are recoverable.
3
5. For the given schedule which of the following statement is true?
S: R4(A), R2(A), R3(A), W1(B), W2(C), R4(B), W2(B)
How many operations (Read/ Write) can be placed in ‘X’ to make ‘S’, not conflict
serializable?
Solution: 3
How many conflict equal serial schedules are possible with the above schedule?
Solution: 1
4
LINKED QUESTIONS: Q.8 AND Q.9
Based on a simple relation TA(SID, CID, Stipend) stores TA assignments and stipends. TA’s
are identified by their student ID’s (SID’s). Consider the following, if transaction executed by
2 different clients at approximately the same time.
T1 T2
Before either transaction starts, there is a tuple (987, ‘CS145’, 1900) in TA.
8. Suppose T1 executes with isolation level READ COMMITTED and T2 executes with isolation
level READ UNCOMMITTED. Which one of the following figures cannot be a possible final
stipend value for TA987?
5
9. Now, suppose instead that T1 executes with isolation level. Repeatable Read and T2 executes
with isolation level Read Committed. Which one of the following figures cannot be a possible
value forTA987?
2000 and 2300 are still possible, but 2200 is not, because T2 cannot get in between
T1.step1 and T1.step2 to read the uncommitted value written by T1.step1.
11. Which of the following is TRUE with regards to the correct answer for the above question?
12. Which among the following 2-phase locking protocols is a deadlock free?
6
Solution: Option (d)
Given below are some transaction schedules that involve three transactions:
T1-T2-T3
Schedule 1:
T2: Rx, T2: Ry, T1: Wx, T3: Wy, T3: Wz, T1: Rz, T2: Wy
Schedule2:
T2: Rx, T2: Wy, T3: Ry, T3: Wx, T1: Wy, T3: Rx, T1: Ry, T2: Wy
Schedule 3:
T1: Rx, T2: Ry, T3: Wy, T2: Rz, T3: Rz, T1: Wz, T1: Wy, T2: Wy
Schedule 4:
T1: Rx, T3: Wy, T2: Rz, T3: Rz, T1: Wy, T2: Wx, T1: Ry, T2: Wz
14. For the conflict serializable schedule found in the previous question, the equivalent serial
schedule possible:
15. Which of the following is True about the given schedule ‘S’?
T1 T2
7
R(A)
A=A+100
R(A)
A=A*2
W(A)
W(A)
R(B)
B= B/2
W(B)
R(B)
B= B-100
W(B)
The given schedule is not serializable, since it is not conflict serializable, not view
serializable.
8
Refer the videos.
T1 T2
Read(A)
Write(A)
Read(A)
Commit
Read(A)
Abort
Refer the videos. As the value of a data is read by transaction who has committed
but thereafter the transaction, which changed the value of data got aborted, so it is
Irrecoverable schedule.
18. There are 2 transactions, T1 with 2 instructions and T2 with 5 instructions. Find the number of
serialand concurrent schedules respectively.
5+2 !
No. of concurrent schedules= =21
5! 2!
19. Which of the following statements are true about recoverable and cascadeless schedules?
9
(R) All strict schedules are cascadeless and recoverable
(S) All cascadeless and recoverable schedules are strict schedule
10