11.4 Locking

Locking ensures serializability by allowing a transaction to lock a database object to prevent another transaction from accessing or modifying the object. Objects of various sizes, ranging from the entire database down to a single data item, may be locked. The size of the object determines the fineness, or granularity, of the lock. The actual lock might be implemented by inserting a flag in the data item, record, page, or file to indicate that portion of the database is locked, or by keeping a list of locked parts of the database.

Often, there are two categories of locks: shared and exclusive. If a system uses locks, any transaction that needs to access a data item must first lock the item, requesting a shared lock for read-only ...

Get Databases Illuminated, 4th Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.