SlideShare une entreprise Scribd logo
1  sur  46
Unit – 8
Distributed Transaction Management
&
Concurrency Control
Outlines..
• Transaction concept
• ACID property
• Objectives of Distributed Concurrency Control
• Concurrency Control anomalies
• Methods of concurrency control
• Serializability and recoverability
• Multiple granularity
• Multi version schemes
1/11/2017 2Prof. Dhaval R. Chandarana
Transaction concept
• A transaction is considered to be made up of a sequence of
read and write operation on the database, together with
computation.
1/11/2017 3Prof. Dhaval R. Chandarana
Example of Transactions
• Updating a record
• Locate the record on disk
• Bring record into buffer
• Update data in the buffer
• Writing data back to disk
1/11/2017 4Prof. Dhaval R. Chandarana
Syntax of Transaction
• Consider the following SQL query for increasing by 10% the budget
of the CAD/CAM project.
 UPDATE PROJ
SET BUDGET = BUDGET*1.1
WHERE PNAME= "CAD/CAM“
 Begin transaction BUDGET UPDATE
begin
EXEC SQL UPDATE PROJ
SET BUDGET = BUDGET*1.1
WHERE PNAME= “CAD/CAM”
end.
1/11/2017 5Prof. Dhaval R. Chandarana
Directed acyclic graph (DAC)
1/11/2017 6Prof. Dhaval R. Chandarana
Properties of Transactions
• The consistency and reliability aspects of transactions are due
to four properties
1. Atomicity
2. Consistency
3. Isolation
4. Durability
• Together, these are commonly referred to as the ACID
properties of transactions.
1/11/2017 7Prof. Dhaval R. Chandarana
Atomicity
• Atomicity refers to the fact that a transaction
is treated as a unit of operation. Therefore,
either all the transaction’s actions are
completed, or none of them are. This is also
known as the “all-or-nothing property.”
1/11/2017 8Prof. Dhaval R. Chandarana
Consistency
• The consistency of a transaction is simply its
correctness.
• In other words, a transaction is a correct
program that maps one consistent database
state to another.
1/11/2017 9Prof. Dhaval R. Chandarana
Isolation
• Isolation is the property of transactions that
requires each transaction to see a consistent
database at all times.
• In other words, an executing transaction
cannot reveal its results to other concurrent
transactions before its commitment.
1/11/2017 10Prof. Dhaval R. Chandarana
Durability
• Durability refers to that property of
transactions which ensures that once a
transaction commits, its results are
permanent and cannot be erased from the
database.
1/11/2017 11Prof. Dhaval R. Chandarana
Objectives of transaction management
• CPU and main memory utilization
• Control message and their response time
• Availability
1/11/2017 12Prof. Dhaval R. Chandarana
Types of transactions
• Transactions have been classified according to a number of
criteria. One criterion is the duration of transactions.
Accordingly, transactions may be classified as online or batch.
• These two classes are also called short-life and long-life
transactions, respectively.
1/11/2017 13Prof. Dhaval R. Chandarana
Online Transaction
• Online transactions are characterized by very short
execution/response times (typically, on the order of a
couple of seconds) and by access to a relatively small
portion of the database.
• This class of transactions probably covers a large
majority of current transaction applications.
Examples include banking transactions and airline
reservation transactions.
1/11/2017 14Prof. Dhaval R. Chandarana
Batch Transactions
• Batch transactions, on the other hand, take longer to
execute (response time being measured in minutes,
hours, or even days) and access a larger portion of the
database.
• Typical applications that might require batch
transactions are design databases, statistical
applications, report generation, complex queries, and
image processing.
1/11/2017 15Prof. Dhaval R. Chandarana
Various Transaction Models
1/11/2017 16Prof. Dhaval R. Chandarana
Conti..
• Another classification that has been proposed is with respect to the
organization of the read and write actions.
1. Read and write actions without any specific ordering. We call this
type of transactions general.
2. If the transactions are restricted so that all the read actions are
performed before any write action, the transaction is called a two-
step transaction.
3. if the transaction is restricted so that a data item has to be read
before it can be updated (written), the corresponding class is
called restricted (or read-before-write)
4. If a transaction is both two-step and restricted, it is called a
restricted two-step transaction.
5. action model of transactions, which consists of the restricted class
with the further restriction that each <read>,<write> pair be
executed atomically.
1/11/2017 17Prof. Dhaval R. Chandarana
Flat Transactions
• Flat transactions have a single start point (Begin
transaction) and a single termination point (End
transaction).
1/11/2017 18Prof. Dhaval R. Chandarana
Nested Transactions
• An alternative transaction model is to permit a transaction
to include other transactions with their own begin and
commit points. Such transactions are called nested
transactions.
Begin transaction Reservation
begin
Begin transaction Airline
: : :
end. {Airline}
Begin transaction Hotel
: : :
end. {Hotel}
end.
1/11/2017 19Prof. Dhaval R. Chandarana
Workflows
• A working definition is that a workflow is “a collection of
tasks organized to accomplish some business process.”
1. Human-oriented workflows, which involve humans in
performing the tasks. The system support is provided to
facilitate collaboration and coordination among humans, but
it is the humans themselves who are ultimately responsible
for the consistency of the actions.
2. System-oriented workflows are those that consist of
computation-intensive and specialized tasks that can be
executed by a computer. The system support in this case is
substantial and involves concurrency control and recovery,
automatic task execution, notification, etc.
1/11/2017 20Prof. Dhaval R. Chandarana
Workflows
3. Transactional workflows range in between human-oriented
and system oriented workflows and borrow characteristics
from both. They involve “coordinated execution of multiple
tasks that (a) may involve humans, (b) require access to HAD
[heterogeneous, autonomous, and/or distributed] systems,
and (c) support selective use of transactional properties [i.e.,
ACID properties] for individual tasks or entire workflows.”
1/11/2017 21Prof. Dhaval R. Chandarana
Example Workflow
1/11/2017 22Prof. Dhaval R. Chandarana
Objectives of Distributed Concurrency Control
• In distributed database system, database is typically used by
many users. These system usually allow multiple transaction to
run concurrently at the same time.
• It must support parallel execution of transaction.
• Communication delay is less.
• It must be recovery from site and communication failure.
1/11/2017 23Prof. Dhaval R. Chandarana
Concurrency Control anomalies
• Lack of Concurrency Control can create data integrity and
consistency problem:
1. Lost updates
2. Uncommitted data
3. Inconsistent retrievals
1/11/2017 24Prof. Dhaval R. Chandarana
Methods of concurrency control
1/11/2017 25Prof. Dhaval R. Chandarana
Locking-Based Concurrency Control
• The main idea of locking-based concurrency control is to
ensure that a data item that is shared by conflicting
operations is accessed by one operation at a time.
• This lock is set by a transaction before it is accessed and
is reset at the end of its use.
• There are two types of locks read lock (rl) and write lock
(wl)
1/11/2017 26Prof. Dhaval R. Chandarana
Locking-Based Concurrency Control Algorithms
1/11/2017 27Prof. Dhaval R. Chandarana
2PL Lock Graph
1/11/2017 28Prof. Dhaval R. Chandarana
Timestamp-Based Concurrency Control Algorithms
• To establish this ordering, the transaction manager assigns each
transaction Ti a unique timestamp, ts(Ti), at its initiation.
• A timestamp is a simple identifier that serves to identify each
transaction uniquely and is used for ordering.
• Uniqueness is only one of the properties of timestamp generation.
• The second property is monotonicity.
• There are a number of ways that timestamps can be assigned. One
method is to use a global (system-wide) monotonically increasing
counter.
• However, the maintenance of global counters is a problem in
distributed systems. Therefore, it is preferable that each site
autonomously assigns timestamps based on its local counter.
{local counter value, site identifier}
1/11/2017 29Prof. Dhaval R. Chandarana
Basic timestamp ordering Rule
• A transaction’s request to write an object is
valid only if that object was last read and
written by earlier transaction.
• A transaction’s request to read an object is
valid only if that object was last written by
earlier transaction.
1/11/2017 30Prof. Dhaval R. Chandarana
Optimistic Concurrency Control Algorithms
• the conflicts between transactions are quite frequent and do not
permit a transaction to access a data item if there is a
conflicting transaction that accesses that data item.
• Thus the execution of any operation of a transaction follows
the sequence of phases: validation (V), read (R),computation
(C), write (W)
1/11/2017 31Prof. Dhaval R. Chandarana
Optimistic Concurrency Control Algorithms
• Optimistic algorithms, on the other hand, delay the validation
phase until just before the write phase.
• The read, compute, and write operations of each transaction
are processed freely without updating the actual database.
• Each transaction initially makes its updates on local copies of
data items. The validation phase consists of checking if these
updates would maintain the consistency of the database. If
the answer is affirmative, the changes are made global
otherwise, the transaction is aborted and has to restart.
1/11/2017 32Prof. Dhaval R. Chandarana
Serializability
• Transaction are considered serialisable if the
effect of running them in an interleaved
fashion is equivalent to running them serially
in some order.
1/11/2017 33Prof. Dhaval R. Chandarana
1/11/2017 Prof. Dhaval R. Chandarana 34
Diagram
All schedules
View Serializable
Conflict
Serializable
Read (A, t)
t = t - 100
Write (A, t)
Read (B, t)
t = t + 100
Write (B, t)
Read (A, s)
s = s - 100
Write (A, s)
Read (C, s)
s = s + 100
Write (C, s)
A B C
300 600600
500 500500
400 500600
300 + 600 + 600 = 1500
Serial Schedule
T1
T2
1/11/2017 35Prof. Dhaval R. Chandarana
Read (A, t)
t = t - 100
Write (A, t)
Read (B, t)
t = t + 100
Write (B, t)
Read (A, s)
s = s - 100
Write (A, s)
Read (C, s)
s = s + 100
Write (C, s)
A B C
300 600600
500 500500
400 600500
300 + 600 + 600 = 1500
Serial Schedule
T2
T1
1/11/2017 36Prof. Dhaval R. Chandarana
37
Serial Schedule
SnS0 S1 S2
T1 T2 Tn
Consistent States
1/11/2017 Prof. Dhaval R. Chandarana
Conflict Serializability
T2: Read (A) T2: Write (A)
T1: Read (A) OK Read/Write Conflict
T1: Write (A) Write/Read Conflict Write/Write Conflict
1. Read/Write Conflict: conflict because value read depend
on whether write has occurred.
2. Write/Write Conflict: conflict because value left in db
depend on which write occurred last.
3. Read/Read: no conflict.
1/11/2017 38Prof. Dhaval R. Chandarana
Recoverability
• If transaction fails, users undo the transaction effect
because of atomicity property. The durability
property states that once a transaction commits, its
change cannot be undone.
• In recoverable schedule, no transaction
need to be roll back.
Recoverable
Serializable
Conflict
Serializable
1/11/2017 39Prof. Dhaval R. Chandarana
Multiple granularity
• Granularity is the size of data item allowed to lock.
• Multiple Granularity is the hierarchically breaking
up the database into portions which are lockable and
maintaining the track of what to be lock and how
much to be lock so that it can be decided very
quickly either to lock a data item or to unlock a data
item.
1/11/2017 40Prof. Dhaval R. Chandarana
Example of Multiple Granularity
• Suppose a database is divided into files; files are
divided into pages; pages are divided into records.
1/11/2017 41Prof. Dhaval R. Chandarana
Example of Multiple Granularity
• if there is a need to lock a record, then a
transaction can easily lock it. But if there is a need to
lock a file, the transaction have to lock firstly all the
records one after another, then pages in that file and
finally the file. So, there is a need to provide a
mechanism for locking the files also which is
provided by multiple granularity.
1/11/2017 42Prof. Dhaval R. Chandarana
For a low-level request
1/11/2017 43Prof. Dhaval R. Chandarana
For a high-level request
1/11/2017 44Prof. Dhaval R. Chandarana
Multi version schemes
• Multiversion schemes keep old version of data
item to increase concurrency. Each successful
write result in the creation of a new version of
the data item written.
• When a read (Q) operation is issued, select an
appropriate version of Q base on the
timestamp of the transaction and return the
value of the selected version.
1/11/2017 45Prof. Dhaval R. Chandarana
Multi version timestamp ordering
• Each data item Q has sequence of versions <
Q1,Q2,….,Qm>. Each version Qk contain three
data fields:
a. Content: the value of version Qk.
b. W-timestamp (Qk): timestamp of the
transaction that created (wrote) version Qk.
c. R-timestamp (Qk): largest timestamp of the
transaction that successfully read version Qk.
1/11/2017 46Prof. Dhaval R. Chandarana

Contenu connexe

Tendances

Database , 12 Reliability
Database , 12 ReliabilityDatabase , 12 Reliability
Database , 12 ReliabilityAli Usman
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESDISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESAAKANKSHA JAIN
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database SystemMeghaj Mallick
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query ProcessingMythili Kannan
 
Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computingSVijaylakshmi
 
contiguous memory allocation.pptx
contiguous memory allocation.pptxcontiguous memory allocation.pptx
contiguous memory allocation.pptxRajapriya82
 
Optimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed SystemsOptimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed Systemsmridul mishra
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Ravindra Raju Kolahalam
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMSkoolkampus
 
Replication Techniques for Distributed Database Design
Replication Techniques for Distributed Database DesignReplication Techniques for Distributed Database Design
Replication Techniques for Distributed Database DesignMeghaj Mallick
 
20. Parallel Databases in DBMS
20. Parallel Databases in DBMS20. Parallel Databases in DBMS
20. Parallel Databases in DBMSkoolkampus
 

Tendances (20)

Database , 12 Reliability
Database , 12 ReliabilityDatabase , 12 Reliability
Database , 12 Reliability
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
Distributed DBMS - Unit 5 - Semantic Data Control
Distributed DBMS - Unit 5 - Semantic Data ControlDistributed DBMS - Unit 5 - Semantic Data Control
Distributed DBMS - Unit 5 - Semantic Data Control
 
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUESDISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
DISTRIBUTED DATABASE WITH RECOVERY TECHNIQUES
 
Query processing in Distributed Database System
Query processing in Distributed Database SystemQuery processing in Distributed Database System
Query processing in Distributed Database System
 
Database System Architectures
Database System ArchitecturesDatabase System Architectures
Database System Architectures
 
2 phase locking protocol DBMS
2 phase locking protocol DBMS2 phase locking protocol DBMS
2 phase locking protocol DBMS
 
Distributed Query Processing
Distributed Query ProcessingDistributed Query Processing
Distributed Query Processing
 
Distributed database
Distributed databaseDistributed database
Distributed database
 
Synchronization in distributed computing
Synchronization in distributed computingSynchronization in distributed computing
Synchronization in distributed computing
 
contiguous memory allocation.pptx
contiguous memory allocation.pptxcontiguous memory allocation.pptx
contiguous memory allocation.pptx
 
Distributed DBMS - Unit 1 - Introduction
Distributed DBMS - Unit 1 - IntroductionDistributed DBMS - Unit 1 - Introduction
Distributed DBMS - Unit 1 - Introduction
 
Optimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed SystemsOptimistic concurrency control in Distributed Systems
Optimistic concurrency control in Distributed Systems
 
Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]Inter Process Communication Presentation[1]
Inter Process Communication Presentation[1]
 
15. Transactions in DBMS
15. Transactions in DBMS15. Transactions in DBMS
15. Transactions in DBMS
 
Distributed Transaction
Distributed TransactionDistributed Transaction
Distributed Transaction
 
DDBMS
DDBMSDDBMS
DDBMS
 
Replication Techniques for Distributed Database Design
Replication Techniques for Distributed Database DesignReplication Techniques for Distributed Database Design
Replication Techniques for Distributed Database Design
 
20. Parallel Databases in DBMS
20. Parallel Databases in DBMS20. Parallel Databases in DBMS
20. Parallel Databases in DBMS
 
Active database
Active databaseActive database
Active database
 

En vedette

16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMSkoolkampus
 
Databases: Concurrency Control
Databases: Concurrency ControlDatabases: Concurrency Control
Databases: Concurrency ControlDamian T. Gordon
 
12 ipt 0501 transaction processing systems 01
12 ipt 0501   transaction processing systems 0112 ipt 0501   transaction processing systems 01
12 ipt 0501 transaction processing systems 01ctedds
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency controlAnand Grewal
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency ControlRavimuthurajan
 
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)Beat Signer
 
Transaction processing system
Transaction processing systemTransaction processing system
Transaction processing systemuday sharma
 
Transaction processing systems
Transaction processing systems Transaction processing systems
Transaction processing systems greg robertson
 

En vedette (11)

Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
16. Concurrency Control in DBMS
16. Concurrency Control in DBMS16. Concurrency Control in DBMS
16. Concurrency Control in DBMS
 
Databases: Concurrency Control
Databases: Concurrency ControlDatabases: Concurrency Control
Databases: Concurrency Control
 
12 ipt 0501 transaction processing systems 01
12 ipt 0501   transaction processing systems 0112 ipt 0501   transaction processing systems 01
12 ipt 0501 transaction processing systems 01
 
Distributed DBMS - Unit 9 - Distributed Deadlock & Recovery
Distributed DBMS - Unit 9 - Distributed Deadlock & RecoveryDistributed DBMS - Unit 9 - Distributed Deadlock & Recovery
Distributed DBMS - Unit 9 - Distributed Deadlock & Recovery
 
Transaction concurrency control
Transaction concurrency controlTransaction concurrency control
Transaction concurrency control
 
Transaction Processing System
Transaction Processing SystemTransaction Processing System
Transaction Processing System
 
Transaction & Concurrency Control
Transaction & Concurrency ControlTransaction & Concurrency Control
Transaction & Concurrency Control
 
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
Transaction Management - Lecture 11 - Introduction to Databases (1007156ANR)
 
Transaction processing system
Transaction processing systemTransaction processing system
Transaction processing system
 
Transaction processing systems
Transaction processing systems Transaction processing systems
Transaction processing systems
 

Similaire à Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency Control

Guide to Application Performance: Planning to Continued Optimization
Guide to Application Performance: Planning to Continued OptimizationGuide to Application Performance: Planning to Continued Optimization
Guide to Application Performance: Planning to Continued OptimizationMuleSoft
 
High-Speed Reactive Microservices
High-Speed Reactive MicroservicesHigh-Speed Reactive Microservices
High-Speed Reactive MicroservicesRick Hightower
 
Move fast and make things with microservices
Move fast and make things with microservicesMove fast and make things with microservices
Move fast and make things with microservicesMithun Arunan
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Rick Hightower
 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on TransactionRahul Prajapati
 
Transaction conccurency
Transaction conccurencyTransaction conccurency
Transaction conccurencyEsraa Farrag
 
AWS re:Invent 2016: Global Traffic Management with Amazon Route 53 Traffic Fl...
AWS re:Invent 2016: Global Traffic Management with Amazon Route 53 Traffic Fl...AWS re:Invent 2016: Global Traffic Management with Amazon Route 53 Traffic Fl...
AWS re:Invent 2016: Global Traffic Management with Amazon Route 53 Traffic Fl...Amazon Web Services
 
Server system architecture
Server system architectureServer system architecture
Server system architectureFaiza Hafeez
 
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick ParkerDevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick ParkerR3
 
Manage the Digital Transformation with Machine Learning in a Reactive Microse...
Manage the Digital Transformation with Machine Learning in a Reactive Microse...Manage the Digital Transformation with Machine Learning in a Reactive Microse...
Manage the Digital Transformation with Machine Learning in a Reactive Microse...DataWorks Summit
 
deadlock prevention
deadlock preventiondeadlock prevention
deadlock preventionNilu Desai
 
Software Architecture for Cloud Infrastructure
Software Architecture for Cloud InfrastructureSoftware Architecture for Cloud Infrastructure
Software Architecture for Cloud InfrastructureTapio Rautonen
 
5 application serversforproject
5 application serversforproject5 application serversforproject
5 application serversforprojectashish61_scs
 
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...BI Brainz
 
Data Streaming For Big Data
Data Streaming For Big DataData Streaming For Big Data
Data Streaming For Big DataSeval Çapraz
 
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docxDBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docxrandyburney60861
 
adap-stability-202310.pptx
adap-stability-202310.pptxadap-stability-202310.pptx
adap-stability-202310.pptxMichael Ming Lei
 
WF_in_retail_banking_enterprise_systems
WF_in_retail_banking_enterprise_systemsWF_in_retail_banking_enterprise_systems
WF_in_retail_banking_enterprise_systemsOleh Zheleznyak
 
Patterns of Distributed Application Design
Patterns of Distributed Application DesignPatterns of Distributed Application Design
Patterns of Distributed Application DesignGlobalLogic Ukraine
 

Similaire à Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency Control (20)

Guide to Application Performance: Planning to Continued Optimization
Guide to Application Performance: Planning to Continued OptimizationGuide to Application Performance: Planning to Continued Optimization
Guide to Application Performance: Planning to Continued Optimization
 
High-Speed Reactive Microservices
High-Speed Reactive MicroservicesHigh-Speed Reactive Microservices
High-Speed Reactive Microservices
 
Move fast and make things with microservices
Move fast and make things with microservicesMove fast and make things with microservices
Move fast and make things with microservices
 
Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)Service Mesh CTO Forum (Draft 3)
Service Mesh CTO Forum (Draft 3)
 
Presentation on Transaction
Presentation on TransactionPresentation on Transaction
Presentation on Transaction
 
Transaction conccurency
Transaction conccurencyTransaction conccurency
Transaction conccurency
 
AWS re:Invent 2016: Global Traffic Management with Amazon Route 53 Traffic Fl...
AWS re:Invent 2016: Global Traffic Management with Amazon Route 53 Traffic Fl...AWS re:Invent 2016: Global Traffic Management with Amazon Route 53 Traffic Fl...
AWS re:Invent 2016: Global Traffic Management with Amazon Route 53 Traffic Fl...
 
Server system architecture
Server system architectureServer system architecture
Server system architecture
 
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick ParkerDevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
DevDay: Corda Enterprise: Journey to 1000 TPS per node, Rick Parker
 
Manage the Digital Transformation with Machine Learning in a Reactive Microse...
Manage the Digital Transformation with Machine Learning in a Reactive Microse...Manage the Digital Transformation with Machine Learning in a Reactive Microse...
Manage the Digital Transformation with Machine Learning in a Reactive Microse...
 
deadlock prevention
deadlock preventiondeadlock prevention
deadlock prevention
 
Software Architecture for Cloud Infrastructure
Software Architecture for Cloud InfrastructureSoftware Architecture for Cloud Infrastructure
Software Architecture for Cloud Infrastructure
 
5 application serversforproject
5 application serversforproject5 application serversforproject
5 application serversforproject
 
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
Analysing and Troubleshooting Performance Issues in SAP BusinessObjects BI Re...
 
Concurrency control
Concurrency controlConcurrency control
Concurrency control
 
Data Streaming For Big Data
Data Streaming For Big DataData Streaming For Big Data
Data Streaming For Big Data
 
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docxDBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
DBF-Lecture11-Chapter12.pptDatabase Principles Fundam.docx
 
adap-stability-202310.pptx
adap-stability-202310.pptxadap-stability-202310.pptx
adap-stability-202310.pptx
 
WF_in_retail_banking_enterprise_systems
WF_in_retail_banking_enterprise_systemsWF_in_retail_banking_enterprise_systems
WF_in_retail_banking_enterprise_systems
 
Patterns of Distributed Application Design
Patterns of Distributed Application DesignPatterns of Distributed Application Design
Patterns of Distributed Application Design
 

Plus de Gyanmanjari Institute Of Technology

Plus de Gyanmanjari Institute Of Technology (20)

WD - Unit - 7 - Advanced Concepts
WD - Unit - 7 - Advanced ConceptsWD - Unit - 7 - Advanced Concepts
WD - Unit - 7 - Advanced Concepts
 
WD - Unit - 4 - PHP Basics
WD - Unit - 4 - PHP BasicsWD - Unit - 4 - PHP Basics
WD - Unit - 4 - PHP Basics
 
WD - Unit - 3 - Java Script
WD - Unit - 3 - Java ScriptWD - Unit - 3 - Java Script
WD - Unit - 3 - Java Script
 
WD - Unit - 6 - Database Connectivity using PHP
WD - Unit - 6 - Database Connectivity using PHPWD - Unit - 6 - Database Connectivity using PHP
WD - Unit - 6 - Database Connectivity using PHP
 
WD - Unit - 5 - Session and State Management using PHP
WD - Unit - 5 - Session and State Management using PHPWD - Unit - 5 - Session and State Management using PHP
WD - Unit - 5 - Session and State Management using PHP
 
WD - Unit - 2 - HTML & CSS
WD - Unit - 2 - HTML & CSSWD - Unit - 2 - HTML & CSS
WD - Unit - 2 - HTML & CSS
 
WD - Unit - 1 - Introduction
WD - Unit - 1 - IntroductionWD - Unit - 1 - Introduction
WD - Unit - 1 - Introduction
 
OSV - Unit - 8 - Unix/Linux Operating System
OSV - Unit - 8 - Unix/Linux Operating SystemOSV - Unit - 8 - Unix/Linux Operating System
OSV - Unit - 8 - Unix/Linux Operating System
 
OSV - Unit - 10 - Approaches to Virtualization
OSV - Unit - 10 - Approaches to VirtualizationOSV - Unit - 10 - Approaches to Virtualization
OSV - Unit - 10 - Approaches to Virtualization
 
OSV - Unit - 9 - Virtualization Concepts
OSV - Unit - 9 - Virtualization ConceptsOSV - Unit - 9 - Virtualization Concepts
OSV - Unit - 9 - Virtualization Concepts
 
OSV - Unit - 7 - I/O Management & Disk scheduling
OSV - Unit - 7 - I/O Management & Disk schedulingOSV - Unit - 7 - I/O Management & Disk scheduling
OSV - Unit - 7 - I/O Management & Disk scheduling
 
OSV - Unit - 6 - Memory Management
OSV - Unit - 6 - Memory ManagementOSV - Unit - 6 - Memory Management
OSV - Unit - 6 - Memory Management
 
CNS - Unit - 10 - Web Security Threats and Approaches
CNS - Unit - 10 - Web Security Threats and ApproachesCNS - Unit - 10 - Web Security Threats and Approaches
CNS - Unit - 10 - Web Security Threats and Approaches
 
OSV - Unit - 5 - Deadlock
OSV - Unit - 5 - DeadlockOSV - Unit - 5 - Deadlock
OSV - Unit - 5 - Deadlock
 
OSV - Unit - 4 - Inter Process Communication
OSV - Unit - 4 - Inter Process CommunicationOSV - Unit - 4 - Inter Process Communication
OSV - Unit - 4 - Inter Process Communication
 
OSV - Unit - 3 - Concurrency
OSV - Unit - 3 - ConcurrencyOSV - Unit - 3 - Concurrency
OSV - Unit - 3 - Concurrency
 
OSV - Unit - 2 - Process and Threads Management
OSV - Unit - 2 - Process and Threads ManagementOSV - Unit - 2 - Process and Threads Management
OSV - Unit - 2 - Process and Threads Management
 
CNS - Unit - 8 - Key Management and Distribution
CNS - Unit - 8 - Key Management and DistributionCNS - Unit - 8 - Key Management and Distribution
CNS - Unit - 8 - Key Management and Distribution
 
CNS - Unit - 7 - Digital Signature
CNS - Unit - 7 - Digital SignatureCNS - Unit - 7 - Digital Signature
CNS - Unit - 7 - Digital Signature
 
CNS - Unit - 6 - Message Authentication Code
CNS - Unit - 6 - Message Authentication CodeCNS - Unit - 6 - Message Authentication Code
CNS - Unit - 6 - Message Authentication Code
 

Dernier

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...SUHANI PANDEY
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfRagavanV2
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTbhaskargani46
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01KreezheaRecto
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spaintimesproduction05
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSrknatarajan
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringmulugeta48
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . pptDineshKumar4165
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLManishPatel169454
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 

Dernier (20)

VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Unit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdfUnit 1 - Soil Classification and Compaction.pdf
Unit 1 - Soil Classification and Compaction.pdf
 
Generative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPTGenerative AI or GenAI technology based PPT
Generative AI or GenAI technology based PPT
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01Double rodded leveling 1 pdf activity 01
Double rodded leveling 1 pdf activity 01
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 

Distributed DBMS - Unit 8 - Distributed Transaction Management & Concurrency Control

  • 1. Unit – 8 Distributed Transaction Management & Concurrency Control
  • 2. Outlines.. • Transaction concept • ACID property • Objectives of Distributed Concurrency Control • Concurrency Control anomalies • Methods of concurrency control • Serializability and recoverability • Multiple granularity • Multi version schemes 1/11/2017 2Prof. Dhaval R. Chandarana
  • 3. Transaction concept • A transaction is considered to be made up of a sequence of read and write operation on the database, together with computation. 1/11/2017 3Prof. Dhaval R. Chandarana
  • 4. Example of Transactions • Updating a record • Locate the record on disk • Bring record into buffer • Update data in the buffer • Writing data back to disk 1/11/2017 4Prof. Dhaval R. Chandarana
  • 5. Syntax of Transaction • Consider the following SQL query for increasing by 10% the budget of the CAD/CAM project.  UPDATE PROJ SET BUDGET = BUDGET*1.1 WHERE PNAME= "CAD/CAM“  Begin transaction BUDGET UPDATE begin EXEC SQL UPDATE PROJ SET BUDGET = BUDGET*1.1 WHERE PNAME= “CAD/CAM” end. 1/11/2017 5Prof. Dhaval R. Chandarana
  • 6. Directed acyclic graph (DAC) 1/11/2017 6Prof. Dhaval R. Chandarana
  • 7. Properties of Transactions • The consistency and reliability aspects of transactions are due to four properties 1. Atomicity 2. Consistency 3. Isolation 4. Durability • Together, these are commonly referred to as the ACID properties of transactions. 1/11/2017 7Prof. Dhaval R. Chandarana
  • 8. Atomicity • Atomicity refers to the fact that a transaction is treated as a unit of operation. Therefore, either all the transaction’s actions are completed, or none of them are. This is also known as the “all-or-nothing property.” 1/11/2017 8Prof. Dhaval R. Chandarana
  • 9. Consistency • The consistency of a transaction is simply its correctness. • In other words, a transaction is a correct program that maps one consistent database state to another. 1/11/2017 9Prof. Dhaval R. Chandarana
  • 10. Isolation • Isolation is the property of transactions that requires each transaction to see a consistent database at all times. • In other words, an executing transaction cannot reveal its results to other concurrent transactions before its commitment. 1/11/2017 10Prof. Dhaval R. Chandarana
  • 11. Durability • Durability refers to that property of transactions which ensures that once a transaction commits, its results are permanent and cannot be erased from the database. 1/11/2017 11Prof. Dhaval R. Chandarana
  • 12. Objectives of transaction management • CPU and main memory utilization • Control message and their response time • Availability 1/11/2017 12Prof. Dhaval R. Chandarana
  • 13. Types of transactions • Transactions have been classified according to a number of criteria. One criterion is the duration of transactions. Accordingly, transactions may be classified as online or batch. • These two classes are also called short-life and long-life transactions, respectively. 1/11/2017 13Prof. Dhaval R. Chandarana
  • 14. Online Transaction • Online transactions are characterized by very short execution/response times (typically, on the order of a couple of seconds) and by access to a relatively small portion of the database. • This class of transactions probably covers a large majority of current transaction applications. Examples include banking transactions and airline reservation transactions. 1/11/2017 14Prof. Dhaval R. Chandarana
  • 15. Batch Transactions • Batch transactions, on the other hand, take longer to execute (response time being measured in minutes, hours, or even days) and access a larger portion of the database. • Typical applications that might require batch transactions are design databases, statistical applications, report generation, complex queries, and image processing. 1/11/2017 15Prof. Dhaval R. Chandarana
  • 16. Various Transaction Models 1/11/2017 16Prof. Dhaval R. Chandarana
  • 17. Conti.. • Another classification that has been proposed is with respect to the organization of the read and write actions. 1. Read and write actions without any specific ordering. We call this type of transactions general. 2. If the transactions are restricted so that all the read actions are performed before any write action, the transaction is called a two- step transaction. 3. if the transaction is restricted so that a data item has to be read before it can be updated (written), the corresponding class is called restricted (or read-before-write) 4. If a transaction is both two-step and restricted, it is called a restricted two-step transaction. 5. action model of transactions, which consists of the restricted class with the further restriction that each <read>,<write> pair be executed atomically. 1/11/2017 17Prof. Dhaval R. Chandarana
  • 18. Flat Transactions • Flat transactions have a single start point (Begin transaction) and a single termination point (End transaction). 1/11/2017 18Prof. Dhaval R. Chandarana
  • 19. Nested Transactions • An alternative transaction model is to permit a transaction to include other transactions with their own begin and commit points. Such transactions are called nested transactions. Begin transaction Reservation begin Begin transaction Airline : : : end. {Airline} Begin transaction Hotel : : : end. {Hotel} end. 1/11/2017 19Prof. Dhaval R. Chandarana
  • 20. Workflows • A working definition is that a workflow is “a collection of tasks organized to accomplish some business process.” 1. Human-oriented workflows, which involve humans in performing the tasks. The system support is provided to facilitate collaboration and coordination among humans, but it is the humans themselves who are ultimately responsible for the consistency of the actions. 2. System-oriented workflows are those that consist of computation-intensive and specialized tasks that can be executed by a computer. The system support in this case is substantial and involves concurrency control and recovery, automatic task execution, notification, etc. 1/11/2017 20Prof. Dhaval R. Chandarana
  • 21. Workflows 3. Transactional workflows range in between human-oriented and system oriented workflows and borrow characteristics from both. They involve “coordinated execution of multiple tasks that (a) may involve humans, (b) require access to HAD [heterogeneous, autonomous, and/or distributed] systems, and (c) support selective use of transactional properties [i.e., ACID properties] for individual tasks or entire workflows.” 1/11/2017 21Prof. Dhaval R. Chandarana
  • 22. Example Workflow 1/11/2017 22Prof. Dhaval R. Chandarana
  • 23. Objectives of Distributed Concurrency Control • In distributed database system, database is typically used by many users. These system usually allow multiple transaction to run concurrently at the same time. • It must support parallel execution of transaction. • Communication delay is less. • It must be recovery from site and communication failure. 1/11/2017 23Prof. Dhaval R. Chandarana
  • 24. Concurrency Control anomalies • Lack of Concurrency Control can create data integrity and consistency problem: 1. Lost updates 2. Uncommitted data 3. Inconsistent retrievals 1/11/2017 24Prof. Dhaval R. Chandarana
  • 25. Methods of concurrency control 1/11/2017 25Prof. Dhaval R. Chandarana
  • 26. Locking-Based Concurrency Control • The main idea of locking-based concurrency control is to ensure that a data item that is shared by conflicting operations is accessed by one operation at a time. • This lock is set by a transaction before it is accessed and is reset at the end of its use. • There are two types of locks read lock (rl) and write lock (wl) 1/11/2017 26Prof. Dhaval R. Chandarana
  • 27. Locking-Based Concurrency Control Algorithms 1/11/2017 27Prof. Dhaval R. Chandarana
  • 28. 2PL Lock Graph 1/11/2017 28Prof. Dhaval R. Chandarana
  • 29. Timestamp-Based Concurrency Control Algorithms • To establish this ordering, the transaction manager assigns each transaction Ti a unique timestamp, ts(Ti), at its initiation. • A timestamp is a simple identifier that serves to identify each transaction uniquely and is used for ordering. • Uniqueness is only one of the properties of timestamp generation. • The second property is monotonicity. • There are a number of ways that timestamps can be assigned. One method is to use a global (system-wide) monotonically increasing counter. • However, the maintenance of global counters is a problem in distributed systems. Therefore, it is preferable that each site autonomously assigns timestamps based on its local counter. {local counter value, site identifier} 1/11/2017 29Prof. Dhaval R. Chandarana
  • 30. Basic timestamp ordering Rule • A transaction’s request to write an object is valid only if that object was last read and written by earlier transaction. • A transaction’s request to read an object is valid only if that object was last written by earlier transaction. 1/11/2017 30Prof. Dhaval R. Chandarana
  • 31. Optimistic Concurrency Control Algorithms • the conflicts between transactions are quite frequent and do not permit a transaction to access a data item if there is a conflicting transaction that accesses that data item. • Thus the execution of any operation of a transaction follows the sequence of phases: validation (V), read (R),computation (C), write (W) 1/11/2017 31Prof. Dhaval R. Chandarana
  • 32. Optimistic Concurrency Control Algorithms • Optimistic algorithms, on the other hand, delay the validation phase until just before the write phase. • The read, compute, and write operations of each transaction are processed freely without updating the actual database. • Each transaction initially makes its updates on local copies of data items. The validation phase consists of checking if these updates would maintain the consistency of the database. If the answer is affirmative, the changes are made global otherwise, the transaction is aborted and has to restart. 1/11/2017 32Prof. Dhaval R. Chandarana
  • 33. Serializability • Transaction are considered serialisable if the effect of running them in an interleaved fashion is equivalent to running them serially in some order. 1/11/2017 33Prof. Dhaval R. Chandarana
  • 34. 1/11/2017 Prof. Dhaval R. Chandarana 34 Diagram All schedules View Serializable Conflict Serializable
  • 35. Read (A, t) t = t - 100 Write (A, t) Read (B, t) t = t + 100 Write (B, t) Read (A, s) s = s - 100 Write (A, s) Read (C, s) s = s + 100 Write (C, s) A B C 300 600600 500 500500 400 500600 300 + 600 + 600 = 1500 Serial Schedule T1 T2 1/11/2017 35Prof. Dhaval R. Chandarana
  • 36. Read (A, t) t = t - 100 Write (A, t) Read (B, t) t = t + 100 Write (B, t) Read (A, s) s = s - 100 Write (A, s) Read (C, s) s = s + 100 Write (C, s) A B C 300 600600 500 500500 400 600500 300 + 600 + 600 = 1500 Serial Schedule T2 T1 1/11/2017 36Prof. Dhaval R. Chandarana
  • 37. 37 Serial Schedule SnS0 S1 S2 T1 T2 Tn Consistent States 1/11/2017 Prof. Dhaval R. Chandarana
  • 38. Conflict Serializability T2: Read (A) T2: Write (A) T1: Read (A) OK Read/Write Conflict T1: Write (A) Write/Read Conflict Write/Write Conflict 1. Read/Write Conflict: conflict because value read depend on whether write has occurred. 2. Write/Write Conflict: conflict because value left in db depend on which write occurred last. 3. Read/Read: no conflict. 1/11/2017 38Prof. Dhaval R. Chandarana
  • 39. Recoverability • If transaction fails, users undo the transaction effect because of atomicity property. The durability property states that once a transaction commits, its change cannot be undone. • In recoverable schedule, no transaction need to be roll back. Recoverable Serializable Conflict Serializable 1/11/2017 39Prof. Dhaval R. Chandarana
  • 40. Multiple granularity • Granularity is the size of data item allowed to lock. • Multiple Granularity is the hierarchically breaking up the database into portions which are lockable and maintaining the track of what to be lock and how much to be lock so that it can be decided very quickly either to lock a data item or to unlock a data item. 1/11/2017 40Prof. Dhaval R. Chandarana
  • 41. Example of Multiple Granularity • Suppose a database is divided into files; files are divided into pages; pages are divided into records. 1/11/2017 41Prof. Dhaval R. Chandarana
  • 42. Example of Multiple Granularity • if there is a need to lock a record, then a transaction can easily lock it. But if there is a need to lock a file, the transaction have to lock firstly all the records one after another, then pages in that file and finally the file. So, there is a need to provide a mechanism for locking the files also which is provided by multiple granularity. 1/11/2017 42Prof. Dhaval R. Chandarana
  • 43. For a low-level request 1/11/2017 43Prof. Dhaval R. Chandarana
  • 44. For a high-level request 1/11/2017 44Prof. Dhaval R. Chandarana
  • 45. Multi version schemes • Multiversion schemes keep old version of data item to increase concurrency. Each successful write result in the creation of a new version of the data item written. • When a read (Q) operation is issued, select an appropriate version of Q base on the timestamp of the transaction and return the value of the selected version. 1/11/2017 45Prof. Dhaval R. Chandarana
  • 46. Multi version timestamp ordering • Each data item Q has sequence of versions < Q1,Q2,….,Qm>. Each version Qk contain three data fields: a. Content: the value of version Qk. b. W-timestamp (Qk): timestamp of the transaction that created (wrote) version Qk. c. R-timestamp (Qk): largest timestamp of the transaction that successfully read version Qk. 1/11/2017 46Prof. Dhaval R. Chandarana