CS Atlas GATE 2027
DBMS course
0 / 119 complete

DBMS/Phase 6 · Transactions & Concurrency

Lesson 6.6.3 · Item 107 of 119

Strict, rigorous and conservative 2PL

Read at your own pace. Try the questions before opening the answers.

On this page

0 · Recall Warm-up

Answer from memory first. Answers are in the Answer Vault at the bottom.

  1. What does basic 2PL guarantee? from Lesson 6.6.2
  2. What does a strict schedule forbid? from Lesson 6.5.1
  3. Which pair of lock modes is compatible? from Lesson 6.6.1

1 · The Hook

Basic 2PL lets T1 release its exclusive lock on A before committing; T2 reads A and commits; T1 aborts. The schedule is serializable but not recoverable. The fix is simple: do not release write locks until commit. That is strict 2PL, the protocol almost every real DBMS uses. Two more variants trade concurrency for other guarantees.

2 · Predict First

Under strict 2PL, can T2 ever read a value written by T1 before T1 commits?

Make a guess in your head. The answer opens Section 3.

3 · Core Concept

Predict First — the answer

No. T1 keeps its X lock on the item until it commits or aborts, so T2's S lock waits. No dirty reads, so no cascading rollbacks: schedules are strict.

The variants

ProtocolRule (in addition to 2PL)GivesDeadlock-free?
Basic 2PLgrowing then shrinkingconflict serializableno
Strict 2PLhold all X locks until commit/abortCS + strict schedules (no cascading rollback)no
Rigorous 2PL (strong strict)hold all locks (S and X) until commit/abortCS + strict; serial order = commit orderno
Conservative 2PL (static)acquire all needed locks before the first operation (predeclare); if any is unavailable, take none and waitCS; no deadlockyes

Notes:

  • Conservative 2PL is deadlock-free because a transaction never holds some locks while waiting for others. It is not necessarily strict (it may release early), and it needs the full read/write set in advance.
  • Strict and rigorous 2PL can still deadlock: they say nothing about the order of acquisition.
  • Rigorous ⊂ strict ⊂ basic (in the schedules they allow).

Which protocol for which question?

  • "No cascading rollbacks" → strict (or rigorous) 2PL.
  • "Transactions serialized in commit order" → rigorous 2PL.
  • "Deadlock never occurs" → conservative 2PL (or timestamp-based schemes, Lesson 6.7.1).
  • "Only conflict serializability" → basic 2PL.

4 · Visual

basic 2PL:      locks  /‾‾‾\____                (releases before commit)
strict 2PL:     X locks /‾‾‾‾‾‾‾‾|commit         S locks may go early
rigorous 2PL:   all     /‾‾‾‾‾‾‾‾|commit
conservative:   all     |‾‾‾‾‾\___               (everything locked at the start)

5 · Worked Examples

Example 1 Easy

Which variant guarantees that a schedule never needs cascading rollback?

Solution

Strict 2PL (rigorous 2PL too).

Example 2 Medium

A system requires every transaction to list all items it will access before starting, and locks them all at once. Which protocol, and what does it buy?

Solution

Conservative (static) 2PL. It prevents deadlock, since no transaction waits while holding locks.

Example 3 GATE

Under rigorous 2PL, T2 commits at time 12, T1 at time 15, T3 at time 9. Equivalent serial order?

Solution

Commit order: T3, T2, T1.

6 · GATE Traps

  • Strict 2PL holds exclusive locks to commit; rigorous holds all locks.
  • Strict/rigorous 2PL do not prevent deadlocks; conservative 2PL does.
  • Conservative 2PL alone does not guarantee strict schedules.
  • All variants still guarantee conflict serializability.

7 · Memory Hook

"Strict keeps the pen, rigorous keeps pen and book, conservative grabs everything first."

8 · Connect the Dots

Lesson 6.6.2 gave basic 2PL; this lesson added its strict, rigorous and conservative forms. Strict and rigorous 2PL can still deadlock. Next: detecting and preventing deadlocks: wait-for graphs, wait-die and wound-wait.

9 · Self-Test

GATE format. Try every question before opening the vault.

Q1 · MCQ · 1 mark(s) — Strict 2PL

Strict 2PL requires transactions to hold until commit:

  1. (A) all shared locks
  2. (B) only the first lock
  3. (C) all exclusive locks
  4. (D) no locks

Q2 · MCQ · 1 mark(s) — Deadlock-free

Which variant is deadlock-free?

  1. (A) Conservative 2PL
  2. (B) Basic 2PL
  3. (C) Rigorous 2PL
  4. (D) Strict 2PL

Q3 · MCQ · 2 mark(s) — Serial order

Under rigorous 2PL, the equivalent serial order is the order of:

  1. (A) first lock requests
  2. (B) commits
  3. (C) transaction IDs
  4. (D) start times

Q4 · MSQ · 2 mark(s) — Guarantees

Which guarantees does strict 2PL give?

  1. (A) Conflict serializability
  2. (B) Recoverability
  3. (C) Strict schedules (no cascading rollback)
  4. (D) Freedom from deadlock

Q5 · MCQ · 1 mark(s) — Predeclaration

Which protocol requires knowing a transaction's read and write sets in advance?

  1. (A) Rigorous 2PL
  2. (B) Strict 2PL
  3. (C) Conservative 2PL
  4. (D) Basic 2PL

10 · Rule Card

  • Strict 2PL: X locks held to commit/abort → strict schedules.
  • Rigorous 2PL: all locks held to commit → serial order = commit order.
  • Conservative 2PL: lock everything before starting → deadlock-free; needs predeclaration.
  • All give conflict serializability; only conservative avoids deadlock.

11 · Concept Ledger

Unlocked in this lesson. From here on, these terms may be used.

strict 2PLrigorous (strong strict) 2PLconservative (static) 2PLpredeclaration of read/write sets

12 · Answer Vault

Reveal answers when you’re ready

Recall Warm-up

  1. Conflict serializability (order of lock points).
  2. Reading or writing an item until its last writer commits or aborts.
  3. S and S.

Self-Test

Q1 Answer: (C) · 1 mark(s)

X locks until commit/abort.

  • (A) is wrong: That is rigorous 2PL.
  • (B) is wrong: No.
  • (D) is wrong: No.

Re-read: Lesson 6.6.3 — Strict, rigorous and conservative 2PL

Q2 Answer: (A) · 1 mark(s)

All locks taken before starting.

  • (B) is wrong: Can deadlock.
  • (C) is wrong: Can deadlock.
  • (D) is wrong: Can deadlock.

Re-read: Lesson 6.6.3 — Strict, rigorous and conservative 2PL

Q3 Answer: (B) · 2 mark(s)

All locks held until commit, so the lock point is effectively the commit.

  • (A) is wrong: No.
  • (C) is wrong: No.
  • (D) is wrong: No.

Re-read: Lesson 6.6.3 — Strict, rigorous and conservative 2PL

Q4 Answer: (A) (B) (C) · 2 mark(s)

Strict ⊂ recoverable; deadlocks still possible.

  • (D) is wrong: Not guaranteed.

Re-read: Lesson 6.6.3 — Strict, rigorous and conservative 2PL

Q5 Answer: (C) · 1 mark(s)

It locks everything up front.

  • (A) is wrong: No.
  • (B) is wrong: No.
  • (D) is wrong: No.

Re-read: Lesson 6.6.3 — Strict, rigorous and conservative 2PL

Ready for the next idea?

Mark this item complete when you’ve finished reading and working through it.