Concurrency issues happen in multiuser environment when multiple people update the same data at the same time.
Below is the sequence of events how concurrency issues can happen:-
- User A fetches data with value “X” and starts changing this value to “Y”.
- User B also fetches the same “X” data and starts changing this value to “Z”.
- Now User B first updates the data to database. In other words he changes the data to “Z”.
- Now User A also sends the update to database. In other words he changes the data to “Y”.
Now User A thinks he has changed “X” to “Y” and User B thinks the current data is “Z”. Both of them are wrong and this leads to confusion termed as “Concurrency” problem.
Below is a nice video on c# indexer interview question with explanation.