Comparison of Methods for Concurrency Control in Distributed System

Comparison of Methods for Concurrency Control in Distributed System

In this tutorial you are going to learn about Comparison of Methods for Concurrency Control in Distributed System.

In a user environment sometimes different users simultaneously try to access the same piece of data. This is known as concurrency. If there is no concurrency control by the DBMS, important data may be lost.

Each server manages a set of objects and is responsible for ensuring that they remain consistent when accessed by concurrent transactions.

In order to explain the concept of concurrency, let's take an example of an ATM system in a banking environment.

  1. Suppose two person’s A and B have a joint account and both have ATM cards to use this Bank account.
  2. On the particular day both A and B try to use their ATM cards at different ATM terminals but exactly at the same time.

Concurrency Controls in Distributed System

  1. Lock based protocol: A lock is applied to avoid concurrency problems between two transactions in such a way that the lock is applied on one transaction and another transaction can access it only when lock is released. The lock is applied on read and write operations. It is a very important method to avoid deadlocks.
  2. Shared lock system: The transaction can activate shared lock on the data to read its content. The lock is shared in such a way that any transaction can activate the shown lock on the same database for reading purposes.
  3. Exclusive lock:The transaction can activate exclusive lock on a data to read and write operation. In this system no other transaction can activate any kind of lock on that same data.

Comparison Methods for Concurrency Control

  1. Locking concurrency control: Lock is a data variable associated with the data item.A lock states what operation can be performed on a data item. A lock helps to synchronize access to the database items by concurrent transaction. Lock requests are made to the currency control manager. The locking schemes are used to restrict the availability of the data object for other transactions one time one transaction, so there will not be any conflict.
    • In the distributed transaction, the locks on an object are held locally in the same server.
    • The local lock manager can decide whether to grant a lock or make the requesting transaction wait.
  2. Timestamp concurrency control: It works on the checking of the timestamp. It is the start of a transaction which is generated by a logical clock. In a single server transaction, the coordinator issues a unique timestamp to each transaction when it starts.

    Rules of ordering:

    • A transaction’s request to write an object is valid only if that object was last read and written by an earlier transaction.
    • A transaction’s request to read an object is valid only if that object was last written by an earlier transaction. Ts(T1)<Ts(Ts)
  3. Optimistic concurrency control: All transactions are allowed to proceed, but some are started when they attempt to commit. This results in relatively efficient operations when there are few conflicts. Each transaction is validated before it is allowed to commit.

This article on Comparison of Methods for Concurrency Control in Distributed System is contributed by Hemalatha P. If you like TheCode11 and would like to contribute, you can also write your article and mail to

Previous Post Next Post

Contact Form