written 2.6 years ago by |
Transaction
Collection of operations that form a single logical unit of work.
A transaction is a unit of program execution that accesses and possibly update various data items.
Example:
Bank balance $=₹ 100$ Initial State
Balance $=$ Balance $-10$ Transaction Bank balance $=₹ 90$ Final State
- A transaction is a logical unit of work that must be either entirely completed or aborted.
Transaction
Transaction access data using two operations
Read(x) - It transfer the data item x from database to a local buffer belonging to the transaction that executed the read operation.
Write(x) - It transfer the data item x from local buffer of the transaction that executed the write back to the database.
Example : Transaction to transfer 100 from account A to account B.
read(A) Let A = 300 (Initial State)
A = A -100 A = 300-100
write ( A) A = 200
read( B) Let B = 500 (Initial State)
B = B +100 B = 500 +100
write (B) B = 600
Transaction
• Two main issues -
1) Various types of failure like hardware failure and system crashes.
2) Concurrent execution of multiple transaction.