Concurrency Control in transaction management | Database management
CONCURRENT EXECUTION-
Transaction processing systems usually allow multiple transactions to run concurrently.By allowing multiple transactions to run concurrently will improve the performance of the system in terms of increased throughput or improved response time but this allows causes several complications with consistency of the data.
EXAMPLE-To illustrate the concept of concurrency control, consider two travelers who go to electronic kiosks at the same time to purchase a train ticket to the same destination on the same train. There's only one seat left in the coach, but without concurrency control, it's possible that both travelers will end up purchasing a ticket for that one seat. However, with concurrency control, the database wouldn't allow this to happen. Both travelers would still be able to access the train seating database, but concurrency control would preserve data accuracy and allow only one traveler to purchase the seat.
ADVANTAGES OF CONCURRENT EXECUTION-
1. Improved throughput
2. Reduced Waiting time
CONCURRENCY CONTROL-
Process of managing simultaneous execution of transactions in a shared database, to ensure the serializability of transactions, is known as concurrency control.
WHY WE NEED CONCURRENCY CONTROL?
Simultaneous execution of transactions over a shared database can create several data integrity and consistency problems:-
1.Lost Updates(write-write conflict)
2.Dirty Read Problem(write-read conflict)
3.Unrepeatable reads(Read-Write conflict)
PROBLEMS OF CONCURRENCY CONTROL OR TYPES OF CONFLICT OPERATIONS-
1.Lost Updates(write-write conflict)-A lost update problem occurs when two transactions that access the same database items have their operations in a way that makes the value of some database item incorrect. E.G.- if Transaction T1 and T2 both read a record and then update it,the effects of the first update will be overwritten by the second update.It occurs in case of write-write conflict.
2.Dirty Read Problem(write-read conflict)-A dirty read problem occurs when one transaction updates a database item and then the transaction fails for some reason. The updated database item is read or accessed by another transaction before it is changed back to the original value. E.G.- a transaction T1 updates a record ,which is read by the transaction T2 then T1 aborts and T2 now has values which have never formed part of stable database or we can say T1 reads a dirty data.It occurs in case of write-read conflict.
3.Unrepeatable reads(Read-Write conflict)-Read-Write conflict occurs if a transaction writes a data object previously read by another transaction.It means a transaction reads several values from a database while second transaction updates some of them.
0 comments:
Post a Comment