Four Concurrency Problems

If locking is not available and several users access a database concurrently, four problems may occur if their transactions use the same data at the same time. The four problems are:

The Lost Update Problem

The lost update problem arises when two or more transactions select the same row and then update the row based on the value originally selected. Because each transaction is unaware of other transactions, the last update overwrites the updates made by the other transactions. Therefore, data has been lost.

For example, two editors make an electronic copy of the same document. Each editor changes her copy independently and then saves the changed copy, thereby overwriting the original document. The editor who saves her changed copy last overwrites changes made by the first editor. The first editor’s work has been lost without her knowing it, causing problems later on. It would be better if the second editor could not make changes until the first editor had finished.

The Uncommitted Dependency Problem (Dirty Read)

For example, an editor is making changes to an electronic document. During the changes, a second editor takes a copy of the document that includes all the changes made so far, and distributes it to the intended audience. The first editor then decides the changes made so far are wrong and removes the edits and saves the document. The distributed document contains edits that no longer exist, and should be treated as if they never existed. It would be better if no one could read the changed document until the first editor determined that the changes were final.

The Inconsistent Analysis Problem (Nonrepeatable Read)

For example, an editor reads the same document twice, but between each reading, the writer rewrites the document. When the editor reads the document for the second time, it has completely changed. The original read was not repeatable, leading to confusion. It would be better if the editor could read the document only after the writer has completely finished writing it.

The Phantom Read Problem (Phantom)

For example, an editor reads and edits a document submitted by a writer, but when the edits are being incorporated into the master copy of the document by the production department, they find that new, unedited material has been added to the document by the author. The document contains new material that previously did not exist, leading to confusion and problems. It would be better if no one could add new material to the document until the editor and production department finishes working with the original document.

  


(c) 1988-98 Microsoft Corporation. All Rights Reserved.