0% found this document useful (0 votes)
129 views

DBMS Concurrency Control

dbms
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
129 views

DBMS Concurrency Control

dbms
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

6/10/2014

HOME

DBMS Concurrency Control

JAVA

PHP

Python

Ruby

Perl

HTML

CSS

Javascript

MySQL

C++

UNIX

MORE...

DBMS Concurrency Control


Advertisements

Previous Page

In a multiprogramming environment where more than one transactions can be concurren


there exists a need of protocols to control the concurrency of transaction to ensure a
isolation properties of transactions.

Concurrency control protocols, which ensure serializability of transactions, are mos


Concurrency control protocols can be broadly divided into two categories:
Lock based protocols

DBMS Tutorial
DBMS Home
DBMS Overview
DBMS Architecture
DBMS Data Models
DBMS Data Schemas
DBMS Data Independence

Entity Relationship Model

Time stamp based protocols

Lock based protocols

Database systems, which are equipped with lock-based protocols, use mechanism b
transaction cannot read or write data until it acquires appropriate lock on it first. Locks are o

Binary Locks: a lock on data item can be in two states; it is either locked or unlocked

Shared/exclusive: this type of locking mechanism differentiates lock based on the


lock is acquired on a data item to perform a write operation, it is exclusive lock.
more than one transactions to write on same data item would lead the datab
inconsistent state. Read locks are shared because no data value is being changed.
There are four types lock protocols available:

ER Model Basic Concepts

Simplistic

ER Diagram Representation
Generalization, Aggregation

Simplistic lock based protocols allow transaction to obtain lock on every object b
operation is performed. As soon as 'write' has been done, transactions may unlo
item.

Relational Model

Pre-claiming

DBMS Codd's Rules

In this protocol, a transactions evaluations its operations and creates a list of da


which it needs locks. Before starting the execution, transaction requests the system
it needs beforehand. If all the locks are granted, the transaction executes and rele
locks when all its operations are over. Else if all the locks are not granted, the tran
back and waits until all locks are granted.

Relational Data Model


Relational Algebra
ER to Relational Model
SQL Overview

Relational Database Design


Database Normalization
Database Joins

[Image: Pre-claiming]
Two Phase Locking - 2PL

This locking protocol is divides transaction execution phase into three parts.
when transaction starts executing, transaction seeks grant for locks it needs as
Second part is where the transaction acquires all locks and no other lock
Transaction keeps executing its operation. As soon as the transaction releases its f
third phase starts. In this phase a transaction cannot demand for any lock but only r

http://www.tutorialspoint.com/dbms/dbms_concurrency_control.htm

1/3

6/10/2014

Storage and File Structure

DBMS Concurrency Control

acquired locks.

DBMS Storage System


DBMS File Structure

Indexing and Hashing


DBMS Indexing
DBMS Hashing

Transaction And
Concurrency
DBMS Transaction

[Image: Two Phase Locking]

Two phase locking has two phases, one is growing; where all locks are being
transaction and second one is shrinking, where locks held by the transaction
released.

To claim an exclusive (write) lock, a transaction must first acquire a shared (read) lo
upgrade it to exclusive lock.
Strict Two Phase Locking

The first phase of Strict-2PL is same as 2PL. After acquiring all locks in the
transaction continues to execute normally. But in contrast to 2PL, Strict-2PL does
lock as soon as it is no more required, but it holds all locks until commit state arrive
releases all locks at once at commit point.

DBMS Concurrency Control


DBMS Deadlock

Backup and Recovery


DBMS Data Backup

[Image: Strict Two Phase Locking]


Strict-2PL does not have cascading abort as 2PL does.

Time stamp based protocols

DBMS Data Recovery

The most commonly used concurrency protocol is time-stamp based protocol. This pr
either system time or logical counter to be used as a time-stamp.

DBMS Useful Resources

Lock based protocols manage the order between conflicting pairs among transaction a
execution whereas time-stamp based protocols start working as soon as transaction is cre

DBMS Quick Guide


DBMS Useful Resources

Selected Reading
Developer's Best Practices
Effective Resume Writing
Computer Glossary
Who is Who

Every transaction has a time-stamp associated with it and the ordering is determined by th
transaction. A transaction created at 0002 clock time would be older than all other transa
come after it. For example, any transaction 'y' entering the system at 0004 is two seconds
priority may be given to the older one.

In addition, every data item is given the latest read and write-timestamp. This lets the sy
when was last read and write operation made on the data item.

TIME-STAMP ORDERING PROTOCOL

The timestamp-ordering protocol ensures serializability among transaction in their conflicti


write operations. This is the responsibility of the protocol system that the conflicting p
should be executed according to the timestamp values of the transactions.
Time-stamp of Transaction Ti is denoted as TS(Ti).
Read time-stamp of data-item X is denoted by R-timestamp(X).
Write time-stamp of data-item X is denoted by W-timestamp(X).
Timestamp ordering protocol works as follows:
If a transaction Ti issues read(X) operation:
If TS(Ti) < W-timestamp(X)
Operation rejected.
If TS(Ti) >= W-timestamp(X)
Operation executed.
All data-item Timestamps updated.

If a transaction Ti issues write(X) operation:


If TS(Ti) < R-timestamp(X)
http://www.tutorialspoint.com/dbms/dbms_concurrency_control.htm

2/3

6/10/2014

DBMS Concurrency Control

Operation rejected.
If TS(Ti) < W-timestamp(X)
Operation rejected and Ti rolled back.
Otherwise, operation executed.

THOMAS' WRITE RULE:


This rule states that in case of:
If TS(Ti) < W-timestamp(X)

Operation rejected and Ti rolled back. Timestamp ordering rules can be modified to m
schedule view serializable. Instead of making Ti rolled back, the 'write' operation itse

Previous Page

Print Version

Advertisements

ASP.NET | jQuery | AJAX | ANT | JSP | Servlets | log4j | iBATIS | Hibernate | JDBC | Struts |

Copyright 2014 by tutorialspoint. All Rights Reserved.

http://www.tutorialspoint.com/dbms/dbms_concurrency_control.htm

3/3

You might also like