Showing posts with label Database. Show all posts
Showing posts with label Database. Show all posts

Tuesday, September 13, 2011

Concurrency Control

Maintaining synchronization among concurrently executing processes is a challenging task. Hence a general idea is use LOCK constructs on data item to maintain consistency and access control to them. The idea is that at a time if one process or thread is updating some variable then no other thread or process can either write or even read the same variable. Various Locking protocols are :--->
1. Two phase Locking
  1.1 Strict Two phase Locking
  1.2 Rigorous Two phase Locking
2. Graph Protocol
3. Time Stamp Protocol
4. Validation based protocol



One of very strange thing was if there are more than one copies of a variable present in distributed manner, then how to do updation ? is it necessary to update all the copies ?? sometimes it is not possible and not even efficient to update them all. 
There is one protocol developed for the same problem which i really liked very much. Its m isto n protocol (dont' remember the exact name).

According to this protocol, when you are trying to read some value whose values are distributed among different machines, to avoid inconsistency and to maintain efficiency, update atleast half of the values. Similarly, while reading read from atleast half the values.

Serializability


1. Conflict Serializable :-- If a given schedule can be converted to another one without swapping two conflicting instructions then its conflict serializable. (A bit more strict)
Testing whether a particular schedule is conflict serializabile is a simple polynomial time complex problem. 

2. View Serializable :-- A superset of above, where for external person two schedule produce same output and no inconsistency. ( A bit more lenient)
Testing whether a particular schedule is view serializable is an NP complete problem.