[prev] 15 [next]

Lock-based Concurrency Control (cont)

Lock table entries contain:
  • object being locked   (DB, table, tuple, field)
  • type of lock: read/shared, write/exclusive
  • FIFO queue of tx's requesting this lock
  • count of tx's currently holding lock   (max 1 for write locks)
Lock and unlock operations must be atomic.

Lock upgrade:

  • if a tx holds a read lock, and it is the only tx holding that lock
  • then the lock can be converted into a write lock