Optimistic Concurrency Control

Another technique is the Optimistic Concurrency Control (as opposed to traditional Pessimistic Concurrency Control). It makes logically read-only accesses physically read-only and eliminates writer starvation caused by readers. The idea is that a reader starts reading an object w/o any synchronization (optimistically hoping for success), and when it finishes it verifies that the object was not changed under its feet (verification can be conducted periodically during reading if required). If the object was not changed then it has obtained some consistent view of the object; otherwise he needs to retry reading.

The technique gives very good results wrt scalability in many cases. However there is a caveat: a reader must be prepared for reading inconsistent data, which potentially can cause crashes, infinite looping and other very bad things. This fact significantly limits applicability of the technique.

Next page: State Distribution