Reputation: 131
what is meant by the concurrent execution of database transactions in a multiuser system? why concurrency control is needed?
I'm having trouble with this. and what are some informal examples for concurrency control. any help would be greatly appreciated.
Upvotes: 13
Views: 27349
Reputation: 1
Concurrent execution of database transactions in a multi-user system is where any number of users can use the same database at the same time. Concurrency control is needed in order to avoid inconsistencies in the database. Examples Assume that there are two administrators oliver and gorge who have access to the same users’ database record in an organization. Oliver is trying to update one of the records of a particular user at the same time Ross is trying to update a record of the same user. If there are no proper ways of dealing with the simultaneous access of this data, possibly the final result of the updated data of that user might be inaccurate
Upvotes: -1
Reputation: 847
My english is not so good but I am trying my best to answer the term mentioned.
In my view, the action will be too fast that it seems doing the work by the number of users at the same time. Doing the work at the same time means doing the work parallelly but this doesn't happen in the case of concurrent.
Concurrency
is when two tasks can start, run, and complete in overlapping time periods. It doesn't necessarily mean they'll ever both be running at the same instant.
Eg. multitasking on a single-core machine.
Upvotes: 0
Reputation: 161
Concurrent execution of database transactions in a multi-user system means that any number of users can use the same database at the same time. Concurrency control is needed in order to avoid inconsistencies in the database.
Here is an example of how this scenario can lead to an inconsistency:
Assume we have two users, Alice and Bob, who both have access to the same bank account. Alice wants to deposit $100 and Bob wants to withdraw $200. Assuming there is $500 in the account, here is how the execution might take place if they perform their actions at the same time:
New balance after both actions should be $400. Now the database is in an inconsistent state.
Concurrency control can prevent inconsistencies by providing Alice with a temporary "lock" on the database until she is done with her action.
Upvotes: 16
Reputation: 25759
Well, it is as simple as this... Say you have a bank, and simultaneously two persons try to withdraw €100 from an account with €100 on it. These are concurrent operations.
You need to make sure that only one of them manage to withdraw 100€. This is concurrency handling.
Upvotes: 5