You are on page 1of 15

M.

SAQIB AZIZ (65146) 02-131192-031

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

For Serial Schedule:

T1 T2 T3
R(Y)
R(Z)
R(B)
B:=B+(Y*.1)+Z*.2
Y:=Y-Y*.1
Z:=Z-Z*.2
W(B)
W(Y)
W(Z)
R(D)
R(Y)
D:=D-50
W(D)
Y:=Y+50
W(Y)
R(Z)
R(D)
Z:=Z-5
W(Z)
D:=D+5
W(D)

Checking for Conflict serializability:

Conflict serializability is checked through precedence graph.

Number of transactions become nodes of the graph (in this scenario it is 3), while if a conflict occurs
between two transactions, an edge is made between the respected nodes. If there is a cycle or loop that
takes place in the graph, the schedule is not a serializable. If there is no loop, the schedule can be
serialized.

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

For Concurrent Schedule:


For timestamp 3 and order T1<T2<T3

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

T1 T2 T3
R(Y)
R(Z)
R(B)
R(D)
R(Y)
D:=D-50
R(Z)
R(D)
Z:=Z-5
B:=B+(Y*.1)+Z*.2
Y:=Y-Y*.1
Z:=Z-Z*.2
W(D)
Y:=Y+50
W(Y)
W(Z)
D:=D+5
W(D)
W(B)
W(Y)
W(Z)

For timestamp 4 and order T3<T2<T1


T3 T2 T1
R(Y)
R(Z)
R(B)
B:=B+(Y*.1)+Z*.2
R(D)
R(Y)
D:=D-50
W(D)
R(Z)
R(D)
Z:=Z-5
W(Z)
Y:=Y-Y*.1

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

Z:=Z-Z*.2
W(B)
W(Y)
Y:=Y+50
W(Y)
D:=D+5
W(D)
W(Z)

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

Which is better and why?


The wound wait is a better deadlock prevention strategy. Because the required
resource isn't available or is being used by the older transactions, the younger
transactions frequently die. However, in wound wait, the younger transaction
can wait until the elder transaction releases the resource. When they need a
resource that is being used by a younger transaction, the older transaction can

BSE 4A DBMS ASSIGNMENT 3


M.SAQIB AZIZ (65146) 02-131192-031

cause problems for the younger ones. However, because this occurs less
frequently, the wound wait standstill prevention approach is more effective.

BSE 4A DBMS ASSIGNMENT 3

You might also like