Clerk 2 applies a different transaction to his saved copy, and saves the result, based on the original record and his changes, overwriting the transaction entered by clerk 1.
Records can never be saved so as to overwrite other changes, preserving data integrity.
[1] If the bank clerks (to follow the illustration above) are serving two customers, but their accounts are contained in one ledger, then the entire ledger, or one or more database tables, would need to be made available for editing to the clerks in order for each to complete a transaction, one at a time (file locking).
A higher degree of granularity is achieved if each individual account may be taken by a clerk.
The introduction of granular (subset) locks creates the possibility for a situation called deadlock.
Unknowingly, the two clerks are waiting for each other, and neither of them can complete their transaction until the other gives up and returns the account.
The entities that request a lock can be either individual applications (programs) or an entire processor.
The application or system should be designed such that any lock is held for the shortest time possible.
waiters) can be held in a list that is serviced in a round-robin fashion, or in a FIFO queue.