Strict, Rigorous and Conservative 2PL in DBMS: Differences, Schedules and Traps

Learn the exact lock-acquisition and release rules that separate basic, strict, rigorous and conservative 2PL. Trace an abort, a commit-order reversal and a deadlock-free transfer.

KnowledgeGate Team

Exam prep & CS education

Updated 2 Dec 20267 min read
Strict, Rigorous and Conservative 2PL in DBMS: Differences, Schedules and Traps

Basic 2PL, strict 2PL, rigorous 2PL and conservative 2PL all restrict lock timing, so one-line definitions can make them look interchangeable. They are not, and the labels describe different constraints rather than steps on one ladder. Classify each protocol with two questions: when must locks be acquired, and when may shared or exclusive locks be released? Using A = 100 and B = 50, the traces show waiting, abort, commit order and deadlock instead of relying on adjectives.

Two-phase locking baseline: growing, shrinking and the lock point

In a trace, S_i(A) means Ti takes a shared lock on A, X_i(A) an exclusive lock, and U_i(A) unlocks it. The operations r_i(A) and w_i(A) show reads and writes, while c_i and a_i mark commit and abort. On one item, S with S is compatible, but S with X, X with S, and X with X are incompatible.

Under basic 2PL, a transaction has a growing phase, when it may acquire locks but release none, followed by a shrinking phase, when it may release locks but acquire no new one. Its final lock acquisition is the lock point. Its first unlock ends growth. Basic 2PL guarantees conflict serializability, but by itself it does not prevent deadlock, dirty reads, cascading rollback or an unrecoverable commit order. Lock-Based Protocols and Basic 2PL Explained: Lock Compatibility, Phases and a Worked Schedule works through the compatibility table, lock-point proof and the A = 100, B = 50 transfer. Strict, rigorous and conservative 2PL differ in X-lock release, S-lock release and complete-set acquisition.

Strict 2PL: hold every exclusive lock through commit or abort

Strict 2PL obeys 2PL and retains every X lock until commit or abort. S locks may be released earlier, but once any lock is released, the transaction cannot acquire another. Consequently, no other transaction can read or overwrite an item written by an uncommitted transaction. The schedule is strict, cascadeless and recoverable.

Start with A = 100. T1 performs X_1(A), reads 100 and writes a tentative 80. T2 requests X_2(A) and waits. If T1 aborts, the database restores A = 100 and releases T1's lock. T2 then gets its X lock, reads 100, writes 120, commits and releases. The final value is A = 120.

Basic non-strict 2PL permits the unsafe order X_1(A), r_1(A)=100, w_1(A)=80, U_1(A), X_2(A), r_2(A)=80, w_2(A)=100, c_2, a_1. T1 acquires no lock after unlocking, so it has not broken basic 2PL. But T2 commits after reading T1's uncommitted 80. When T1 aborts, T2 cannot be rolled back, making the history unrecoverable.

Rigorous 2PL: shared locks also stay until the end

Rigorous 2PL, called strong strict 2PL in some texts, retains both S and X locks until commit or abort. Every rigorous-2PL schedule therefore satisfies strict 2PL. The reverse is false because strict 2PL may release an S lock early.

Let A = 100. T1 obtains S_1(A), reads 100, and computes the local report value 2 × 100 = 200. It needs no more locks. Under strict 2PL, T1 may release S_1(A) before c_1. T2 can then obtain X_2(A), read 100, write 120 and commit before T1 commits. The conflict-serialization order is T1 then T2, but the commit order is T2 then T1.

Under rigorous 2PL, T1 keeps S_1(A) until c_1. T2's X request waits. Only after T1 commits and unlocks can T2 read 100, write 120 and commit. The X-lock rule is unchanged; only shared-lock release differs. In this trace, rigorous locking makes the commit order match the serialization order.

Timeline comparison of Strict and Rigorous 2PL on item A, where Rigorous holds T1 shared lock until commit so T2 must wait to read.

Conservative 2PL: preclaim the complete lock set to avoid deadlock

Conservative, or static, 2PL controls acquisition. A transaction obtains its complete required lock set before database work. If the set is unavailable, it waits while holding no partial set. This eliminates lock-acquisition deadlock, but requires advance knowledge and can reduce concurrency or cause long waits. It is not synonymous with strict or rigorous because its name does not fix release time.

Return to the same A = 100 and B = 50 starting state. T1 transfers 20 from A to B and needs {X(A), X(B)}. T2 transfers 10 from B to A and needs {X(B), X(A)}. With ordinary dynamic acquisition, T1 can hold X_1(A) while T2 holds X_2(B). T1 waits for B, and T2 waits for A. The wait-for cycle is T1 -> T2 -> T1, so neither can proceed.

Under conservative 2PL, T1 atomically obtains {X_1(A), X_1(B)} while T2 waits holding no lock. T1 writes A = 100 - 20 = 80 and B = 50 + 20 = 70, then finishes and releases. T2 obtains both locks and writes B = 70 - 10 = 60 and A = 80 + 10 = 90. The final values are A = 90, B = 60, and their sum remains 150. This clean trace releases at commit, but preclaiming, not that release choice, defines conservative 2PL.

Lock traces comparing dynamic 2PL, which deadlocks on items A and B, with Conservative 2PL, which acquires all locks upfront to avoid it.

Strict vs rigorous vs conservative 2PL: the comparison that matters

Protocol

Lock acquisition

S-lock release

X-lock release

Deadlock possible?

Strict/cascadeless by itself?

Main cost

Basic 2PL

During growth

During shrink

During shrink

Yes

No

Cascading and recovery problems

Strict 2PL

During growth

May be before transaction end

At commit or abort

Yes

Yes

Longer X-lock blocking

Rigorous 2PL

During growth

At commit or abort

At commit or abort

Yes

Yes

Lower concurrency from holding all locks

Conservative 2PL

Complete set before work

Not fixed by the name

Not fixed by the name

No lock-acquisition deadlock

No

Advance lock knowledge and extra waiting

All four remain 2PL variants and target conflict serializability. Deadlock freedom and recoverability are separate properties. A protocol can remove lock deadlock without automatically making a schedule strict, as conservative 2PL does. It can also be strict while still allowing deadlock, as strict and rigorous 2PL do.

Classify a lock schedule instead of guessing from its name

Classify the schedule by applying four tests: reject 2PL when any lock follows the first unlock, ask whether the complete lock set was preclaimed before database work, check whether any X lock is released before commit or abort, and check whether any S lock is released early. The labels can overlap.

  1. X_1(A), w_1(A), U_1(A), X_1(B) violates 2PL because a new lock follows the first unlock. In plain terms, T1 unlocks A and then locks B.

  2. X_1(A), w_1(A), U_1(A), c_1 can satisfy basic 2PL, but it is not strict because the X lock is released before commit. T1 writes A, then unlocks it too soon.

  3. S_1(A), r_1(A), U_1(A), c_1 can satisfy strict 2PL, provided T1 acquires no later lock, but it is not rigorous because the S lock is released early. The read lock does not survive until commit.

  4. S_1(A), X_1(B), r_1(A), w_1(B), c_1, U_1(A), U_1(B) is rigorous because both locks remain held through commit. Both the read and write locks survive transaction end.

  5. preclaim {S_1(A), X_1(B)}; r_1(A); w_1(B) is conservative only if that set is complete. It does not qualify if T1 later discovers that it needs X_1(C). T1 must know every required lock upfront.

Exam patterns and traps in questions on 2PL variants

Strict does not mean deadlock-free. In the two-transfer deadlock above, T1 → T2 → T1 forms a wait-for cycle because each transaction holds one lock while waiting for another. An early S_1(A) release only disproves rigorous, not necessarily strict, so check the X locks and later acquisitions separately. Likewise, the unsafe schedule from the strict-2PL section is conflict serializable but not recoverable: T2 reads T1's uncommitted 80. Three shorter cautions remain:

  • Rigorous is stronger than strict. It holds S locks as well as X locks to transaction end.

  • Conservative describes acquisition. It does not necessarily prescribe release time.

  • A plausible final value cannot repair an unrecoverable history. Commit dependencies matter.

Typical tasks reuse the numbers worked above: classify an early S_1(A) release as strict but not rigorous; replay T1's abort and obtain A = 120; draw the wait-for cycle from the opposing transfers; or compute A = 90, B = 60. About 10 practice questions target this exact subtopic. Use DBMS Transaction MCQs: 12 Solved (ACID, Locking) for timed follow-up, then apply the distinctions in the GATE Test Series.

The short version and next step

  • Strict holds X locks to the end.

  • Rigorous holds S and X locks to the end.

  • Conservative gets the complete lock set before work begins.

The baseline beneath all three is simple: no 2PL transaction may acquire a new lock after its first unlock. For the wider subject route, use CS Fundamentals for Exams & Placements. For sequenced DBMS study and practice, continue with GATE Guidance by Sanchit Sir. If you need only this concept, redraw both diagrams and classify the five mini-schedules first.