Difficulty: Easy
Correct Answer: Read
Explanation:
Introduction / Context:
Locks are fundamental to concurrency control. A shared lock allows concurrent readers while preventing writers from altering the locked resource. Understanding this distinction helps prevent anomalies like dirty reads and lost updates in multi-user environments.
Given Data / Assumptions:
Concept / Approach:
Shared locks are compatible with other shared locks, enabling multiple transactions to read the same data concurrently. However, they conflict with exclusive (X) locks, which are needed for modifications. Thus, reading is allowed; inserting, updating, or deleting the locked row/page requires exclusive intent.
Step-by-Step Solution:
Identify permitted operations under S-lock: non-destructive reads.Recognize forbidden operations: modifications that need X-locks (update, delete) or schema changes.Map “read” to the allowed, concurrent operation under shared locks.Select “Read.”
Verification / Alternative check:
Lock compatibility matrices show S is compatible with S, but S is incompatible with X. Reads use S locks; writes request X locks (or intent locks leading to X at finer granularity).
Why Other Options Are Wrong:
Common Pitfalls:
Assuming inserts are always compatible with shared locks; while inserts may coexist via intent locks, they do not use a shared lock on the same target row.
Final Answer:
Read
Discussion & Comments