You are on page 1of 3

Question 1: [2.

5 marks]

Consider the following schedule:


S1: R1(A), R3(B), R3(C), W1(B), W2(C), W3(D)
Assuming that shared locks are requested immediately before each read action and
exclusive locks are requested immediately before each write action. Also, unlocks
occur immediately after the final action that a transaction executes. Show what
happens under the Wait-die deadlock avoidance system.
Hint (T1 older than T3 and T3 older than T2)

T1 T2 T3

Question 2: [2.5 marks]

Imam University | CCIS | Vice Deanery of Development and Quality Page 1 of 3


Doc. No. 006-01-20140514
Draw the wait-for graph for the following transaction scenario and determine
whether a deadlock exists or not?
If exists mention the transactions in which the deadlock exists and write the
victim transaction to be selected in-order to break the deadlock.

Transactions Data Items Locked Data Items Waiting


for
T1 X22 X3
T2 X9,X10 X7,X8
T3 X8 X4,X5
T4 X7 X8
T5 X1 X3
T6 X3,X4 X6
T7 X6 X5
T8 X5 X10

Question3: [ 5 marks ]

Below, a schedule is given for four transactions T1, T2, T3, and T4.

Imam University | CCIS | Vice Deanery of Development and Quality Page 2 of 3


Doc. No. 006-01-20140514
Assume the initial values for the variables are A=5, B=10, C=15, D=0
Using a log with immediate updates, for each operation in each of the transactions, show:
1. The log entries.
2. Whether the write block buffer is updated.
3. Whether the DBMS on disk is updated.
Discuss how each transaction recovers from the failure at step 18.
A. What are the transactions that will do redo?
B. What are the transactions that will do undo?

T1 T2 T3 T4
1 R(A)
2 A=A-2
3 Write (A)
4 Commit T1
5 R(B)
6 B=B*2
7 Write (B)
8 R(C)
9 C=C*1
10 Write (C)
11 Checkpoint
12 Commit T3
13 B=B*4
14 Write(B)
15 Commit T2 Read (D)
16 Read (C)
17 D=C-2
18 Write (D)
19 Commit T4

Imam University | CCIS | Vice Deanery of Development and Quality Page 3 of 3


Doc. No. 006-01-20140514

You might also like