ch16 - Chapter16:ConcurrencyControl Version:Oct5,2006...

Info icon This 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  Version: Oct 5, 2006
Image of page 1

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

View Full Document Right Arrow Icon
© Silberschatz, Korth and Sudarshan 16.<number> Database System Concepts - 5 th  Edition Chapter 16: Concurrency Control Chapter 16: Concurrency Control Lock-Based Protocols Timestamp-Based Protocols Validation-Based Protocols Multiple Granularity Multiversion Schemes Insert and Delete Operations Concurrency in Index Structures
Image of page 2
© Silberschatz, Korth and Sudarshan 16.<number> Database System Concepts - 5 th  Edition 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.
Image of page 3

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

View Full Document Right Arrow Icon
© Silberschatz, Korth and Sudarshan 16.<number> Database System Concepts - 5 th  Edition 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.
Image of page 4
© Silberschatz, Korth and Sudarshan 16.<number> Database System Concepts - 5 th  Edition 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.
Image of page 5

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

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

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern