concurrent transactions

15
1 chnical Seminar - 2004 Presented By:- Soumya Ranjan Biswal(IT200118069) CONCURRENT TRANSACTIONS Under the guidance of Mr. Anisur Rahman Presented By Soumya Ranjan Biswal Roll no-IT200118069

Upload: lipika008

Post on 16-Nov-2014

1.249 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Concurrent Transactions

1

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

CONCURRENT TRANSACTIONS

Under the guidance of

Mr. Anisur Rahman

Presented By

Soumya Ranjan Biswal

Roll no-IT200118069

Page 2: Concurrent Transactions

2

Introduction

• A transaction is a unit of program execution that accesses and possibly updates various data items in a database system.

• The transactions are required to have the ACID properties: atomicity, consistency, isolation, and durability.

• Transaction processing system usually allows both single as well as multiple transactions to run.

• Concurrent execution of transactions improves throughput of transactions & system utilization & also reduces the waiting time of transactions.

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Page 3: Concurrent Transactions

3

Transaction Concepts

• A transaction has the following properties:

Atomicity: All operations of the transaction are reflected properly in the database, or none are.

Consistency: Execution of transaction in isolation preserves the consistency of the database.

Isolation: In this each transaction is unaware of other transactions executing concurrently in the

system.

Durability: After a transaction completes properly, the changes it has made to the database is retained even if there are system failures.

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Page 4: Concurrent Transactions

4

Transaction State

• A transaction from the beginning to the end, must be in one of the following states:

Active –Transaction stays here while executing.

Partially Committed - After the final statement has been executed.

Failed – If normal execution can no longer proceed.

Aborted – Transaction has been rolled back & database restored to its prior state.

Committed – Transaction is successful.

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Page 5: Concurrent Transactions

5

Concurrent Execution

• Concurrent execution means running side by side or parallely of transactions.

• Advantages of Concurrent execution are: Improved throughput & Resource utilization – i.e. no.

of transactions executed increases in a given amount of time & the processor is utilized properly.

Reduced Waiting time – The unpredictable delays in running transactions as well as the average response

time is reduced.

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Page 6: Concurrent Transactions

6

Serializability

• The transaction is a unit that preserves consistency, and serial execution of transaction guarantees that consistency is preserved.

• A schedule in a transaction captures the key action of transaction that affects concurrent execution such as read & write operation.

• So required is that any schedule produced by concurrent processing set of transactions will have an effect equivalent to a schedule produced when these transactions are run serially.

• A system that guarantees this property is said to ensure serializability.

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Page 7: Concurrent Transactions

7

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

• There are 2 types of serializability:

- Conflict serializability

- View serializability

• Serializability of schedules generated by concurrent transactions can be ensured through concurrency control schemes.

• The schedules should have the following properties:

- they must be recoverable.

- they must be cascadeless.

Page 8: Concurrent Transactions

8

• It is a data manipulation language which specifies the set of action that constitute a transaction.

• The SQL standard specifies that the transactions begin explicitly.

• The transactions are ended by any one of the following SQL statements:

- Commit work: commits the current transaction & begins a new one.

- Rollback work: It aborts the current transaction.

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Transaction Definition in SQL

Page 9: Concurrent Transactions

9

• When transactions execute concurrently in the database , the consistency of data may not be preserved . So in order to achieve control , various Concurrency-control schemes are used.

• Concurrency-control schemes are also used to ensure serializability. All these schemes either delay an operation or abort the transaction that issued the operation.

• Most commonly used Concurrency-control schemes are:

-locking protocols

-timestamp based protocols

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Concurrency control

Page 10: Concurrent Transactions

10

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Lock based protocols

• A locking protocol is a set of rules that state when a transaction may lock and unlock each of the data items in the database.

• Two-phase locking protocol: this protocol allows a transaction to lock a new data item only if that transaction has not yet unlocked any data item. This protocol ensures serializability, but not deadlock freedom.

• Strict two-phase locking protocol: It permits release of exclusive locks only at the end of transactions, in order to ensure recoverability and cascadelessness of the resulting schedules.

Page 11: Concurrent Transactions

11

• Rigorous two-phase locking protocol: This protocol releases all locks only at the end of the transaction.

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Lock based protocols

Page 12: Concurrent Transactions

12

• A timestamp-based protocol ensures serializability by selecting an ordering in advance between every pair of transactions.

• It works in the following manner:

-first a unique fixed timestamp is associated with each transaction in the system .

-these timestamps of the transactions determine the serializability order.

-if the timestamp of transaction Ti is smaller than the timestamp of transaction Tm , then the scheme ensures that

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Timestamp-based protocols

Page 13: Concurrent Transactions

13

Timestamp-based protocols

the produced schedule is equivalent to a serial schedule in which transaction Ti appears before transaction Tm.

• It does so by rolling back a transaction whenever such an order is violated.

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)

Page 14: Concurrent Transactions

14

Conclusion

• This topic describes about the various concepts of transaction processing. About what it is and how it works. Furthermore it also gives a good layout about the concepts of Concurrent transactions. And also how Concurrent execution of transactions improves throughput of transactions and system utilization reduces waiting time of transactions etc.Also present in the report are the various concurrency-control schemes which ensure a smooth running of the Concurrent transactions as well as the consistency of the database to be preserved

Presented By:- Soumya Ranjan Biswal(IT200118069)

Page 15: Concurrent Transactions

15

THANK YOU!!!

Technical Seminar - 2004

Presented By:- Soumya Ranjan Biswal(IT200118069)