SlideShare una empresa de Scribd logo
1 de 18
Distributed Transactions 
1. Introduction 
2. Flat and nested distributed transactions 
3. Atomic commit protocols 
4. Concurrency control in distributed 
transactions 
5. Distributed deadlocks 
6. Transaction recovery
4. Concurrency control in distributed transaction
Introduction 
• Each server manages a set of objects and is 
responsible for ensuring that they remain 
consistent when accessed by concurrent 
transaction. 
• Therefore ,each server is responsible for 
applying concurrency control to its own 
objects.
Concurrency control in distributed 
Including 
transaction 
1. Locking 
2. Timestamp ordering concurrency control 
3. Optimistic concurrency control
1. Locking 
• In a distributed transaction, the locks on an 
objects are held locally( in the same server). 
• The lock manager can decide whether to grant 
a lock or make the requesting transaction 
wait.
• It cannot release any locks until it knows 
that the transaction has been committed 
or aborted at all the servers involved in the 
transaction.
• Consider the following interleaving of 
transactions T and U at servers X and Y.
Example of a distributed deadlock 
T U 
Write(A) At X Locks A 
Read(B) At Y Wait for U 
Write(B) At Y Locks B 
Read(A) At X Wait for T
• These different ordering can lead to cyclic 
dependencies between transactions and a 
distributed deadlock situation arises. 
• When a deadlock is detected, a transaction is 
aborted to resolve the deadlock. 
• In this case, the coordinator will be informed 
and will abort the transaction at the 
participants involved in the transaction.
Distributed deadlock 
D 
Waits for 
C A 
Waits 
for 
Held by 
Held 
by 
B Waits for 
Held 
by 
X 
Y 
Z 
Held by 
W 
V U 
W 
V 
U 
(a) (b)
2. Timestamp ordering concurrency control 
• Globally unique transaction timestamp 
– Be issued to the client by the first coordinator 
accessed by a transaction 
– The transaction timestamp is passed to the 
coordinator at each server 
– Each server accesses shared objects 
according to the timestamp 
• Resolution of a conflict 
– Abort a transaction from all servers
3. Optimistic concurrency control 
• Each transaction has the following phases 
1. Working phase 
2. Validation phase 
3. Update phase
1. Working phase 
• During the working phase, each transaction has 
a tentative (unsure) version of each of the 
objects that it updates. 
• This is a copy of the most recently committed 
version of the object. 
• When there are several concurrent transactions, 
several different tentative values of the same 
object may coexist.
2. Validation phase 
• When the closeTransaction request is 
received, the transaction is validated to 
establish whether or not its operations on 
objects conflict with operations of other 
transactions on the same objects. 
• If the validation is successful, then the 
transaction can commit. 
• If the validation fails, then some form of 
conflict resolution must be used and 
either the current transaction will need to 
be aborted.
Validation of transactions 
For a transaction Tv to be serializable with respect 
to an overlapping transaction Ti , their operation 
must conform to the following rules.
Tv Ti Rule 
write read Ti must not read objects written 
by Tv 
read write Tv must not read objects written 
by Ti 
write write Ti must not write objects written 
by Tv and 
Tv must not write objects written 
by Ti
3. Update phase 
• If a transaction is validated, all of the 
changes recorded in its tentative versions 
are made permanent. 
• Read-only transactions can commit 
immediately after passing validation. 
• Write transactions are ready to commit 
once the tentative versions of the objects 
have been recorded in permanent 
storage.
Thank You

Más contenido relacionado

La actualidad más candente

Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing ConceptNishant Munjal
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMSkoolkampus
 
Timestamp based protocol
Timestamp based protocolTimestamp based protocol
Timestamp based protocolVincent Chu
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control TechniquesRaj vardhan
 
Database , 8 Query Optimization
Database , 8 Query OptimizationDatabase , 8 Query Optimization
Database , 8 Query OptimizationAli Usman
 
Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesMeghaj Mallick
 
Transactions (Distributed computing)
Transactions (Distributed computing)Transactions (Distributed computing)
Transactions (Distributed computing)Sri Prasanna
 
Database ,10 Transactions
Database ,10 TransactionsDatabase ,10 Transactions
Database ,10 TransactionsAli Usman
 
RPC communication,thread and processes
RPC communication,thread and processesRPC communication,thread and processes
RPC communication,thread and processesshraddha mane
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency controlAnand Grewal
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Ravindra Raju Kolahalam
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithmssathish sak
 
Real time operating systems (rtos) concepts 7
Real time operating systems (rtos) concepts 7Real time operating systems (rtos) concepts 7
Real time operating systems (rtos) concepts 7Abu Bakr Ramadan
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDHIVYADEVAKI
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed SystemsPritom Saha Akash
 

La actualidad más candente (20)

Transaction Processing Concept
Transaction Processing ConceptTransaction Processing Concept
Transaction Processing Concept
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Timestamp based protocol
Timestamp based protocolTimestamp based protocol
Timestamp based protocol
 
Concurrency Control Techniques
Concurrency Control TechniquesConcurrency Control Techniques
Concurrency Control Techniques
 
Database , 8 Query Optimization
Database , 8 Query OptimizationDatabase , 8 Query Optimization
Database , 8 Query Optimization
 
Concurrency control
Concurrency control Concurrency control
Concurrency control
 
Overview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed DatabasesOverview of Concurrency Control & Recovery in Distributed Databases
Overview of Concurrency Control & Recovery in Distributed Databases
 
Transactions (Distributed computing)
Transactions (Distributed computing)Transactions (Distributed computing)
Transactions (Distributed computing)
 
Database ,10 Transactions
Database ,10 TransactionsDatabase ,10 Transactions
Database ,10 Transactions
 
RPC communication,thread and processes
RPC communication,thread and processesRPC communication,thread and processes
RPC communication,thread and processes
 
Distributed Deadlock Detection.ppt
Distributed Deadlock Detection.pptDistributed Deadlock Detection.ppt
Distributed Deadlock Detection.ppt
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency control
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
Lecture 5 inter process communication
Lecture 5 inter process communicationLecture 5 inter process communication
Lecture 5 inter process communication
 
Operating Systems Process Scheduling Algorithms
Operating Systems   Process Scheduling AlgorithmsOperating Systems   Process Scheduling Algorithms
Operating Systems Process Scheduling Algorithms
 
6.distributed shared memory
6.distributed shared memory6.distributed shared memory
6.distributed shared memory
 
Real time operating systems (rtos) concepts 7
Real time operating systems (rtos) concepts 7Real time operating systems (rtos) concepts 7
Real time operating systems (rtos) concepts 7
 
Deadlock Detection in Distributed Systems
Deadlock Detection in Distributed SystemsDeadlock Detection in Distributed Systems
Deadlock Detection in Distributed Systems
 
Deadlock in Distributed Systems
Deadlock in Distributed SystemsDeadlock in Distributed Systems
Deadlock in Distributed Systems
 

Similar a 4. concurrency control

management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
Unit v-Distributed Transaction and Replication
Unit v-Distributed Transaction and ReplicationUnit v-Distributed Transaction and Replication
Unit v-Distributed Transaction and ReplicationDhivyaa C.R
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsSachin Chauhan
 
Concurrency control
Concurrency controlConcurrency control
Concurrency controlJaya Jeswani
 
Concurrency Conrol
Concurrency ConrolConcurrency Conrol
Concurrency Conrollubna19
 
Unit iv -Transactions
Unit iv -TransactionsUnit iv -Transactions
Unit iv -TransactionsDhivyaa C.R
 
Distributed Database Design and Relational Query Language
Distributed Database Design and Relational Query LanguageDistributed Database Design and Relational Query Language
Distributed Database Design and Relational Query LanguageAAKANKSHA JAIN
 
Concurrency Control.pptx
Concurrency Control.pptxConcurrency Control.pptx
Concurrency Control.pptxVijaySourtha
 
UNIT IV DIS.pptx
UNIT IV DIS.pptxUNIT IV DIS.pptx
UNIT IV DIS.pptxSamPrem3
 
Unit 4 Concurrency control.pptx dbms lovely
Unit 4 Concurrency control.pptx dbms lovelyUnit 4 Concurrency control.pptx dbms lovely
Unit 4 Concurrency control.pptx dbms lovelyPritishMajumdar3
 
Unit 4 Concurrency control.pptx dbms lovely
Unit 4 Concurrency control.pptx dbms lovelyUnit 4 Concurrency control.pptx dbms lovely
Unit 4 Concurrency control.pptx dbms lovelyPritishMajumdar3
 
Multi version Concurrency Control and its applications in Advanced database s...
Multi version Concurrency Control and its applications in Advanced database s...Multi version Concurrency Control and its applications in Advanced database s...
Multi version Concurrency Control and its applications in Advanced database s...GauthamSK4
 
Concurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptxConcurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptxMArshad35
 
Concurrency note.pdf
Concurrency note.pdfConcurrency note.pdf
Concurrency note.pdfBijayNag1
 

Similar a 4. concurrency control (20)

management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
Unit v-Distributed Transaction and Replication
Unit v-Distributed Transaction and ReplicationUnit v-Distributed Transaction and Replication
Unit v-Distributed Transaction and Replication
 
Distributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit ProtocolsDistributed Transactions(flat and nested) and Atomic Commit Protocols
Distributed Transactions(flat and nested) and Atomic Commit Protocols
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
UNIT II.pptx
UNIT II.pptxUNIT II.pptx
UNIT II.pptx
 
Unit 5 dbms
Unit 5 dbmsUnit 5 dbms
Unit 5 dbms
 
Transaction management transparencies
Transaction management transparenciesTransaction management transparencies
Transaction management transparencies
 
Concurrency Conrol
Concurrency ConrolConcurrency Conrol
Concurrency Conrol
 
Chapter 13
Chapter 13Chapter 13
Chapter 13
 
Unit iv -Transactions
Unit iv -TransactionsUnit iv -Transactions
Unit iv -Transactions
 
Distributed Database Design and Relational Query Language
Distributed Database Design and Relational Query LanguageDistributed Database Design and Relational Query Language
Distributed Database Design and Relational Query Language
 
Concurrency Control.pptx
Concurrency Control.pptxConcurrency Control.pptx
Concurrency Control.pptx
 
UNIT IV DIS.pptx
UNIT IV DIS.pptxUNIT IV DIS.pptx
UNIT IV DIS.pptx
 
transaction_processing.ppt
transaction_processing.ppttransaction_processing.ppt
transaction_processing.ppt
 
Unit 4 Concurrency control.pptx dbms lovely
Unit 4 Concurrency control.pptx dbms lovelyUnit 4 Concurrency control.pptx dbms lovely
Unit 4 Concurrency control.pptx dbms lovely
 
Unit 4 Concurrency control.pptx dbms lovely
Unit 4 Concurrency control.pptx dbms lovelyUnit 4 Concurrency control.pptx dbms lovely
Unit 4 Concurrency control.pptx dbms lovely
 
Multi version Concurrency Control and its applications in Advanced database s...
Multi version Concurrency Control and its applications in Advanced database s...Multi version Concurrency Control and its applications in Advanced database s...
Multi version Concurrency Control and its applications in Advanced database s...
 
Concurrency Control
Concurrency ControlConcurrency Control
Concurrency Control
 
Concurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptxConcurrency Control in Distributed Systems.pptx
Concurrency Control in Distributed Systems.pptx
 
Concurrency note.pdf
Concurrency note.pdfConcurrency note.pdf
Concurrency note.pdf
 

Más de AbDul ThaYyal

Chapter 15 distributed mm systems
Chapter 15 distributed mm systemsChapter 15 distributed mm systems
Chapter 15 distributed mm systemsAbDul ThaYyal
 
Chapter 14 replication
Chapter 14 replicationChapter 14 replication
Chapter 14 replicationAbDul ThaYyal
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlAbDul ThaYyal
 
Chapter 11d coordination agreement
Chapter 11d coordination agreementChapter 11d coordination agreement
Chapter 11d coordination agreementAbDul ThaYyal
 
Chapter 11c coordination agreement
Chapter 11c coordination agreementChapter 11c coordination agreement
Chapter 11c coordination agreementAbDul ThaYyal
 
Chapter 8 distributed file systems
Chapter 8 distributed file systemsChapter 8 distributed file systems
Chapter 8 distributed file systemsAbDul ThaYyal
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communicationAbDul ThaYyal
 
Chapter 3 networking and internetworking
Chapter 3 networking and internetworkingChapter 3 networking and internetworking
Chapter 3 networking and internetworkingAbDul ThaYyal
 
Chapter 1 characterisation of distributed systems
Chapter 1 characterisation of distributed systemsChapter 1 characterisation of distributed systems
Chapter 1 characterisation of distributed systemsAbDul ThaYyal
 
Chapter 2 system models
Chapter 2 system modelsChapter 2 system models
Chapter 2 system modelsAbDul ThaYyal
 
4.file service architecture
4.file service architecture4.file service architecture
4.file service architectureAbDul ThaYyal
 
4.file service architecture (1)
4.file service architecture (1)4.file service architecture (1)
4.file service architecture (1)AbDul ThaYyal
 

Más de AbDul ThaYyal (20)

Chapter 17 corba
Chapter 17 corbaChapter 17 corba
Chapter 17 corba
 
Chapter 15 distributed mm systems
Chapter 15 distributed mm systemsChapter 15 distributed mm systems
Chapter 15 distributed mm systems
 
Chapter 14 replication
Chapter 14 replicationChapter 14 replication
Chapter 14 replication
 
Chapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency controlChapter 12 transactions and concurrency control
Chapter 12 transactions and concurrency control
 
Chapter 11d coordination agreement
Chapter 11d coordination agreementChapter 11d coordination agreement
Chapter 11d coordination agreement
 
Chapter 11c coordination agreement
Chapter 11c coordination agreementChapter 11c coordination agreement
Chapter 11c coordination agreement
 
Chapter 11b
Chapter 11bChapter 11b
Chapter 11b
 
Chapter 11
Chapter 11Chapter 11
Chapter 11
 
Chapter 10
Chapter 10Chapter 10
Chapter 10
 
Chapter 9 names
Chapter 9 namesChapter 9 names
Chapter 9 names
 
Chapter 8 distributed file systems
Chapter 8 distributed file systemsChapter 8 distributed file systems
Chapter 8 distributed file systems
 
Chapter 7 security
Chapter 7 securityChapter 7 security
Chapter 7 security
 
Chapter 6 os
Chapter 6 osChapter 6 os
Chapter 6 os
 
Chapter 5
Chapter 5Chapter 5
Chapter 5
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communication
 
Chapter 3 networking and internetworking
Chapter 3 networking and internetworkingChapter 3 networking and internetworking
Chapter 3 networking and internetworking
 
Chapter 1 characterisation of distributed systems
Chapter 1 characterisation of distributed systemsChapter 1 characterisation of distributed systems
Chapter 1 characterisation of distributed systems
 
Chapter 2 system models
Chapter 2 system modelsChapter 2 system models
Chapter 2 system models
 
4.file service architecture
4.file service architecture4.file service architecture
4.file service architecture
 
4.file service architecture (1)
4.file service architecture (1)4.file service architecture (1)
4.file service architecture (1)
 

4. concurrency control

  • 1. Distributed Transactions 1. Introduction 2. Flat and nested distributed transactions 3. Atomic commit protocols 4. Concurrency control in distributed transactions 5. Distributed deadlocks 6. Transaction recovery
  • 2. 4. Concurrency control in distributed transaction
  • 3. Introduction • Each server manages a set of objects and is responsible for ensuring that they remain consistent when accessed by concurrent transaction. • Therefore ,each server is responsible for applying concurrency control to its own objects.
  • 4. Concurrency control in distributed Including transaction 1. Locking 2. Timestamp ordering concurrency control 3. Optimistic concurrency control
  • 5. 1. Locking • In a distributed transaction, the locks on an objects are held locally( in the same server). • The lock manager can decide whether to grant a lock or make the requesting transaction wait.
  • 6. • It cannot release any locks until it knows that the transaction has been committed or aborted at all the servers involved in the transaction.
  • 7. • Consider the following interleaving of transactions T and U at servers X and Y.
  • 8. Example of a distributed deadlock T U Write(A) At X Locks A Read(B) At Y Wait for U Write(B) At Y Locks B Read(A) At X Wait for T
  • 9. • These different ordering can lead to cyclic dependencies between transactions and a distributed deadlock situation arises. • When a deadlock is detected, a transaction is aborted to resolve the deadlock. • In this case, the coordinator will be informed and will abort the transaction at the participants involved in the transaction.
  • 10. Distributed deadlock D Waits for C A Waits for Held by Held by B Waits for Held by X Y Z Held by W V U W V U (a) (b)
  • 11. 2. Timestamp ordering concurrency control • Globally unique transaction timestamp – Be issued to the client by the first coordinator accessed by a transaction – The transaction timestamp is passed to the coordinator at each server – Each server accesses shared objects according to the timestamp • Resolution of a conflict – Abort a transaction from all servers
  • 12. 3. Optimistic concurrency control • Each transaction has the following phases 1. Working phase 2. Validation phase 3. Update phase
  • 13. 1. Working phase • During the working phase, each transaction has a tentative (unsure) version of each of the objects that it updates. • This is a copy of the most recently committed version of the object. • When there are several concurrent transactions, several different tentative values of the same object may coexist.
  • 14. 2. Validation phase • When the closeTransaction request is received, the transaction is validated to establish whether or not its operations on objects conflict with operations of other transactions on the same objects. • If the validation is successful, then the transaction can commit. • If the validation fails, then some form of conflict resolution must be used and either the current transaction will need to be aborted.
  • 15. Validation of transactions For a transaction Tv to be serializable with respect to an overlapping transaction Ti , their operation must conform to the following rules.
  • 16. Tv Ti Rule write read Ti must not read objects written by Tv read write Tv must not read objects written by Ti write write Ti must not write objects written by Tv and Tv must not write objects written by Ti
  • 17. 3. Update phase • If a transaction is validated, all of the changes recorded in its tentative versions are made permanent. • Read-only transactions can commit immediately after passing validation. • Write transactions are ready to commit once the tentative versions of the objects have been recorded in permanent storage.