Matakuliah Tahun Versi : M0184 / Pengolahan Data Distribusi : 2005 : Session - 13 CONCURRENCY CONTROL CONCURRENCY TECHNIQUE 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. Taxonomy of Concurrency Control Mechanism Concurrency Control Optimistic Pessimistic Locking Timestamp Ordering Hybrid Centralized Basic Distributed Multi Ver. Primary Copy Conservative Locking Timestamp Ordering LOCKING METHODS • Locking method are the most widely used approach to handling concurrent control in DBMS • A transaction must claim a read (shared) or write (exclusive) lock on a data item prior to the execution of the corresponding read or write operation. • Read operation it is permissible for more than one transaction to hold read lock simultaneously • Write Operation it is transaction exclusive access • As long as transaction hold write lock, no other transaction can read or update LOCKING METHODS Cont’d The most common locking protocol known as two-phase locking (2PL). The 2PL operate in two distinct phase : Growing phase during which the transaction acquires Locks and A Shrinking phase during which it release those lock LOCKING METHODS Cont’d The rules for transaction which obey 2PL are: • Transaction are well-performed, must acquire a lock on data object before operating on it and release lock when the transaction is finished • Compatibility rules for locking are observed, thus no conflicting locks are held. • Once the transaction has released lock, no new locks are acquired • All write locks are released together when transaction is commit DEADLOCK xi T1 T2 xj Simple Deadlock T1 is waiting for a lock on data item Xi which is currently held by transaction T2, while T2 is waiting for a lock on data item Xj which is currently held by transaction T1 G = T1 T2 T1 Distributed DeadLock Site A Site B T1(A) T1(B) Xj Xi T2(A) T2(B)
© Copyright 2026 Paperzz