首页 > 试题广场 >

Show that the two-phase lockin

[问答题]
Show that the two-phase locking protocol ensures conflict serializability.
推荐
A schedule refers to the execution sequence of the operations for one or more transactions.A serial schedule is the situation where each transaction of a schedule is performed atomically.If a schedule consists of two different transactions where consecutive operations from the different transactions access the same data and at least one of the operations is a write,then we have what is known as a conflict.If a schedule can be transformed into a serial schedule by a series of swaps on nonconflicting operations,we say that such a schedule is conflict serializable.
The two-phase locking protocol ensures conflict serializabilty because exclusive locks (which are used for write operations) must be acquired serially,without releasing any locks during the acquire (growing) phase.Other transactions that wish to acquire the same locks must wait for the first transaction to begin releasing locks.By requiring that all locks must first be acquired before releasing any locks,we are ensuring that potential conflicts are avoided.
发表于 2018-05-05 22:16:35 回复(0)