A transaction is defined as a logical unit of work which happen in its entirity or not at all.
ACID Property
1-Atomicity-Either all or none.there is no partial result.an event either happens and is commited or fails and rollback.
2-Consistency-Transaction must bring the database from one consistent state to another consistent state.
3-Isolation-Each transaction should feel that it is the only which is executing in the system but in realting some others also may execute.
4-Durability-The changes made by a transaction is permanent in nature unless another transaction makes the charge to the database.
Execution of transaction-
1-Serial execution
2-Concurrent execution
1-Serial execution-All the operation of a transaction complete then operation of other transaction will start.no intermixing / interleaving of operations of transaction.
Example
T1,T2,T3
n=2 transaction
T1 T2
T2 T1
n=3 transaction
T1 T2 T3
T1 T3 T2
T2 T1 T3
T2 T3 T1
T3 T1 T2
T3 T2 T1
if n is number of transaction in a system then-
Total number of serial execution=n!
2-Concurrent execution-Interleaving of operations of different transactions.it leads to more resourse utilization and thoughtput, reduced waiting time.if operationare not interleaved properly then it causes some problems also.
Copyright ©2022 coderraj.com. All Rights Reserved.