Wednesday, October 1, 2008

On Optimistic Methods for Concurrency Control, Kung & Robinson

A lock-free approach to concurrency control is presented as a solution to certain disadvantages associated with locking. One of the biggest premises of this "optimistic" approach is that locking is rarely needed in certain applications, the only concrete examples being concurrent B-tree insertions and query-dominant systems. The approach removes all restrictions from reads and instead places restrictions on writes. It breaks transactions into read, validation, and (optional) write phases. Changes from writes are first made on copies of nodes, and the changes are swapped into the global nodes only after successful validation.

Upon failure to validate, the transaction is simply rolled back to start again. However, upon numerous failed validations, the fall-back is essentially to write-lock the entire database until the transaction runs to completion. The given technique of serial validation with transaction numbers only holds for one CPU, and things get a little messier for multiple processors, involving multiple stages of validation. This paper presented two applications in which the "optimistic" strategy might perform better than locking but doesn't offer any new insights into figuring out when the optimistic solution is preferable to a locking one.

No comments: