CONCURRENCY CONTROL WITH LOCKING METHODS
A lock guarantees exclusive use of a data item to a current transaction. ��In other words, transaction T2 does not have�access to a data item that is currently being used by transaction T1. ��A transaction acquires a lock prior to data access.��the lock is released (unlocked) when the transaction is completed so that another transaction can lock the data item for its exclusive use
Most multiuser DBMSs automatically initiate and enforce locking procedures.�� All lock information is managed by a�lock manager, which is responsible for assigning and policing the locks used by the transactions.
Lock granularity indicates the level of lock use.� Locking can take place at the following levels: database, table, page, row, or even field (attribute).
Database Level
In a database-level lock, the entire database is locked, thus preventing the use of any tables in the database by transaction T2 while transaction Tl is being executed. ��This level of locking is good for batch processes, but it is unsuitable for multiuser DBMSs.
Table Level
In a table-level lock, the entire table is locked, preventing access to any row by transaction T2 while transaction T1 is using the table.�� If a transaction requires access to several tables, each table may be locked. However, two transactions can access the same database as long as they access different tables.
Page Level
In a page-level lock, the DBMS will lock an entire diskpage. ��A diskpage, or page, is the equivalent of a diskblock,which can be described as a directly addressable section of a disk. ��A page has a fixed size, such as 4K, 8K, or 16K.
A table can span several pages, and a page can contain several rows of one or�more tables. ��Page-level locks are currently the most frequently used multiuser DBMS locking method.
Row Level
A row-level lock is much less restrictive than the locks discussed earlier. ��The DBMS allows concurrent transactions to access different rows of the same table even when the rows are located on the same page.�� Although the row-level locking approach improves the availability of data, its management requires high overhead because a lock exists for each row in a table of the database involved in a conflicting transaction.
Field Level�
Lock Types
Regardless of the level of locking, the DBMS may use different lock types: binary or shared/exclusive.
Binary Locks
Shared/Exclusive Locks
Two-Phase Locking to Ensure Serializability
The two-phase locking protocol is governed by the following rules:
Deadlocks
The three basic techniques to control deadlocks are
CONCURRENCY CONTROL WITH TIME STAMPING METHODS
Wait/Die and Wound/Wait Schemes
wait/die scheme:�
i.E in the wait/die scheme, the older transaction waits for the younger to complete and release its locks.
wound/wait scheme:�
What is the need for recovery?
What are the reasons for a transaction to fail?
32
Crash recovery
Phases of ARIES�Algorithm for Recovery and Isolation Exploiting Semantics (ARIES)��
Principles of ARIES