chapter16 - Chapter 16 : Concurrency Control Database...

Info iconThis preview shows pages 1–6. Sign up to view the full content.

View Full Document Right Arrow Icon
Database System Concepts 5 th Ed. © Silberschatz, Korth and Sudarshan, 2005 See www.db-book.com for conditions on re-use Chapter 16 : Concurrency Control Chapter 16 : Concurrency Control
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
©Silberschatz, Korth and Sudarshan 16.2 Database System Concepts - 5 th Edition, Sep 12, 2005 Chapter 16: Concurrency Control Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols Validation-Based Protocols Multiple Granularity Multiversion Schemes Deadlock Handling Insert and Delete Operations Concurrency in Index Structures
Background image of page 2
©Silberschatz, Korth and Sudarshan 16.3 Database System Concepts - 5 th Edition, Sep 12, 2005 Lock-Based Protocols Lock-Based Protocols A lock is a mechanism to control concurrent access to a data item Data items can be locked in two modes : 1 . exclusive (X) mode . Data item can be both read as well as written. X-lock is requested using lock-X instruction. 2 . shared (S) mode . Data item can only be read. S-lock is requested using lock-S instruction. Lock requests are made to concurrency-control manager. Transaction can proceed only after request is granted.
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
©Silberschatz, Korth and Sudarshan 16.4 Database System Concepts - 5 th Edition, Sep 12, 2005 Lock-Based Protocols (Cont.) Lock-Based Protocols (Cont.) Lock-compatibility matrix A transaction may be granted a lock on an item if the requested lock is compatible with locks already held on the item by other transactions Any number of transactions can hold shared locks on an item, but if any transaction holds an exclusive on the item no other transaction may hold any lock on the item. If a lock cannot be granted, the requesting transaction is made to wait till all incompatible locks held by other transactions have been released. The lock is then granted.
Background image of page 4
©Silberschatz, Korth and Sudarshan 16.5 Database System Concepts - 5 th Edition, Sep 12, 2005 Lock-Based Protocols (Cont.) Lock-Based Protocols (Cont.) Example of a transaction performing locking: T 2 : lock-S (A) ; read (A) ; unlock (A) ; lock-S (B) ; read (B) ; unlock (B) ; display (A+B) Locking as above is not sufficient to guarantee serializability — if A and B get updated in-between the read of A and B , the displayed sum would be wrong. A
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 6
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 19

chapter16 - Chapter 16 : Concurrency Control Database...

This preview shows document pages 1 - 6. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online