Problems with concurrent access
A key problem with concurrent access is the lost update problem. One client downloads a copy of a record from the server to their machine. While they are editing it another client downloads a copy of the same record. Whichever
of these users saves their data first will have it overwritten by the other.
Deadlock
Record locking can lead to another problem known as deadlock. This is when two or more database transactions are waiting for each other to release record locks. A database needs to be able to recognize when record locking has
occurred and apply serialisation methods to deal with it such as:
* Timestamp ordering
* Commitment ordering
Timestamp ordering
Transactions are given a timestamp when they begin. If two transactions affect the same object in the database then the one with the earlier timestamp should be applied first. Each object in a database also has a read and
write timestamp. When a transaction starts it reads an object and sets the read timestamp, when it goes to write to the object it checks the read stamp and if it has changed since the transaction started then it knows that the
record is being accessed by another transaction and take appropriate action.