A major objective in developing a database is to enable many users to access shared data
concurrently. Concurrent access is relatively easy if all users are only reading data, as there
is no way that they can interfere with one another. However, when two or more users are
accessing the database simultaneously and at least one is updating data, there may be inter-ference that can result in inconsistencies.
This objective is similar to the objective of multi-user computer systems, which allow
two or more programs (or transactions) to execute at the same time. For example, many
systems have input/output (I /O) subsystems that can handle I /O operations independently,
while the main central processing unit (CPU) performs other operations. Such systems can
allow two or more transactions to execute simultaneously. The system begins executing
the first transaction until it reaches an I /O operation. While the I /O is being performed, the
CPU suspends the first transaction and executes commands from the second transaction.
When the second transaction reaches an I /O operation, control then returns to the first
transaction and its operations are resumed from the point at which it was suspended.
The first transaction continues until it again reaches another I /O operation. In this way, the
operations of the two transactions are interleaved to achieve concurrent execution. In
addition, throughput – the amount of work that is accomplished in a given time interval
– is improved as the CPU is executing other transactions instead of being in an idle state
waiting for I/O operations to complete.
However, although two transactions may be perfectly correct in themselves, the inter-leaving of operations in this way may produce an incorrect result, thus compromising the
integrity and consistency of the database. We examine three examples of potential prob-lems caused by concurrency: the lost update problem , the uncommitted dependency
problem , and the inconsistent analysis problem . To illustrate these problems, we use a
simple bank account relation that contains the DreamHomestaff account balances. In this
context, we are using the transaction as the unit of concurrency control.