explain concurrency and locks
Database concurrency controls ensure that the transactions occur in an ordered fashion.
Concurrency control deals with the issue involved with allowing multiple people simultaneous access to shared entities.
In database, a lock is used to access a database concurrently for multiple users. This prevents data from being corrupted or invalidated when multiple users try to write to the database. Any single user can only modify those database records (that is, items in the database) to which they have applied a lock that gives them exclusive access to the record until the lock is released.