presearch
Transaction processing and Concurrency Control | Tech Hindi Sagar
Rajnish kumar

Tech Hindi Sagar

Tech Hindi Sagar website Is Stunning Website Created For Educational Purposes. it Archive And Support Student And Teacher Learning,Facilitating, Questioning And By Providing Contexts For Engaging In Higher-Order Thinking.The Use Of Blogs Has Become Popular In Education Institutions Including Public Schools And Colleges. Blogs Can Be Useful Tools For Sharing Information And Tips Among Co-Workers, Providing Information For Students, Or Keeping In Contact With Parents.
Home Project Tutorial Videos Quiz
All Tutorial will be uploaded as soon as posible .Our Vision is Fun and Free Education for ALL Our Mission To bring all feasible courses , online..

Transaction processing and Concurrency Control



Transaction Processing and Concurrency Control: Transaction Processing Concepts, Concurrency Control Techniques: Two-phase Locking, Timestamp Ordering, Multiversion, Validation, Multiple Granularity Locking.

Definition - What does 
Transaction Process System (TPS) mean?
A transaction process system (TPS) is an information processing system for business transactions involving the collection, modification and retrieval of all transaction data. Characteristics of a TPS include performance, reliability and consistency.
TPS is also known as transaction processing or real-time processing
Example of a Transaction T
read(A,x)
x := x - 200
write(x,A)                 Transaction Schedule reflects
read(B,y)                  chronological order of operations
y := y + 100
write(y,B)

Concept of transaction
v  A transaction is the execution of a program that accesses or changes the contents of a database
v  It is a logical unit of work (LUW) on the database that is either completed in its entirety (COMMIT) or not done at all. In the latter case, the transaction has to clean up its own mess, known as ROLLBACK.
v  A transaction could be an entire program, a portion of a program or a single command.
v  The concept of a transaction is inherently about organising functions to manage data.
v  A transaction may be distributed (available on different physical systems or organised into different logical subsystems) and/or use data concurrently with multiple users for different purposes.
v  Online transaction processing (OLTP) systems support a large number of concurrent transactions without imposing excessive delays.

Transaction states and additional operations
For recovery purposes, a system always keeps track of when a transaction starts, terminates, and commits or aborts. Hence, the recovery manager keeps track of the following transaction states and operations:
·   BEGIN_TRANSACTION: This marks the beginning of transac- tion execution.
·   READ or WRITE: These specify read or write operations on the database items that are executed as part of a transaction.
·   END_TRANSACTION: This specifies that read and write opera- tions have ended and marks the end limit of transaction execution. How- ever, at this point it may be necessary to check whether the changes in- troduced by the transaction can be permanently applied to the database (committed) or whether the transaction has to be aborted because it vio- lates concurrency control, or for some other reason (rollback).
·   COMMIT_TRANSACTION: This signals a successful end of the transaction so that any changes (updates) executed by the transaction can be safely committed to the database and will not be undone.
·   ROLLBACK (or ABORT): This signals the transaction has ended unsuccessfully, so that any changes or effects that the transaction may have applied to the database must be undone.
In addition to the preceding operations, some recovery techniques require additional operations that include the following:
   UNDO: Similar to rollback, except that it applies to a single operation rather than to a whole transaction.
   REDO: This specifies that certain transaction operations must be redone to ensure that all the operations of a committed transaction have been applied successfully to the database.
A state transaction diagram is shown below:


A transaction goes into an active state immediately after it starts execution, where it can issue read and write operations. When the transaction ends, it moves to the partially committed state. At this point, some concurrency control techniques require that certain checks be made to ensure that the transaction did not interfere with other executing transactions. In addition, some recovery protocols are needed to ensure that a system failure will not result in inability to record the changes of the transaction permanently. Once both checks are successful, the transaction is said to have reached its commit point and enters the committed state. Once a transaction enters the committed state, it has concluded its execution successfully.
However, a transaction can go to the failed state if one of the checks fails or if it aborted during its active state. The transaction may then have to be rolled back to undo the effect of its write operations on the database. The terminated state corresponds to the transaction leaving the system. Failed or aborted transactions may be restarted later, either automatically or after being resubmitted, as brand new transactions.
Transaction problems
The practical aspects of transactions are about keeping control. There are a variety of causes of transaction failure. These may include:
  Concurrency control enforcement: Concurrency control method may abort the transaction, to be restarted later, because it violates serialisability (the need for transactions to be executed in an equivalent way as would have resulted if they had been executed sequentially), or because several transactions are in a state of deadlock.
   Local error detected by the transaction: During transaction executions, certain conditions may occur that necessitate cancellation of the trans- action (e.g. an account with insufficient funds may cause a withdrawal transaction from that account to be cancelled). This may be done by a programmed ABORT in the transaction itself.
   A transaction or system error: Some operation in the transaction may cause it to fail, such as integer overflow, division by zero, erroneous pa- rameter values or logical programming errors.
   User interruption of the transaction during its execution, e.g. by issuing a control-C in a VAX/ VMS or UNIX environment.
   System software errors that result in abnormal termination or destruction of the database management system.
   Crashes due to hardware malfunction, resulting in loss of internal (main and cache) memory (otherwise known as system crashes).
   Disk malfunctions such as read or write malfunction, or a disk read/write head crash. This may happen during a read or write operation of theransaction.


Desirable properties of transactions (ACID)
The acronym ACID indicates the properties of any well-formed transaction. Any transaction that violates these principles will cause failures of concurrency. A brief description of each property is given first, followed by detailed discussions.
1. Atomicity: A transaction is an atomic unit of processing; it is either performed in its entirety or not performed at all. A transaction does not partly happen.
2. Consistency: The database state is consistent at the end of a transaction.
3. Isolation: A transaction should not make its updates visible to other transactions until it is committed; this property, when enforced strictly, solves the temporary update problem and makes cascading rollbacks (see ‘Atomicity’ below) of transactions unnecessary.
4. Durability: When a transaction has made a change to the database state and the change is committed, this change is permanent and should be available to all other transactions.


Concurrency Control

Concurrency control is the procedure in DBMS for managing simultaneous operations without conflicting with each another.

Concurrency control is provided in a database to:
·         (i) enforce isolation among transactions.
·         (ii) preserve database consistency through consistency preserving execution of transactions.
·         (iii) resolve read-write and write-read conflicts.
concurrency control techniques are required to control the interaction among concurrent transactions. These techniques ensure that the concurrent transactions maintain the integrity of a database by avoiding the interference among them.

Various concurrency control techniques are:

1. Two-phase locking Protocol
2. Time stamp ordering Protocol 
3. Multi version concurrency control 
4. Validation concurrency control

SHARE

About Admin of the Blog:

Rajnish kumar is the CEO/founder of Tech Hindi Sagar .He is a Computer Science Engineer ,Web Designer,Web Developer and a Pro Blogger..Inspired to make things looks better.

  • Image
  • Image
  • Image
  • Image
  • Image
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment