transactions and concurrency control sadhna kumari

21
TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

Upload: dominick-wright

Post on 24-Dec-2015

225 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

TRANSACTIONS AND CONCURRENCY CONTROL

Sadhna Kumari

Page 2: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

OUTLINEACID Properties2-Phase Commit ProtocolTPSSerializabilityConcurrency Control ProtocolsCurrent ResearchFutureReferences

Page 3: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

ACID PROPERTIESAtomicity: A transaction is either performed

entirely or not at all.Consistency: After execution of a transaction,

the database must be in correct state.Isolation: Partial results of an incomplete

transaction are not visible to others.Durability: The results of a committed

transaction must be made permanent.

Page 4: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

2-PHASE COMMIT PROTOCOLParticipant

- receives pre-commit message

- if ready then pre-commits and replies YES else aborts transaction and replies NO

- receives decision

- if commit then COMMIT, if abort then ABORT

- send response

Coordinator

- pre-commit the transaction

- sends request to all participants

- collects all replies

- if all replies are YES then commit and send COMMIT else abort and send ABORT

- receives response

Page 5: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

DISTRIBUTED TRANSACTION PROCESSING SYSTEM

Page 6: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

DISTRIBUTED TRANSACTION PROCESSING SYSTEM (CONTD)

Page 7: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

SERIALIZABILITYSerial Schedule: serial execution of

actions of set of transactionsSerializable schedule: Execution result is

equivalent to that of serial scheduleConflicts: write-write, read-write or

write-readSerializability ensures consistency

Page 8: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

SERIALIZABILITY (EXAMPLE)

Serial schedule : {t1,t2}, {t2,t1} t0 COMMITEDPossible results {C,D} : {80,120}, {120,80}Operation pairs {1,3} & {2,4} – write-write

conflict

Page 9: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

INTERLEAVING SCHEDULES

Page 10: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

TWO PHASE LOCKINGExpanding phase: new locks on items can be

acquired but none can be releasedShrinking phase: existing locks can be

released but no new ones can be acquiredProblems:

Deadlock Rolling aborts Commit dependence

Strict two phase locking: only release locks either at commit or at abort

Page 11: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

TIMESTAMP ORDERINGEach transaction has a Timestamp(TS)

associated with it.TS is not necessarily real time, can be a logical

counterTS is unique for a transactionNew transaction has larger TS than older

transactionLarger TS transactions wait for smaller TS

transactions and smaller TS transactions die and restart when confronting larger TS transactions

No deadlock

Page 12: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

OPTIMISTIC CONCURRENCY CONTROL

Allows entire transaction to complete and then validate the transaction before making its effect permanent

Execution Phase: Starts with begin transaction and ends with end transaction

Validation Phase: Coordinator TM with participant TMs validate the consistency using two-phase validation protocol

Update Phase: Update must be committed for validated transaction

Page 13: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

COMPARISON2PL is the most popular choice because it is

simple2PL is a pessimistic protocol because it achieves

serializability by restricting the operation in a transaction

Timestamp ordering is less pessimistic, allows operations to execute freely

Optimistic concurrency control ignores conflicts during execution, but requires very elaborate validation

Page 14: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

CURRENT RESEARCH

Page 15: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

DISTRIBUTED LOCK MANAGER[3]

Page 16: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

DISTRIBUTED LOCK MANAGER (GFS)

Locking responsibility is distributedPartitioning the lock space (can be done by

using hash function )Faster processing than centralized approachAvoid single point failureDeadlock detection is complicated

Page 17: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

CONCURRENCY CONTROL IN REAL-TIME [4]

Each transaction is associated with a priority, high priority transaction has earlier deadline

Higher priority transaction obtains the lock first. Lower priority transaction has to sacrifice the lock.

If transaction confronts the same priority transaction, then lock is obtained by timestamp ordering

Page 18: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

FUTURE

Page 19: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

Currently concurrency control mechanism are mostly at OS/Kernel level. With increasing parallel computing, user level locking mechanism should be made available

Small locking object is ideal for concurrency control. It is always better to lock attribute than whole file

Need for a standardized concurrency control protocol for distributed/parallel environment

Page 20: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

REFERENCES[1] Distributed Operating Systems & Algorithms, Andy Chow & Theodore Johnson,1997

[2]http://en.wikipedia.org/wiki/Concurrency_control

[3] Sungchune Choi ; Minseuk Choi ; Chunkyeong Lee ; Hee Yong Youn ; “Distributed Lock Manager for Distributed File System in Shared-Disk Environment” Sep 2010

[4] Qiansheng Zheng ; Xiaoming Bi ; “An improved concurrency control algorithm for distributed real-time database” Aug 2010

[5] http://en.wikipedia.org/wiki/Distributed_file_system

Page 21: TRANSACTIONS AND CONCURRENCY CONTROL Sadhna Kumari

THANK YOU