Definition
Lock-based Synchronisation
Lock-based synchronisation ensures conflict serialisable schedules by delaying transactions that could violate serialisability.
Types
No Lock | Shared | Exclusive | |
---|---|---|---|
Shared | OK | OK | - |
Exclusive | OK | - | - |
Shared Lock
A shared lock may issue a read access request on the item. When a data item is marked as shared, only read requests from other transactions are possible.
Exclusive Lock
An exclusive lock may issue a writing or read access request on the item. When a data item is marked as exclusive, no other requests from other transactions on that item are possible.
Positioning
Early Locking
Early locking can cause incorrect (non-serialisable) schedules, but allows for a higher degree of concurrency.
Late Unlocking
Late unlocking avoids non-serialisable schedules, but it increases the chances of deadlocks.