ch18-Concurrency Control Techniques

ch18-Concurrency Control Techniques - Copyright 2007 Ramez...

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

View Full Document Right Arrow Icon
Slide 18- 1 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe
Background image of page 1

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

View Full DocumentRight Arrow Icon
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 18 Concurrency Control Techniques
Background image of page 2
Slide 18- 3 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Chapter 18 Outline Databases Concurrency Control 1. Purpose of Concurrency Control 2. Two-Phase locking 3. Limitations of CCMs 4. Index Locking 5. Lock Compatibility Matrix 6. Lock Granularity
Background image of page 3

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

View Full DocumentRight Arrow Icon
Slide 18- 4 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Database Concurrency Control 1 Purpose of Concurrency Control To enforce Isolation (through mutual exclusion) among conflicting transactions. To preserve database consistency through consistency preserving execution of transactions. To resolve read-write and write-write conflicts. Example: In concurrent execution environment if T1 conflicts with T2 over a data item A, then the existing concurrency control decides if T1 or T2 should get the A and if the other transaction is rolled-back or waits.
Background image of page 4
Slide 18- 5 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Database Concurrency Control Two-Phase Locking Techniques Locking is an operation which secures (a) permission to Read (b) permission to Write a data item for a transaction. Example: Lock (X). Data item X is locked in behalf of the requesting transaction. Unlocking is an operation which removes these permissions from the data item. Example: Unlock (X): Data item X is made available to all other transactions. Lock and Unlock are Atomic operations.
Background image of page 5

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

View Full DocumentRight Arrow Icon
Slide 18- 6 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Database Concurrency Control Two-Phase Locking Techniques: Essential components Two locks modes: (a) shared (read) (b) exclusive (write). Shared mode: shared lock (X) More than one transaction can apply share lock on X for reading its value but no write lock can be applied on X by any other transaction. Exclusive mode: Write lock (X) Only one write lock on X can exist at any time and no shared lock can be applied by any other transaction on X. Conflict matrix Read Write N N N Y
Background image of page 6
Slide 18- 7 Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Database Concurrency Control Two-Phase Locking Techniques: Essential components Lock Manager: Managing locks on data items. Lock table: Lock manager uses it to store the identify of transaction locking a data item, the data item, lock mode and pointer to the next data item locked. One simple way to implement a lock table is through linked list. T1 Transaction ID Data item id lock mode Ptr to next data item Next X1 Read
Background image of page 7

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

View Full DocumentRight Arrow Icon
Copyright © 2007 Ramez Elmasri and Shamkant B. Navathe Database Concurrency Control Two-Phase Locking Techniques: Essential components Database requires that all transactions should be well-formed. A transaction is well-formed if: It must lock the data item before it reads or writes to it. It must not lock an already locked data items and it
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 47

ch18-Concurrency Control Techniques - Copyright 2007 Ramez...

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

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