Synchronization, Mutual Exclusion, Deadlocks
[Miscellaneous]

Collaboration diagram for Synchronization, Mutual Exclusion, Deadlocks:

Within the storage manager are a variety of primitives that provide for ACID properties of transactions and for correct behavior of concurrent threads. These include:

The storage manager uses database locks to provide concurrency control among transactions; latches are used for syncronize concurrent threads' accesses to pages in the buffer pool. The storage manager's threads use carefully-designed orderings of the entities they "lock" with synchronization primitives to avoid any sort of deadlock. All synchronization primitives except data base locks are meant to be held for short durations; they are not even held for the duration of a disk write, for example.

Deadlock detection is done only for database locks. Latches are covered by locks, which is to say that locks are acquired before latches are requested, so that deadlock detection in the lock manager is generally sufficient to prevent deadlocks among concurrent threads in a properly-written server.

Care must be taken, when writing server code, to avoid deadlocks of other sorts such as latch-mutex, or latch-latch deadlocks. For example, multiple threads may cooperate on behalf of the same transaction; if they are trying to pin records without a well-designed ordering protocol, they may deadlock with one thread holding page A pinned (latched) and waiting to pin (latch) B, while the other holds B pinned and waits for a pin of A.


Generated on Wed Jul 7 17:22:39 2010 for Shore Storage Manager by  doxygen 1.4.7