In DBMS locking, which lock mode prevents any other transaction from accessing an item (neither read nor write) while the lock is held?
-
AImplicit lock
-
BExplicit lock
-
CExclusive lock
-
DShared lock
Answer
Correct Answer: Exclusive lock
Explanation
Introduction / Context:To preserve consistency, DBMSs use lock modes to control concurrent access. This question asks for the lock that blocks all other access (reads and writes) while held.
Given Data / Assumptions:
- Multiple transactions may attempt to read or modify the same item.
- We want a lock that denies all concurrent access by others.
Concept / Approach:An exclusive (X) lock grants a transaction the sole right to read and modify the item and prevents other transactions from acquiring shared or exclusive locks on the same item until it is released.
Step-by-Step Solution:
Recall lock compatibility: X is incompatible with both S and X.Therefore, while an X lock is held, no other read or write can proceed.Select “Exclusive lock.”Verification / Alternative check:Lock matrix check: X with S = conflict, X with X = conflict; the item is fully isolated.
Why Other Options Are Wrong:
- Implicit/Explicit: describe how a lock is acquired (automatic vs. requested), not its blocking behavior.
- Shared lock: allows other shared locks and thus allows reads by others.
Common Pitfalls:Assuming “exclusive” only blocks writers; in standard compatibility models, it blocks both readers and writers.
Final Answer:Exclusive lock