pessimistic locking - lock resource exclusively. a write lock indicates nobody else can read/update/delete it. a read lock allows others to read but not update/delete. it is easy to implement, but expensive and not scalable.
optimistic locking - agree on infrequent collisions situation. detect instead of exclusively prevent. the state of resource is saved, and compared at the end. if state is modified at the commit time, conflict happens and the transaction is rolled back. the state can be a unique value (timestamp, seq) in data row.
overly optimistic locking - agree on no collisions situation. no lock and detect at all.
optimistic locking - agree on infrequent collisions situation. detect instead of exclusively prevent. the state of resource is saved, and compared at the end. if state is modified at the commit time, conflict happens and the transaction is rolled back. the state can be a unique value (timestamp, seq) in data row.
overly optimistic locking - agree on no collisions situation. no lock and detect at all.
Comments
Post a Comment