Jump to content

Read–write conflict

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Yobot (talk | contribs) at 21:43, 18 April 2013 (WP:CHECKWIKI error fixes - Replaced special characters in sortkey using AWB (9095)). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

In computer science, in the field of databases, Read-Write Conflict, also known as unrepeatable reads, is a computational anomaly associated with interleaved execution of transactions.

Given a schedule S

In this example, T1 has read the original value of A, and is waiting for T2 to finish. T2 also reads the original value of A, overwrites A, and commits.

However, when T1 reads to A, it discovers two different versions of A, and T1 would be forced to abort, because T1 would not know what to do. This is an unrepeatable read. This could never occur in a serial schedule. Strict two-phase locking (Strict 2PL) prevents this conflict.

Real world example

Alice and Bob are using Ticketmaster website to book tickets for a specific show. Only one ticket is left for the specific show. Alice signs on to Ticketmaster first and finds one left, and finds it expensive. Alice takes time to decide. Bob signs on and finds one ticket left, orders it instantly. Bob purchases and logs off. Alice decides to buy a ticket, to find there are no tickets. This is a typical Read-Write Conflict situation.

See also