Presentation is loading. Please wait.

Presentation is loading. Please wait.

Session - 14 CONCURRENCY CONTROL CONCURRENCY TECHNIQUES Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:

Similar presentations


Presentation on theme: "Session - 14 CONCURRENCY CONTROL CONCURRENCY TECHNIQUES Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:"— Presentation transcript:

1 Session - 14 CONCURRENCY CONTROL CONCURRENCY TECHNIQUES Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:

2 OBJECTIVES Concurrency control techniques, which are Locking method, timestamp method and optimistic methods Both locking and timestamping are essentially conservative approach Optimistic method based on the premise that conflict is rare and allow transaction to proceed unsynchronized and only check for conflicts at the end when a transaction commits.

3 TIMESTAMP METHOD Fundamental goal of timestamping method is to order transactions globally in such a way that older transaction, transaction with smaller timestamps, get priority in the event of conflict Timestamps method produce serializable schedules, which are equivalent to the serial schedule defined by the timestamps of successfully committed transactions

4 TIMESTAMPS IN A DISTRIBUTED ENVIRONMENT No central system clock, each node in the network has its own and there’s no guarantee that these clocks are synchronized with each other Two or more transactions can start simultaneously at different sites in the network. Simple approach to supporting the notion of global time in distributed system is to define global time as concatenation of the local site clock time with the site identifier, that is :

5 Basic Timestamping To implement basic timestamping, the following variables are required : For each data item x ts (read x) = the timestamp of the transaction which last read data item x ts (write x) = the timestamp of the transaction which last update data item x For each transaction T ts (T) = the timestamp assigned to transaction T, when it is launched

6 Write Operation using Basic Timestamping Begin Ti attemps to update (write) data item x if there is an update pending on X (ts(Tj) < ts(Ti)) then Ti wait until Tj is committed or restartes else ti commits update and sets ts(write x) = ts(ti) end if end

7 Conservative Timestamping A modification of basic timestamping Reduce the degree of concurrency but eliminate the need for restart To transaction wait until system knows id can not receive a conflicting request from an older transaction

8 OPTIMISTIC METHODS Optimistic method of concurrency control are based on premise that conflict are rare and that the best approach is to allow transaction to proceed. When transaction wishes to commit, system will check for conflict. If conflict detected, restart the transaction Optimistically allow transaction to proceed as far as possible.

9 OPTIMISTIC METHODS Transaction are executed in three phase : 1.Read phase; represent the body of the transaction up to commit (no write to database during this phase) 2.Validation; the result (updates) of the transaction are examined for conflict 3.Write phase; if the transaction validated, the update are propagated from the transaction- local copy to the database. If during validation, conflict which would result in a loss of integrity are detected, then the transaction is rolled back and restarted

10 Concurrency in replicated database Where a DDBMS support replication, the system must ensure that all copies of the replicated data items are consistent. This can be done by treating the update of replicated data items as a distributed, atomic transaction which can be handle by scheduler in the normal way

11 Concurrency in replicated database Transaction can be executed un three ways : 1.Read phase, during which updates are made to local copies of the data only 2.Validate phase, during which the proposed update is checked for conflict at all sites 3.Write phase, during which the transaction is committed.


Download ppt "Session - 14 CONCURRENCY CONTROL CONCURRENCY TECHNIQUES Matakuliah: M0184 / Pengolahan Data Distribusi Tahun: 2005 Versi:"

Similar presentations


Ads by Google