Berkeley DB Concurrent Data Store Locking Conventions
The Berkeley DB Concurrent Data Store product has a different set of conventions for locking. It provides multiple-reader/single-writer semantics, but not per-page locking or transaction recoverability. As such, it does its locking entirely at the interface to the access methods.
The object it locks is the file, identified by its unique file number. The locking matrix is not one of the two standard lock modes; instead, we use a four-lock set, consisting of the following:
DB_LOCK_NG Not granted (always 0)
DB_LOCK_READ Read (shared)
DB_LOCK_WRITE Write (exclusive)
DB_LOCK_IWRITE Intention-to-write (shared with NG and READ, but conflicts with WRITE and IWRITE)
The IWRITE lock is used for cursors ...