Computing Students - Computer Science Degree Notes
Home Contact Shop Notes Questions Programming Links Dictionary Coursework FORUM Tutors
  Recommended Amazon Searches: Computer Science | Computing | Computer Systems | Database | Computing Revision  

Notes > Database Systems > Locks, 2PL and Deadlocks

Locking

A transaction will use a lock to deny data access to other transactions and so prevent incorrect updates. Locks can be Read (shared) or Write (exclusive) locks. Write Locks on a data item prevent other transactions from reading that data item whereas Read Locks simply stop other transactions editing (writing to) the data item.

Two-Phase Locking (2PL)

A transaction follows the 2PL protocol if all lock requests come before the first unlock operation within the transaction. This means there are two main phases within the transaction:

- Growing phase (all locks are acquired)
- Shrinking phase (locks released - no new locks can be acquired)

Deadlock

Deadlock occurs when two or more transactions are left waiting for locks held by each other to be released. The only way to break a deadlock is to abort one of the transactions so that a lock is released so that the other transaction can proceed.

The DBMS can manage this process of aborting a transaction when necessary. The aborted transaction is typically restarted so that it is able to execute and commit without the user being aware of any problems occurring.

Search for "Locks, 2PL and Deadlocks" on: Google | Kelkoo | Amazon | eBay (UK) | eBay (US)

Search for "Locks, 2PL and Deadlocks" on the rest of Computing Students: Locks, 2PL and Deadlocks






Home | Contact | Shop | Notes | Questions | Programming | Links | Dictionary | Coursework | Tutors Sponsored Links: Affiliate Program Articles | Computer Science Definitions | CS Degree Notes
Copyright © 2005-2009 ComputingStudents.com
This site is to be used in accordance with the ComputingStudents.com User Agreement
High Wycombe Web Design