ποΈ 07082025 1052
βAssume conflict will happen. Lock early.β
π§° Mechanism:β
- Acquire lock before accessing data
- Other transactions block until lock is released
π’ Pros:β
- Safe: avoids conflicts
- Good for high-contention systems
π΄ Cons:β
- Can lead to deadlocks
- Lower concurrency
- Blocking = slower performance
π οΈ Common in:β
- Traditional RDBMS (e.g.,
SELECT ... FOR UPDATE) - Critical sections in threads (
synchronized,ReentrantLock)
Referencesβ
- ChatGPT