0 · Recall Warm-up
Answer from memory first. Answers are in the Answer Vault at the bottom.
- What does basic 2PL guarantee? from Lesson 6.6.2
- What does a strict schedule forbid? from Lesson 6.5.1
- 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
| Protocol | Rule (in addition to 2PL) | Gives | Deadlock-free? |
|---|---|---|---|
| Basic 2PL | growing then shrinking | conflict serializable | no |
| Strict 2PL | hold all X locks until commit/abort | CS + strict schedules (no cascading rollback) | no |
| Rigorous 2PL (strong strict) | hold all locks (S and X) until commit/abort | CS + strict; serial order = commit order | no |
| Conservative 2PL (static) | acquire all needed locks before the first operation (predeclare); if any is unavailable, take none and wait | CS; no deadlock | yes |
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:
- (A) all shared locks
- (B) only the first lock
- (C) all exclusive locks
- (D) no locks
Q2 · MCQ · 1 mark(s) — Deadlock-free
Which variant is deadlock-free?
- (A) Conservative 2PL
- (B) Basic 2PL
- (C) Rigorous 2PL
- (D) Strict 2PL
Q3 · MCQ · 2 mark(s) — Serial order
Under rigorous 2PL, the equivalent serial order is the order of:
- (A) first lock requests
- (B) commits
- (C) transaction IDs
- (D) start times
Q4 · MSQ · 2 mark(s) — Guarantees
Which guarantees does strict 2PL give?
- (A) Conflict serializability
- (B) Recoverability
- (C) Strict schedules (no cascading rollback)
- (D) Freedom from deadlock
Q5 · MCQ · 1 mark(s) — Predeclaration
Which protocol requires knowing a transaction's read and write sets in advance?
- (A) Rigorous 2PL
- (B) Strict 2PL
- (C) Conservative 2PL
- (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
- Conflict serializability (order of lock points).
- Reading or writing an item until its last writer commits or aborts.
- 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