Back to the 2021 paper

Unit 3: Storage and Transaction Processing

202114m

Show that the two-phase locking protocol ensures conflict serializability and that transaction can be serialized according to their lock points.

Worked SolutionAI Assisted

Show 2PL Ensures Conflict Serializability and Serialization by Lock Points:

Proof: Consider any schedule S generated by 2PL-compliant transactions. Let lock point of Ti be the moment Ti has acquired its last lock (end of growing phase). Lemma: If Ti precedes Tj in a conflict (operation o_i before o_j conflicting), then lock_point(Ti) < lock_point(Tj). Because to perform conflicting operations, both need lock on same item; conflicting lock types (X vs S/X) exclude. Since Ti held lock before Tj could acquire it, Ti must have acquired it first and since 2PL forbids acquiring after unlocking, Ti's lock point before Tj's first conflicting lock release.

If schedule had cycle Ti -> Tj -> ... -> Ti, then lock points would have cycle lock(Ti) < lock(Tj) < ... < lock(Ti) impossible. Hence conflict graph acyclic -> conflict serializable.

Serialization order: Sort transactions by lock points ascending. That order is a serial schedule conflict-equivalent to S, because all conflicting pairs respect lock point order. Strict 2PL also ensures recoverability.

Example holds.

Similar questions

Official AppAndroid App

PYQDeck for Android

Solve BEU previous-year exam papers anywhere, anytime. Fast search, offline paper viewing, and step-by-step solutions designed specifically for your phone.