Summary of 8 April 1997

Karthik Lakshminarayanan


We covered the following topics on April 8

Problems in 2 Phase Locking

There are chiefly two problems in 2 phase locking: The solution is to use

Conflict resolution rules

The Wait-die algorithm
   if( T1 < T2 )    // T1 older
      then T1 waits
   else T1 aborts
The Wound-wait algorithm
   if( T1 < T2 )    // T1 older
      then T1 wounds T2
   else T1 waits
The advantage of the above method is that there is no possibility of deadlock, as time is a linear order and you cannot have cycles in a linear order. The flip side is that this is a cautious approach, aborting at the slightest indication of a problem, and one does not try hard enough.

Hierarchical structure of data

There are three rules that are to be followed before locking a resource: An example of the locking and unlocking pattern that can follow is:
Example operations
Figure
lock B

lock D
use D
lock I
unlock D
lock G
use G
unlock I
unlock G

unlock B

Basic TimeStamp Ordering

Each object has: Each transaction has a TS that it appends to all operations:
  • read(object, TS)
  • write(object, TS)
  • The rules of the algorithm are:
    read(object, TS)	
        if TS < W-ts(object) then abort
        else R-ts(object) = max(R-ts(object),TS)
    
    write(object, TS)	
        if TS < R-ts(object) or TS < W-ts(object) 
    	then abort
        else W-ts(object) = TS
    
    
    Although the basic timestamp ordering algorithm does not use locks, it still has aborts. The approach used in the multiversion timestamp algorithm is that it allows operations that did not happen that way but are not inconsistent with history. So a read operation never has an abort and a write operation can have an abort only if it tries to overwrite a newer value with an outdated value and there is a read operation following the write.

    Multiversion TimeStamp Ordering

    For each data object, maintain versions of: The rules of the algorithm are:

    Roundup

    There is a lot of redundancy in maintaining all the lists but Timestamp algorithms provide another method of solving concurrency problems especially when we need an optimistic rather than a conservative approach.