Sie sind auf Seite 1von 2

Locks in DBMS Systems

By: Yasmeen Shabana


BSc of Electrical Engineering and Power Machines.

MSc of Software Engineering.

__________________________________________________________________________________________

A transaction in the database must have the properties of atomicity, consistency, isolation,
durability, and serializability. To satisfy those properties, the commercial DBMSs use several locking
methods (University of Liverpool, 2015). Locking is a way to ensure that data is being manipulated by
one transaction only so that a transaction will lock the necessary data items before accessing them.
The portion of the data locked varies from one DBMS to the other. It can be very specific based on
the type of transaction to be performed on the database (L. Harrington, 2016). When the transaction
is completed, it will unlock the data to make available for the next transaction (Coronel and Morris,
2015).

The binary lock has only two states “0” for unlocked status and “1” for locked status. If a data
object is locked, then no other transaction can access this object. If a database object is unlocked,
any transaction can lock the object for its use. Therefore, every transaction requires a lock and
unlock operation for every accessed data object in the database (Coronel and Morris, 2015). This lock
mechanism eliminates the lost update problem that happens when one transaction is reading a field
before a previous transaction is committed to updating this field (Hoffer, Ramesh and Topi, 2013). If
binary lock scheme is used, any transaction must issue a lock operation on the data item before the
transaction can access this data item for reading or writing processes. The transaction must issue an
unlock operation after all read or write processes are completed (Elmasri and Navathe, 2011).
Though binary locks are simple to implement, they enforce mutual exclusion on data items with very
restrictive rules for concurrency control. Therefore, cannot be used for practical purposes (Thakur,
no date).

The shared lock is issued when concurrent transactions are requesting read access to a data
element. This type of lock is usually used as a common lock and produces no conflicts in the database
as long as all the simultaneous transactions are read-only (Coronel and Morris, 2015). The shared
lock is also called a “read lock” as it is concerned with the read access to data items for the database
transactions (Garcia-Molina, Ullman and Widom, 2009). Placing a shared lock on a record prevents
other transactions from placing an exclusive lock, but not a shared lock, on that record (Hoffer,
Ramesh and Topi, 2013). Shared locks can solve the inconsistent analysis problem because any
transaction that requires an exclusive lock must wait until the shared lock issued by the read
transaction is removed (L. Harrington, 2016).

The exclusive lock is issued to reserve a data object specifically for the transaction that
locked this object. This type of lock is usually used when there is a possibility of conflict between
transactions that might request write access to the same data item (Coronel and Morris, 2015). The
exclusive lock is also called a “write lock” as it is concerned with addressing the conflict occurring
when one or more transaction is trying to write to the database (Garcia-Molina, Ullman and Widom,
2009). The exclusive lock is granted for a data item only if there are no other locks are held on that
data item. Exclusive locks solve the lost update problem because other transactions requesting read
access to the data item must wait until the exclusive lock is released (Hoffer, Ramesh and Topi,
2013).
REFERENCES

Coronel, C. and Morris, S. (2015) ‘Chapter 10: Transaction Management and Concurrency Control’, in
Database Systems Design, Implementation, and Management. 11th edn. Cengage Learning, pp. 454–
485.

Elmasri, R. and Navathe, S. (2011) Fundamentals of Database Systems. 6th edn. Boston: Addison-
Wesley.

Garcia-Molina, H., Ullman, J. D. and Widom, J. (2009) Database Systems: The Complete Book. 2nd
edn.

Hoffer, J. A., Ramesh, V. and Topi, H. (2013) Modern Database Management. 11th edn. Upper Saddle
River, NJ: Prentice-Hall. Available at:
http://www.acadox.com/action_handler/download/resource/40206/54965.pdf (Accessed: 2 July
2018).

L. Harrington, J. (2016) Relational Database Design and Implementation. 4th edn. Elsevier; Morgan
Kaufmann. Available at: https://www-sciencedirect-
com.liverpool.idm.oclc.org/science/book/9780128043998#? (Accessed: 24 June 2018).

Thakur, D. (2016) What is Lock? Type of Lock in DBMS. Available at:


http://ecomputernotes.com/database-system/rdbms/type-of-lock-in-dbms (Accessed: 6 July 2018).

University of Liverpool (2015) ‘Week 6 - Advance Database Concepts’, in CKIT 504: Designing and
Managing Databases, pp. 1–10. Available at:
https://elearning.uol.ohecampus.com/bbcswebdav/institution/UKL1/_MASTERS_/MS_CKIT/CKIT_50
4/readings/UKL1_CKIT_504_Week06_LectureNotes.pdf (Accessed: 6 July 2018).

Das könnte Ihnen auch gefallen