Kung-Robinson Model

What
The Kung-Robinson model takes an optimistic approach towards conflicts. That is, it assumes they are rare and defer checking for conflicts until commit time.

Strategy
The model has three phases for each transaction:
 * Read - read the necessary data from the database but make changes to private copies of the objects
 * Validate - check for conflicts
 * Write - Make the private copies of the objects public

Validation
In the validation phase, we apply a minimum set of tests to ensure that no conflict occurred
 * Assign each transaction ($$T_i$$) a timestamp which are assigned at the end of the READ stage
 * ReadSet($$T_i$$) - the set of all objects that were read by the transaction $$T_i$$
 * WriteSet($$T_i$$) - the set of all objects that were modified by the transaction $$T_i$$

Test 1 - Non-Overlapping
Check for every pair of transactions $$T_i$$ and $$T_j$$ such that the timestamp of $$T_i$$ is earlier than the timestamp of $$T_j$$ that $$T_i$$ finishes before $$T_j$$ begins.

Test 2 - No Write Phase Conflict
Check for every pair of transactions $$T_i$$ and $$T_j$$ such that the timestamp of $$T_i$$ is earlier than the timestamp of $$T_j$$ that:
 * $$T_i$$ finishes before the write phase of $$T_j$$
 * The intersection of WriteSet($$T_i$$) and ReadSet($$T_j$$) is empty

Test 3 - Overlapping Write Phases
Check for every pair of transactions $$T_i$$ and $$T_j$$ such that the timestamp of $$T_i$$ is earlier than the timestamp of $$T_j$$ that:
 * $$T_i$$ completes read before $$T_j$$ does
 * The intersection of WriteSet($$T_i$$) and ReadSet($$T_j$$) is empty
 * The intersection of WriteSet($$T_i$$) and WriteSet($$T_j$$) is empty

Overheads

 * We must maintain the ReadSet and WriteSet for each transaction
 * Must check for conflicts during validation and must make changes global
 * The critical section could slow down concurrency
 * Restarts transactions upon failing validation
 * The work that was done is all wasted and needs to be cleaned up