Difficulty: Easy
Correct Answer: Incorrect: X lock blocks both reads and writes by others
Explanation:
Introduction / Context:
Lock modes control what concurrent operations can proceed. Understanding how exclusive locks interact with shared locks is essential for reasoning about isolation and blocking behavior.
Given Data / Assumptions:
Concept / Approach:
A shared (S) lock allows concurrent readers but not writers. An exclusive (X) lock allows a single writer and conflicts with both S and X requests from others—blocking both reads and writes. Some MVCC systems let others read old versions without acquiring S locks, but under a locking-based model, an X lock prevents other transactions from reading the locked item because they cannot acquire a compatible S lock.
Step-by-Step Solution:
Verification / Alternative check:
Check DBMS documentation for lock compatibility charts; exclusive locks conflict with both shared and exclusive requests.
Why Other Options Are Wrong:
Common Pitfalls:
Confusing MVCC’s non-blocking reads with lock compatibility. MVCC reads avoid S locks but that is due to versioning, not because X permits reads.
Final Answer:
Incorrect: X lock blocks both reads and writes by others
Discussion & Comments