Consider a database with items x and y and assume that there

Consider a database with items x and y and assume that there are two transactions T1 and T2 such that: T1 reads items y then x then writes x. Transaction T2 reads items x and y and then writes x and y.

a) In a centralized database environment:
a. Give a schedule with actions of transactions T1 and T2 on items x and y that is not conflict serializable.
b.Give a schedule of T1 and T2 that uses 2PL to ensure serializablity.
c. Give a schedule of T1 and T2 that uses 2PL and results in a deadlock.


b) In a distributed database environment, assume x is stored at site 1 and y is stored at site2:
a. Give serializable local schedules at site 1 and site 2 such that the global schedule is serializable as well.
b. Give serializable local schedules at site 1 and site 2 such that the global schedule is not serializable.

Solution

Ans a)

a. schedule for not conflict serializable :

T1:R(Y) T2:R(X) T1:R(X) T2:R(Y) T1:W(X) T2:W(Y) T2:W(X)

b. schedule for 2PL serializablity :

T1

T2

LOCK-S(Y)

LOCK-S(X)

Read(X)

Read(Y)

LOCK-X(X)

LOCK-S(Y)

Read(Y)

Read(X)

Write(X)

LOCK-X(Y)

Write(Y)

Unlock(X)

LOCK-X(X)

Write(X)

Unlock(Y)

Unlock(X)

c.a schedule of T1 and T2 that uses 2PL and results in a deadlock.

T1

T2

LOCK-S(Y)

LOCK-S(X)

Read(X)

Read(Y)

LOCK-S(X)

LOCK-S(Y)

Read(Y)

Read(x)

LOCK-X(X)

T1

T2

LOCK-S(Y)

LOCK-S(X)

Read(X)

Read(Y)

LOCK-X(X)

LOCK-S(Y)

Read(Y)

Read(X)

Write(X)

LOCK-X(Y)

Write(Y)

Unlock(X)

LOCK-X(X)

Write(X)

Unlock(Y)

Unlock(X)

Consider a database with items x and y and assume that there are two transactions T1 and T2 such that: T1 reads items y then x then writes x. Transaction T2 rea
Consider a database with items x and y and assume that there are two transactions T1 and T2 such that: T1 reads items y then x then writes x. Transaction T2 rea

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site