SlideShare a Scribd company logo
DDBMS
7/24/2017 1Md. Golam Moazzam, Dept. of CSE, JU
7/24/2017 2Md. Golam Moazzam, Dept. of CSE, JU
OUTLINE
 Transparencies in DDBMS
 Distributed Transaction Management
 Concurrency Control in DDBMS
 Distributed Deadlock Management
 Transparency
– It refers to the separation of the high-level semantics of a
system from lower-level implementation issues. In a
distributed system, it hides the implementation details from
users of the system.
– The user believes that he/she is working with a centralized
database system and that all the complexities of a distributed
database system are either hidden or transparent to the user.
– Four main categories of transparencies:
• Distribution transparency
• Transaction transparency
• Performance transparency
• DBMS transparency
7/24/2017 3Md. Golam Moazzam, Dept. of CSE, JU
Transparencies in DDBMS
 Distribution transparency
– Distribution transparency refers to the degree or extent to
which details of fragmentation, replication and location are
hidden from users.
– Distribution transparency can be classified into:
• Fragmentation transparency
• Location transparency
• Replication transparency
• Local mapping transparency
• Naming transparency
7/24/2017 4Md. Golam Moazzam, Dept. of CSE, JU
Transparencies in DDBMS
 Fragmentation transparency
– It hides the fact from users that the data are fragmented.
Users are not required to know how a relation has been
fragmented. To retrieve data, the user needs not to specify
the particular fragment names.
 Location transparency
– Users are not required to know the physical location of the
data. To retrieve data from a distributed database with
location transparency, the user has to specify the database
fragment names but need not to specify where the fragments
are located in the system.
7/24/2017 5Md. Golam Moazzam, Dept. of CSE, JU
Transparencies in DDBMS
 Replication transparency
– The user is unaware of the fact that the fragments of
relations are replicated and stored in different sites of the
system.
 Local mapping transparency
– It refers to the fact that users are aware of both the fragment
names and the location of fragments, taking into account
that any replication of the fragments may exist. In this case,
the user has to mention both the fragment names and the
location for data access.
7/24/2017 6Md. Golam Moazzam, Dept. of CSE, JU
Transparencies in DDBMS
 Naming transparency
– In a distributed database system, each database object such
as- relations, fragments, replicas etc, must have a unique
name. Therefore, the DDBMS must ensure that no two sites
create a database object with the same name. One solution
to this problem is to create a central name server, which has
the responsibility to ensure uniqueness of all names in the
system. Naming transparency means that the users are not
aware of the actual name of the database object in the
system. In this case, the user will specify the alias names of
the database objects for data accessing.
7/24/2017 7Md. Golam Moazzam, Dept. of CSE, JU
Transparencies in DDBMS
 Transaction Transparency
– This ensures that all distributed transactions maintain
database integrity and consistency.
– Each transaction is divided into sub-transactions.
– Each sub transaction can update data stored at different
sites.
– Transaction transparency ensures that the distributed
transaction will be successfully completed only if all sub-
transactions are completed successfully.
7/24/2017 8Md. Golam Moazzam, Dept. of CSE, JU
Transparencies in DDBMS
 Performance Transparency
– Performance transparency requires a DDBMS to perform as
if it were a centralized DBMS.
– The system shouldn’t suffer from any performance
degradation due to the distributed architecture.
7/24/2017 9Md. Golam Moazzam, Dept. of CSE, JU
Transparencies in DDBMS
 DBMS Transparency
– This is also known as heterogeneity transparency.
– DBMS transparency hides the knowledge that the local
DBMSs may be different.
– Only applicable to heterogeneous DDBMSs.
– This allows the integration of several local DBMSs under a
common global schema.
– It is one of the most difficult transparencies to provide as a
generalization.
7/24/2017 10Md. Golam Moazzam, Dept. of CSE, JU
Transparencies in DDBMS
 Transaction
– A transaction consists of a set of operations that perform a
single logical unit of work in a database system and moves
the database from one consistent state to another. It may be
an entire program or a part of a program.
 ACID properties of transactions
– A - Atomicity
– C - Consistency
– I - Isolation
– D - Durability
7/24/2017 11Md. Golam Moazzam, Dept. of CSE, JU
Distributed Transaction Management
 ACID properties of transactions
– Atomicity. All changes to data are performed as if they are a
single operation. That is, all the changes are performed, or
none of them are.
– Consistency. A transaction must transform the database
from one consistent state to another consistent state. It can
ensure consistency by enforcing al the constraints specified
in the database schema.
7/24/2017 12Md. Golam Moazzam, Dept. of CSE, JU
Distributed Transaction Management
 ACID properties of transactions
– Isolation. Transaction can execute independently. They are not
dependent on each other. In other words, transactions are
isolated from one another and the partial effect of incomplete
transactions should not be visible to other transactions.
– Durability. It refers to the fact that the effects of a successfully
completed (committed) transaction are permanently recorded in
the database and will not be affected by a failure. This ensures
that once a transaction commits, the changes are durable and
cannot be erased from the database.
7/24/2017 13Md. Golam Moazzam, Dept. of CSE, JU
Distributed Transaction Management
 Objectives of Distributed Transaction Management
– CPU and main memory utilization should be improved.
Most of the typical database applications spend much of their
time waiting for I/O operations rather than on computations. To
improve CPU and main memory utilization, a transaction
manager should adopt specialized techniques.
– Response time should be minimized. To improve the
performance of transaction executions, the response time of
each individual transaction must be considered and should be
minimized.
7/24/2017 14Md. Golam Moazzam, Dept. of CSE, JU
Distributed Transaction Management
 Objectives of Distributed Transaction Management
– Availability should be maximized. Although the availability
in a distributed system is better than that in a centralized
system, it must be maximized for transaction recovery and
concurrency control.
– Communication cost should be minimized. In distributed
systems, an additional communication cost is incurred, because
a number of message transfers are required between sites to
control the execution of a global transaction. Preventative
measures should be adopted by the transaction manager to
minimize the communication cost.
7/24/2017 15Md. Golam Moazzam, Dept. of CSE, JU
Distributed Transaction Management
 A Model for Transaction Management in DDBMS
– Access to the various data items in a distributed system is
usually accomplished through transactions which must
preserve the ACID properties. There are two types of
transaction that we need to consider.
• The local transactions are those that access and update data
in only local database.
• The global transactions are those that access and update
data in several local databases.
7/24/2017 16Md. Golam Moazzam, Dept. of CSE, JU
Distributed Transaction Management
 A Model for Transaction Management in DDBMS
– Ensuring the ACID properties of local transactions can be
done easily. However, for global transactions, this task is much
more complicated, since several sites are participating in
execution. A model for transaction management at each site of
a distributed system is shown below.
7/24/2017 17Md. Golam Moazzam, Dept. of CSE, JU
Distributed Transaction Management
Fig. A Model for Transaction Management at each site in a DDBMS
 A Model for Transaction Management in DDBMS
– It consists of two sub-modules:
• Transaction Manager (TM) and
• Transaction Coordinator (TC)
 Responsibility of Transaction Manger
– It manages the execution of those transactions that access data
stored in a local site. Each such transaction may be either a
local transaction or a part of a global transaction.
– It ensures the ACID properties of those transactions that
execute at that site.
– It maintains a log for recovery purpose.
– It participates in concurrency control scheme to coordinate the
concurrent execution of transactions executing at that site.
7/24/2017 18Md. Golam Moazzam, Dept. of CSE, JU
Distributed Transaction Management
 Responsibility of Transaction Coordinator
– It coordinates the execution of the various transactions both
local and global initiated at that site.
– It breaks the transaction into a number of sub-transactions and
distributes these sub-transactions to the appropriate sites for
execution.
– It coordinates the termination of the transactions which may
result in the transaction being committed at all sites or aborted
at all sites.
7/24/2017 19Md. Golam Moazzam, Dept. of CSE, JU
Distributed Transaction Management
 Concurrency Control
– It is the activity of coordinating concurrent access to data items
in a distributed database environment.
– In a distributed database system, users may access data stored
at many different sites, and a concurrency control mechanism
at one site may not be aware of transactions at other sites
instantaneously. Again the replication of data items add extra
complexity to the concurrency control mechanism.
7/24/2017 20Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Objectives of Distributed Concurrency Control
A good concurrency control mechanism for a DDBMS has the
following objectives:
– It must be resilient to site and communication failures.
– It should permit parallel execution of transactions to achieve
maximum concurrency.
– Its computational methods and storage mechanisms should be
modest to minimize overhead.
– It should perform satisfactorily in a network environment
taking into consideration that it involves significant
communication delay.
– It must impose few constraints on the structure of atomic
actions of transactions.
– It must preserve the consistency of data items.
7/24/2017 21Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Concurrency Control Anomalies
Different anomalies can arise due to concurrent access of data:
– Lost update anomaly – This occurs when a successful
completed update operation made by one transaction is
overridden by another transaction.
– Uncommitted dependency – This problem occurs when one
transaction allows other transactions to read its data before it
has committed and then decides to abort.
– Inconsistent analysis anomaly – The problem occurs when a
transaction reads several values from the database but a second
transaction updates some of them during the execution of the
first.
7/24/2017 22Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Concurrency Control Anomalies
Different anomalies can arise due to concurrent access of data:
– Phantom read anomaly – This anomaly occurs when a
transaction performs some operation on the database based on
a selection predicate, another transaction inserts new tuples
satisfying that predicate into the same database. This is known
as phantom read.
– Multiple-copy consistency problem – This occurs when data
items are replicated and stored at different sites. To maintain
the consistency, when a replicated data item is updated at one
site, all other copies must be updated. Otherwise, the database
becomes inconsistent.
7/24/2017 23Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Locking-based Concurrency Control Protocols
– A lock is nothing but a mechanism that tells the DBMS
whether a particular data item is being used by any transaction
for read/write purpose. Since there are two types of operations,
i.e. read and write, whose basic nature are different, the locks
for read and write operation may behave differently.
– In this locking-based approach, before accessing any data item,
a transaction must acquire a lock on that data item. When a
transaction acquires a lock on a data item, the lock prevents
other transactions from modifying that data item.
7/24/2017 24Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Locking-based Concurrency Control Protocols
– There are two types of locks:
• read lock also known as shared lock and
• write lock also known as exclusive lock.
– Read lock: If a transaction obtains a read lock on a data item,
it can only read but cannot update that data item. In this case,
other transactions are allowed to read that data item. Because
read-read operation is non-conflicting. Therefore, several
transactions can acquire read lock on same data item
simultaneously.
– Write lock: If a transaction obtains a write lock on a data item,
it can read as well as update that data item. In this case, no
other transactions are allowed to read or update that data item.
Because read-write and write-write operations are conflicting.
7/24/2017 25Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Locking-based Concurrency Control Protocols
Basic Operation: In a distributed database system, the lock
manager is responsible for managing locks for different
transactions that are running on that system. When any transaction
requires a lock on data items, the transaction manager passes this
request to the lock manager. The lock manager checks whether that
data item is currently locked by another transaction or not. If the
data item is locked by another transaction and the locking mode is
incompatible with the lock requested by the current transaction, the
lock manager does not allow the current transaction to obtain the
lock. Hence, the transaction is delayed until the existing lock is
released. Otherwise, the lock manager permits the current
transaction to obtain the desired lock and the information is passed
to the transaction manager.
7/24/2017 26Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Locking-based Concurrency Control Protocols
Up-gradation of lock
Some systems initially allow the current transaction to acquire a
read lock on a data item, if it is compatible with the existing lock
and later the lock is converted into a write lock. This is called up-
gradation of lock.
Down-gradation of lock
To allow maximum concurrency, some systems permit the current
transaction to acquire a write lock on a data item, and later the lock
is converted into a read lock. This is called down-gradation of lock.
7/24/2017 27Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Two-Phase Locking (2PL) Protocol
The 2PL protocol states that no transaction should acquire a lock
after it releases one of its lock. According to this protocol, the life
time of each transaction is divided into two phases:
 Growing phase and
 Shrinking phase.
In growing phase, a transaction can obtain locks on data items and
can access data items, but it can not release any locks.
7/24/2017 28Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Two-Phase Locking (2PL) Protocol
In shrinking phase, a transaction can release locks but cannot
acquire any new locks after that. Thus, the ending of growing
phase of a transaction determines the beginning of the shrinking
phase of that transaction. It is not necessary for each transaction to
acquire all locks simultaneously and then start processing.
Normally, each transaction obtains some locks initially, does some
processing and then requests for new additional locks that are
required. However, it never releases any lock until it has reached a
stage where no more locks are required. If up-gradation and down-
gradation are allowed, then up-gradation of locks can take place in
the growing phase, whereas down-gradation of locks can occur in
the shrinking phase.
7/24/2017 29Md. Golam Moazzam, Dept. of CSE, JU
Concurrency Control in DDBMS
 Deadlock
In a database environment, a deadlock is a situation when
transactions are endlessly waiting for one another. Any lock-based
concurrency control algorithm and some timestamp-based
concurrency control algorithms may result in deadlocks, as these
algorithms require transactions to wait for one another.
7/24/2017 30Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Deadlock
Deadlock situations can be characterized by wait-for graphs,
directed graphs that indicate which transactions are waiting for
which other transactions.
In a wait-for graph, nodes of the graph represent transactions and
edges of the graph represent the waiting-for relationships among
transactions. An edge is drawn in the wait-for graph from
transaction Ti to transaction Tj, if the transaction Ti is waiting for a
lock on a data item that is currently held by the transaction Tj.
Using wait-for graphs, it is very easy to detect whether a deadlock
situation has occurred in a database environment or not. There is a
deadlock in the system if and only if the corresponding wait-for
graph contains a cycle.
7/24/2017 31Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Deadlock
– The resolution of a deadlock situation is much easier in a
centralized DBMS than in a distributed DBMS. In a centralized
DBMS, only one local wait-for graph (LWFG) is drawn to
detect the deadlock situation. The detection of deadlocks in a
distributed DBMS is more complicated, because the circular
waiting situation, which determines a deadlock, may involve
several different sites. Thus, in a distributed DBMS it is not
sufficient to draw a LWFG for each local DBMS only, but it is
also necessary to draw a global wait-for graph (GWFG) for the
entire system to detect a deadlock situation. In a distributed
database, an LWFG is a portion of the GWFG.
7/24/2017 32Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Deadlock
– Three general techniques are available for deadlock
resolution in a distributed database system:
• Distributed deadlock prevention,
• Distributed deadlock avoidance and
• Distributed deadlock detection and recovery
from deadlock.
7/24/2017 33Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock Prevention Method
Distributed Deadlock prevention is a cautious scheme in which a
transaction is restarted when the system suspects that a deadlock
might occur. Deadlock prevention is an alternative method to
resolve deadlock situations in which a system is designed in such a
way that deadlocks are impossible. In this scheme, the transaction
manager checks a transaction when it is first initiated and does not
permit to proceed if there is a risk that it may cause a deadlock.
7/24/2017 34Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock Prevention Method
In the case of lock-based concurrency control, deadlock
prevention in a distributed system is implemented in the following
way:
Let us consider that a transaction Ti is initiated at a particular site in
a distributed database system and that it requires a lock on a data
item that is currently owned by another transaction Tj. Here, a
deadlock prevention test is done to check whether there is any
possibility of a deadlock occurring in the system. The transaction
Ti is not permitted to enter into a wait state for the transaction Tj, if
there is the risk of a deadlock situation. In this case, one of the two
transactions is aborted to prevent a deadlock.
7/24/2017 35Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock Prevention Method
The deadlock prevention algorithm is called non-preemptive if the
transaction Ti is aborted and restarted. On the other hand, if the
transaction Tj is aborted and restarted, then the deadlock prevention
algorithm is called preemptive. The transaction Ti is permitted to
wait for the transaction Tj as usual, if they pass the prevention test.
The prevention test must guarantee that if Ti is allowed to wait for
Tj, a deadlock can never occur.
7/24/2017 36Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock Prevention Method
A better approach to implement deadlock prevention test is by
assigning priorities to transactions and checking priorities to
determine whether one transaction would wait for the other
transaction or not. These priorities can be assigned by using a
unique identifier for each transaction in a distributed system. For
instance, consider that i and j are priorities of two transactions Ti
and Tj respectively. The transaction Ti would wait for the
transaction Tj, if Ti has a lower priority than Tj, that is, if i<j. This
approach prevents deadlock, but one problem with this approach is
that cyclic restart is possible. Thus, some transactions could be
restarted repeatedly without ever finishing.
7/24/2017 37Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock Prevention Method
One solution to the above problem is using the unique timestamp
value of each transaction as the priority of that transaction. One
way to obtain a global timestamp value for every transaction in a
distributed system is a unique local timestamp value to each
transaction by its local transactions manager and then appending
the site identifier to the low-order bites of this value. Thus,
timestamp values are unique throughout the distributed system and
do not require that clocks at different sites are synchronized
precisely. Based on timestamp values, there are two different
techniques for deadlock prevention: Wait-die and Wound-wait.
7/24/2017 38Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock Prevention Method
Wait-die is a non-preemptive deadlock prevention technique based
on timestamp values of transactions:
In this technique, when one transaction is about to block and is waiting for
a lock on a data item that is already locked by another transaction,
timestamp values of both the transactions are checked to give priority to
the older transaction. If a younger transaction is holding the lock on data
item then the older transaction is allowed to wait, but if an older
transaction is holding the lock, the younger transaction is aborted and
restarted with the same timestamp value. This forces the wait-for graph to
be directed from the older to the younger transactions, making cyclic
restarts impossible. For example, if the transaction Ti requests a lock on a
data item that is already locked by the transaction Tj, then Ti is permitted
to wait only if Ti has a lower timestamp value than Tj. On the other hand,
if Ti is younger than Tj, then Ti is aborted and restarted with the same
timestamp value.
7/24/2017 39Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock Prevention Method
Wound-Wait is an alternative preemptive deadlock prevention
technique by which cyclic restarts can be avoided.
In this method, if a younger transaction requests for a lock on a
data item that is already held by an older transaction, the younger
transaction is allowed to wait until the older transaction releases
the corresponding lock. In this case, the wait-for graph flows from
the younger to the older transactions, and cyclic restart is again
avoided. For instance, if the transaction Ti requests a lock on a data
item that is already locked by the transaction Tj, then Ti is
permitted to wait only if Ti has a higher timestamp value than Tj,
otherwise, the transaction Tj is aborted and the lock is granted to
the transaction Ti.
7/24/2017 40Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed deadlock detection and recovery Method
Deadlock detection and recovery is the most popular and most suitable
technique for deadlock management in a database environment.
In deadlock detection and recovery method, first it is checked whether any
deadlock has occurred in the system. After detection of a deadlock
situation in the system, one of the involved transactions is chosen as the
victim transaction and is aborted to resolve the deadlock situation.
Deadlock situations are detected by explicitly constructing a wait-for
graph and searching it for cycles. A cycle in the wait-for graph indicates
that a deadlock has occurred, and one transaction in the cycle is chosen as
the victim, which is aborted and restarted. To minimize the cost of
restarting, the victim selection is usually based on the number of data
items used by each transaction in the cycle.
7/24/2017 41Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed deadlock detection and recovery Method
The principal difficulty in implementing deadlock detection in a
distributed database environment is constructing the GWFG efficiently. In
a distributed DBMS, a LWFG for each local DBMS can be drawn easily;
however, these LWFGs are not sufficient to represent all deadlock
situations in the distributed system. For example, consider that there are
three different sites in a distributed system, and each site has constructed a
LWFG as shown in figure. The LWFG for each site is constructed in the
usual manner using local transactions and data items stored at that
particular site. A cycle in a LWFG indicates that a deadlock has occurred
locally. The LWFGs in Fig. illustrate that no deadlock has occurred locally
in the three different sites, as there are no cycles in the LWFGs, but this
does not guarantee that no deadlock has occurred globally. To detect a
deadlock situation in the distributed system, it is necessary to construct a
GWFG from these different LWFGs and to search it for cycles.
7/24/2017 42Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed deadlock detection and recovery Method
7/24/2017 43Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
T1 T2
T5
T2 T3
Site 1
T5 T1
Site 2 Site 3
Fig. : Local Wait-For Graphs (LWFGs) at different Sites
 Distributed deadlock detection and recovery Method
The corresponding GWFG in Fig. illustrates that a deadlock has occurred
in the distributed system, although no deadlock has occurred locally.
7/24/2017 44Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
Fig.: Global Wait-For Graph (GWFG) for the above Fig.
T1 T2
T5
T3
 Distributed deadlock detection and recovery Method
There are three different techniques for detecting deadlock situations in a
distributed system:
– Centralized deadlock detection,
– Hierarchical deadlock detection and
– Distributed deadlock detection
7/24/2017 45Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Centralized Deadlock detection
In Centralized Deadlock detection method, a single site is chosen as
Deadlock Detection Coordinator (DDC) for the entire distributed system.
The DDC is responsible for constructing the GWFG for system. Each lock
manager in the distributed database transmits its LWFG to the DDC
periodically. The DDC constructs the GWFG from these LWFGs and
checks for cycles in it. The occurrence of a global deadlock situation is
detected if there are one or more cycles in the GWFG. The DDC must
break each cycle in the GWFG by selecting the transactions to be rolled
back and restarted to recover from a deadlock situation. The information
regarding the transactions that are to be rolled back and restarted must be
transmitted to the corresponding lock managers by the deadlock detection
coordinator.
7/24/2017 46Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Centralized Deadlock detection
– The centralized deadlock detection approach is very simple,
but it has several drawbacks.
– This method is less reliable, as the failure of the central site
makes the deadlock detection impossible.
– The communication cost is very high in the case, as other sites
in the distributed system send their LWFGs to the central site.
– Another disadvantage of centralized deadlock detection
technique is that false detection of deadlocks can occur, for
which the deadlock recovery procedure may be initiated,
although no deadlock has occurred. In this method,
unnecessary rollbacks and restarts of transactions may also
result owing to phantom deadlocks.
7/24/2017 47Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock detection
In distributed deadlock detection method, a deadlock
detector exists at each site of the distributed system. In
this method, each site has the same amount of
responsibility, and there is no such distinction as local
or global deadlock detector. A variety of approaches
have been proposed for distributed deadlock detection
algorithms, but the most well-known and simplified
version, which is presented here, was developed by R.
Obermarck in 1982.The centralized deadlock detection
approach is very simple,
7/24/2017 48Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock detection
In this approach, a LWFG is constructed for each site by the
respective local deadlock detectors. An additional external node is
added to the LWFGs, as each site in the distributed system receives
the potential deadlock cycles from other sites. In the distributed
deadlock detection algorithm, the external node Tex is added to the
LWFGs to indicate whether any transaction from any remote site is
waiting for a data item that is being held by a transaction at the
local site or whether any transaction from the local site is waiting
for a data item is currently being used by any transaction at any
remote site.
7/24/2017 49Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock detection
For instance, an edge from the node Ti to Tex exists in the LWFG, if
the transaction Ti is waiting for a data item that is already held by
any transaction at any remote site. Similarly, an edge from the
external node Tex to Ti exists in the graph, if a transaction from a
remote site is waiting to acquire a data item that is currently being
held by the transaction Ti at the local site.
7/24/2017 50Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock detection
Thus, the local detector checks for two things to determine a
deadlock situation.
If a LWFG contains a cycle that does not involve the external node
Tex, then it indicates that a deadlock has occurred locally and it can
be handled locally.
On the other hand, a global deadlock potentially exists if the
LWFG contains a cycle involving the external node Tex. However,
the existence of such a cycle does not necessarily imply that there
is a global deadlock, as the external node Tex represents different
agents.
7/24/2017 51Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock detection
The LWFGs are merged so as to determine global deadlock situations. To
avoid sites transmitting their LWFGs to each other, a simple strategy is
followed here.
According to this strategy, one timestamp value is allocated to each
transaction and a rule is imposed such that one site Si transmits its LWFG
to the site Sk, if a transaction, say Tk, at site Sk is waiting for a data item
that is currently being held by a transaction Ti at site Si and ts(Ti)<ts(Tk). If
ts (Ti)<ts(Tk), the site Si transmits its LWFG to the site Sk, and the site Sk
adds this information to its LWFG and checks for cycles not involving the
external the node Tex in the extended graph. If there is no cycle in the
extended graph, the process continues until a cycle appears and it may
happen that the entire GWFG is constructed and no cycle is detected. In
this case, it is decided that there is no deadlock in the entire distributed
system.
7/24/2017 52Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Distributed Deadlock detection
On the other hand, if the GWFG contains a cycle not involving the
external node Tex, it is concluded that a deadlock has occurred in
the system. The distributed deadlock detection method is illustrated
below.
7/24/2017 53Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
Site 1 Site 2 Site 3
Fig. Distributed Deadlock Detection
Ti
Tex
Tk
Site 3
Site 2
Tj
Tex
Ti
Site 1
Site 3
Tk
Tex
Tj
Site 2
Site 1
 False Deadlocks
To handle the deadlock situation in distributed database systems, a
number of messages are transmitted among the sites. The delay
associated with the transmission of messages that is necessary for
deadlock detection can cause the detection of False Deadlocks.
For instance, consider that at a particular time the deadlock
detector has received the information that the transaction Ti is
waiting for the transaction Tj. Further assume that after some time
the transaction Tj releases the data item requested by the
transaction Ti and requests for data item that is being currently held
by the transaction Ti. If the deadlock detector receives the
information that the transaction Tj has requested for a data item that
is held by the transaction Ti before receiving the information that
the transaction Ti is not blocked by the transaction Tj any more, a
false deadlock situation is detected.
7/24/2017 54Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management
 Phantom Deadlocks
Another problem is that a transaction Ti that blocks another
transaction may be restarted for reasons that are not related to
deadlock detection. In this case, until the restart message of the
transaction Ti is transmitted to the deadlock detector, the deadlock
detector can find a cycle in the wait-for graph that includes the
transaction Ti. Hence, a deadlock situation is detected by the
deadlock detector and this is called a Phantom Deadlock. When
the deadlock detector detects a phantom deadlock, it may
unnecessarily restart a transaction other than Ti. To avoid
unnecessary restarts for phantom deadlock, special safety measures
are required.
7/24/2017 55Md. Golam Moazzam, Dept. of CSE, JU
Distributed Deadlock Management

More Related Content

What's hot

Design Goals of Distributed System
Design Goals of Distributed SystemDesign Goals of Distributed System
Design Goals of Distributed System
Ashish KC
 
Foult Tolerence In Distributed System
Foult Tolerence In Distributed SystemFoult Tolerence In Distributed System
Foult Tolerence In Distributed SystemRajan Kumar
 
Distributed DBMS - Unit 6 - Query Processing
Distributed DBMS - Unit 6 - Query ProcessingDistributed DBMS - Unit 6 - Query Processing
Distributed DBMS - Unit 6 - Query Processing
Gyanmanjari Institute Of Technology
 
Distributed databases
Distributed databasesDistributed databases
Distributed databasessourabhdave
 
Distributed database management systems
Distributed database management systemsDistributed database management systems
Distributed database management systems
Dhani Ahmad
 
Distributed design alternatives
Distributed design alternativesDistributed design alternatives
Distributed design alternatives
Pooja Dixit
 
Distributed Database System
Distributed Database SystemDistributed Database System
Distributed Database SystemSulemang
 
Active database
Active databaseActive database
Active database
Dabbal Singh Mahara
 
DDBMS
DDBMSDDBMS
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memoryAshish Kumar
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architectures
Pooja Dixit
 
Deadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddikDeadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddikSaeed Siddik
 
Lec 7 query processing
Lec 7 query processingLec 7 query processing
Lec 7 query processing
Md. Mashiur Rahman
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactionsNilu Desai
 
Routing protocols for ad hoc wireless networks
Routing protocols for ad hoc wireless networks Routing protocols for ad hoc wireless networks
Routing protocols for ad hoc wireless networks
Divya Tiwari
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systemssumitjain2013
 
Introduction to distributed file systems
Introduction to distributed file systemsIntroduction to distributed file systems
Introduction to distributed file systemsViet-Trung TRAN
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
Kathirvel Ayyaswamy
 
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
Sachin Chauhan
 

What's hot (20)

Distributed deadlock
Distributed deadlockDistributed deadlock
Distributed deadlock
 
Design Goals of Distributed System
Design Goals of Distributed SystemDesign Goals of Distributed System
Design Goals of Distributed System
 
Foult Tolerence In Distributed System
Foult Tolerence In Distributed SystemFoult Tolerence In Distributed System
Foult Tolerence In Distributed System
 
Distributed DBMS - Unit 6 - Query Processing
Distributed DBMS - Unit 6 - Query ProcessingDistributed DBMS - Unit 6 - Query Processing
Distributed DBMS - Unit 6 - Query Processing
 
Distributed databases
Distributed databasesDistributed databases
Distributed databases
 
Distributed database management systems
Distributed database management systemsDistributed database management systems
Distributed database management systems
 
Distributed design alternatives
Distributed design alternativesDistributed design alternatives
Distributed design alternatives
 
Distributed Database System
Distributed Database SystemDistributed Database System
Distributed Database System
 
Active database
Active databaseActive database
Active database
 
DDBMS
DDBMSDDBMS
DDBMS
 
distributed shared memory
 distributed shared memory distributed shared memory
distributed shared memory
 
Distributed dbms architectures
Distributed dbms architecturesDistributed dbms architectures
Distributed dbms architectures
 
Deadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddikDeadlock in distribute system by saeed siddik
Deadlock in distribute system by saeed siddik
 
Lec 7 query processing
Lec 7 query processingLec 7 query processing
Lec 7 query processing
 
management of distributed transactions
management of distributed transactionsmanagement of distributed transactions
management of distributed transactions
 
Routing protocols for ad hoc wireless networks
Routing protocols for ad hoc wireless networks Routing protocols for ad hoc wireless networks
Routing protocols for ad hoc wireless networks
 
Fault tolerance in distributed systems
Fault tolerance in distributed systemsFault tolerance in distributed systems
Fault tolerance in distributed systems
 
Introduction to distributed file systems
Introduction to distributed file systemsIntroduction to distributed file systems
Introduction to distributed file systems
 
CS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMSCS9222 ADVANCED OPERATING SYSTEMS
CS9222 ADVANCED OPERATING SYSTEMS
 
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
 

Similar to Transparency and concurrency

Database System Architecture
Database System ArchitectureDatabase System Architecture
Database System Architecture
University of Potsdam
 
My seminar on distributed dbms
My seminar on distributed dbmsMy seminar on distributed dbms
My seminar on distributed dbms
Vinay D. Patel
 
Distributed database
Distributed databaseDistributed database
Distributed database
sanjay joshi
 
Distributed database
Distributed databaseDistributed database
Distributed database
sanjay joshi
 
INJRV01I10005.pdf
INJRV01I10005.pdfINJRV01I10005.pdf
INJRV01I10005.pdf
CherenetToma
 
DDBMS.pptx
DDBMS.pptxDDBMS.pptx
DDBMS.pptx
ManishBej1
 
Agent-Driven Distributed Data Mining
Agent-Driven Distributed Data MiningAgent-Driven Distributed Data Mining
Agent-Driven Distributed Data Mining
Editor IJCATR
 
Query processing
Query processingQuery processing
Query processing
University of Potsdam
 
Distributed database management system
Distributed database management systemDistributed database management system
Distributed database management system
Vinay D. Patel
 
Advance DBMS
Advance DBMSAdvance DBMS
Advance DBMS
Md. Mashiur Rahman
 
Transaction management techniques and practices in current cloud computing en...
Transaction management techniques and practices in current cloud computing en...Transaction management techniques and practices in current cloud computing en...
Transaction management techniques and practices in current cloud computing en...
ijdms
 
Distributed Database
Distributed DatabaseDistributed Database
5. the grid implementing production grid
5. the grid implementing production grid5. the grid implementing production grid
5. the grid implementing production grid
Dr Sandeep Kumar Poonia
 
Ijetcas14 583
Ijetcas14 583Ijetcas14 583
Ijetcas14 583
Iasir Journals
 
Database , 1 Introduction
 Database , 1 Introduction Database , 1 Introduction
Database , 1 IntroductionAli Usman
 
1 introduction DDBS
1 introduction DDBS1 introduction DDBS
1 introduction DDBS
naimanighat
 
11 vol3
11 vol311 vol3
Saga transactions msa_ architecture
Saga transactions msa_ architectureSaga transactions msa_ architecture
Saga transactions msa_ architecture
Mauro Vocale
 
ADBMS 19MCA8125.pdf
ADBMS 19MCA8125.pdfADBMS 19MCA8125.pdf
ADBMS 19MCA8125.pdf
19BAG7124SAHIL
 

Similar to Transparency and concurrency (20)

Database System Architecture
Database System ArchitectureDatabase System Architecture
Database System Architecture
 
My seminar on distributed dbms
My seminar on distributed dbmsMy seminar on distributed dbms
My seminar on distributed dbms
 
Distributed database
Distributed databaseDistributed database
Distributed database
 
Distributed database
Distributed databaseDistributed database
Distributed database
 
INJRV01I10005.pdf
INJRV01I10005.pdfINJRV01I10005.pdf
INJRV01I10005.pdf
 
DDBMS.pptx
DDBMS.pptxDDBMS.pptx
DDBMS.pptx
 
Agent-Driven Distributed Data Mining
Agent-Driven Distributed Data MiningAgent-Driven Distributed Data Mining
Agent-Driven Distributed Data Mining
 
Query processing
Query processingQuery processing
Query processing
 
Distributed database management system
Distributed database management systemDistributed database management system
Distributed database management system
 
Advance DBMS
Advance DBMSAdvance DBMS
Advance DBMS
 
Transaction management techniques and practices in current cloud computing en...
Transaction management techniques and practices in current cloud computing en...Transaction management techniques and practices in current cloud computing en...
Transaction management techniques and practices in current cloud computing en...
 
Distributed Database
Distributed DatabaseDistributed Database
Distributed Database
 
5. the grid implementing production grid
5. the grid implementing production grid5. the grid implementing production grid
5. the grid implementing production grid
 
Ijetcas14 583
Ijetcas14 583Ijetcas14 583
Ijetcas14 583
 
Database , 1 Introduction
 Database , 1 Introduction Database , 1 Introduction
Database , 1 Introduction
 
Chapter 4 u
Chapter 4 uChapter 4 u
Chapter 4 u
 
1 introduction DDBS
1 introduction DDBS1 introduction DDBS
1 introduction DDBS
 
11 vol3
11 vol311 vol3
11 vol3
 
Saga transactions msa_ architecture
Saga transactions msa_ architectureSaga transactions msa_ architecture
Saga transactions msa_ architecture
 
ADBMS 19MCA8125.pdf
ADBMS 19MCA8125.pdfADBMS 19MCA8125.pdf
ADBMS 19MCA8125.pdf
 

More from University of Potsdam

Computer fundamentals 01
Computer fundamentals 01Computer fundamentals 01
Computer fundamentals 01
University of Potsdam
 
Workshop on android apps development
Workshop on android apps developmentWorkshop on android apps development
Workshop on android apps development
University of Potsdam
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
University of Potsdam
 
indexing and hashing
indexing and hashingindexing and hashing
indexing and hashing
University of Potsdam
 
data recovery-raid
data recovery-raiddata recovery-raid
data recovery-raid
University of Potsdam
 
Machine Learning for Data Mining
Machine Learning for Data MiningMachine Learning for Data Mining
Machine Learning for Data Mining
University of Potsdam
 
Tree, function and graph
Tree, function and graphTree, function and graph
Tree, function and graph
University of Potsdam
 
Sonet
SonetSonet
Sets in discrete mathematics
Sets in discrete mathematicsSets in discrete mathematics
Sets in discrete mathematics
University of Potsdam
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
University of Potsdam
 
Series parallel ac rlc networks
Series parallel ac rlc networksSeries parallel ac rlc networks
Series parallel ac rlc networks
University of Potsdam
 
Series parallel ac networks
Series parallel ac networksSeries parallel ac networks
Series parallel ac networks
University of Potsdam
 
Relations
RelationsRelations
Relations
RelationsRelations
Propositional logic
Propositional logicPropositional logic
Propositional logic
University of Potsdam
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
University of Potsdam
 
Prim algorithm
Prim algorithmPrim algorithm
Prim algorithm
University of Potsdam
 
Predicate &amp; quantifier
Predicate &amp; quantifierPredicate &amp; quantifier
Predicate &amp; quantifier
University of Potsdam
 
Number system
Number systemNumber system
Number system
University of Potsdam
 
Graph
GraphGraph

More from University of Potsdam (20)

Computer fundamentals 01
Computer fundamentals 01Computer fundamentals 01
Computer fundamentals 01
 
Workshop on android apps development
Workshop on android apps developmentWorkshop on android apps development
Workshop on android apps development
 
Functional dependency and normalization
Functional dependency and normalizationFunctional dependency and normalization
Functional dependency and normalization
 
indexing and hashing
indexing and hashingindexing and hashing
indexing and hashing
 
data recovery-raid
data recovery-raiddata recovery-raid
data recovery-raid
 
Machine Learning for Data Mining
Machine Learning for Data MiningMachine Learning for Data Mining
Machine Learning for Data Mining
 
Tree, function and graph
Tree, function and graphTree, function and graph
Tree, function and graph
 
Sonet
SonetSonet
Sonet
 
Sets in discrete mathematics
Sets in discrete mathematicsSets in discrete mathematics
Sets in discrete mathematics
 
Set in discrete mathematics
Set in discrete mathematicsSet in discrete mathematics
Set in discrete mathematics
 
Series parallel ac rlc networks
Series parallel ac rlc networksSeries parallel ac rlc networks
Series parallel ac rlc networks
 
Series parallel ac networks
Series parallel ac networksSeries parallel ac networks
Series parallel ac networks
 
Relations
RelationsRelations
Relations
 
Relations
RelationsRelations
Relations
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Propositional logic
Propositional logicPropositional logic
Propositional logic
 
Prim algorithm
Prim algorithmPrim algorithm
Prim algorithm
 
Predicate &amp; quantifier
Predicate &amp; quantifierPredicate &amp; quantifier
Predicate &amp; quantifier
 
Number system
Number systemNumber system
Number system
 
Graph
GraphGraph
Graph
 

Recently uploaded

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
EverAndrsGuerraGuerr
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
rosedainty
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
BhavyaRajput3
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
MIRIAMSALINAS13
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
Mohd Adib Abd Muin, Senior Lecturer at Universiti Utara Malaysia
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
GeoBlogs
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
Celine George
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
Celine George
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
Special education needs
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
RaedMohamed3
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
siemaillard
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
Vikramjit Singh
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
Jisc
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
Fundacja Rozwoju Społeczeństwa Przedsiębiorczego
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
Celine George
 

Recently uploaded (20)

Thesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.pptThesis Statement for students diagnonsed withADHD.ppt
Thesis Statement for students diagnonsed withADHD.ppt
 
Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)Template Jadual Bertugas Kelas (Boleh Edit)
Template Jadual Bertugas Kelas (Boleh Edit)
 
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCECLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
CLASS 11 CBSE B.St Project AIDS TO TRADE - INSURANCE
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXXPhrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
Phrasal Verbs.XXXXXXXXXXXXXXXXXXXXXXXXXX
 
Chapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptxChapter 3 - Islamic Banking Products and Services.pptx
Chapter 3 - Islamic Banking Products and Services.pptx
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
Fish and Chips - have they had their chips
Fish and Chips - have they had their chipsFish and Chips - have they had their chips
Fish and Chips - have they had their chips
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Model Attribute Check Company Auto Property
Model Attribute  Check Company Auto PropertyModel Attribute  Check Company Auto Property
Model Attribute Check Company Auto Property
 
How to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERPHow to Create Map Views in the Odoo 17 ERP
How to Create Map Views in the Odoo 17 ERP
 
special B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdfspecial B.ed 2nd year old paper_20240531.pdf
special B.ed 2nd year old paper_20240531.pdf
 
Palestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptxPalestine last event orientationfvgnh .pptx
Palestine last event orientationfvgnh .pptx
 
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Digital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and ResearchDigital Tools and AI for Teaching Learning and Research
Digital Tools and AI for Teaching Learning and Research
 
The approach at University of Liverpool.pptx
The approach at University of Liverpool.pptxThe approach at University of Liverpool.pptx
The approach at University of Liverpool.pptx
 
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdfESC Beyond Borders _From EU to You_ InfoPack general.pdf
ESC Beyond Borders _From EU to You_ InfoPack general.pdf
 
How to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS ModuleHow to Split Bills in the Odoo 17 POS Module
How to Split Bills in the Odoo 17 POS Module
 

Transparency and concurrency

  • 1. DDBMS 7/24/2017 1Md. Golam Moazzam, Dept. of CSE, JU
  • 2. 7/24/2017 2Md. Golam Moazzam, Dept. of CSE, JU OUTLINE  Transparencies in DDBMS  Distributed Transaction Management  Concurrency Control in DDBMS  Distributed Deadlock Management
  • 3.  Transparency – It refers to the separation of the high-level semantics of a system from lower-level implementation issues. In a distributed system, it hides the implementation details from users of the system. – The user believes that he/she is working with a centralized database system and that all the complexities of a distributed database system are either hidden or transparent to the user. – Four main categories of transparencies: • Distribution transparency • Transaction transparency • Performance transparency • DBMS transparency 7/24/2017 3Md. Golam Moazzam, Dept. of CSE, JU Transparencies in DDBMS
  • 4.  Distribution transparency – Distribution transparency refers to the degree or extent to which details of fragmentation, replication and location are hidden from users. – Distribution transparency can be classified into: • Fragmentation transparency • Location transparency • Replication transparency • Local mapping transparency • Naming transparency 7/24/2017 4Md. Golam Moazzam, Dept. of CSE, JU Transparencies in DDBMS
  • 5.  Fragmentation transparency – It hides the fact from users that the data are fragmented. Users are not required to know how a relation has been fragmented. To retrieve data, the user needs not to specify the particular fragment names.  Location transparency – Users are not required to know the physical location of the data. To retrieve data from a distributed database with location transparency, the user has to specify the database fragment names but need not to specify where the fragments are located in the system. 7/24/2017 5Md. Golam Moazzam, Dept. of CSE, JU Transparencies in DDBMS
  • 6.  Replication transparency – The user is unaware of the fact that the fragments of relations are replicated and stored in different sites of the system.  Local mapping transparency – It refers to the fact that users are aware of both the fragment names and the location of fragments, taking into account that any replication of the fragments may exist. In this case, the user has to mention both the fragment names and the location for data access. 7/24/2017 6Md. Golam Moazzam, Dept. of CSE, JU Transparencies in DDBMS
  • 7.  Naming transparency – In a distributed database system, each database object such as- relations, fragments, replicas etc, must have a unique name. Therefore, the DDBMS must ensure that no two sites create a database object with the same name. One solution to this problem is to create a central name server, which has the responsibility to ensure uniqueness of all names in the system. Naming transparency means that the users are not aware of the actual name of the database object in the system. In this case, the user will specify the alias names of the database objects for data accessing. 7/24/2017 7Md. Golam Moazzam, Dept. of CSE, JU Transparencies in DDBMS
  • 8.  Transaction Transparency – This ensures that all distributed transactions maintain database integrity and consistency. – Each transaction is divided into sub-transactions. – Each sub transaction can update data stored at different sites. – Transaction transparency ensures that the distributed transaction will be successfully completed only if all sub- transactions are completed successfully. 7/24/2017 8Md. Golam Moazzam, Dept. of CSE, JU Transparencies in DDBMS
  • 9.  Performance Transparency – Performance transparency requires a DDBMS to perform as if it were a centralized DBMS. – The system shouldn’t suffer from any performance degradation due to the distributed architecture. 7/24/2017 9Md. Golam Moazzam, Dept. of CSE, JU Transparencies in DDBMS
  • 10.  DBMS Transparency – This is also known as heterogeneity transparency. – DBMS transparency hides the knowledge that the local DBMSs may be different. – Only applicable to heterogeneous DDBMSs. – This allows the integration of several local DBMSs under a common global schema. – It is one of the most difficult transparencies to provide as a generalization. 7/24/2017 10Md. Golam Moazzam, Dept. of CSE, JU Transparencies in DDBMS
  • 11.  Transaction – A transaction consists of a set of operations that perform a single logical unit of work in a database system and moves the database from one consistent state to another. It may be an entire program or a part of a program.  ACID properties of transactions – A - Atomicity – C - Consistency – I - Isolation – D - Durability 7/24/2017 11Md. Golam Moazzam, Dept. of CSE, JU Distributed Transaction Management
  • 12.  ACID properties of transactions – Atomicity. All changes to data are performed as if they are a single operation. That is, all the changes are performed, or none of them are. – Consistency. A transaction must transform the database from one consistent state to another consistent state. It can ensure consistency by enforcing al the constraints specified in the database schema. 7/24/2017 12Md. Golam Moazzam, Dept. of CSE, JU Distributed Transaction Management
  • 13.  ACID properties of transactions – Isolation. Transaction can execute independently. They are not dependent on each other. In other words, transactions are isolated from one another and the partial effect of incomplete transactions should not be visible to other transactions. – Durability. It refers to the fact that the effects of a successfully completed (committed) transaction are permanently recorded in the database and will not be affected by a failure. This ensures that once a transaction commits, the changes are durable and cannot be erased from the database. 7/24/2017 13Md. Golam Moazzam, Dept. of CSE, JU Distributed Transaction Management
  • 14.  Objectives of Distributed Transaction Management – CPU and main memory utilization should be improved. Most of the typical database applications spend much of their time waiting for I/O operations rather than on computations. To improve CPU and main memory utilization, a transaction manager should adopt specialized techniques. – Response time should be minimized. To improve the performance of transaction executions, the response time of each individual transaction must be considered and should be minimized. 7/24/2017 14Md. Golam Moazzam, Dept. of CSE, JU Distributed Transaction Management
  • 15.  Objectives of Distributed Transaction Management – Availability should be maximized. Although the availability in a distributed system is better than that in a centralized system, it must be maximized for transaction recovery and concurrency control. – Communication cost should be minimized. In distributed systems, an additional communication cost is incurred, because a number of message transfers are required between sites to control the execution of a global transaction. Preventative measures should be adopted by the transaction manager to minimize the communication cost. 7/24/2017 15Md. Golam Moazzam, Dept. of CSE, JU Distributed Transaction Management
  • 16.  A Model for Transaction Management in DDBMS – Access to the various data items in a distributed system is usually accomplished through transactions which must preserve the ACID properties. There are two types of transaction that we need to consider. • The local transactions are those that access and update data in only local database. • The global transactions are those that access and update data in several local databases. 7/24/2017 16Md. Golam Moazzam, Dept. of CSE, JU Distributed Transaction Management
  • 17.  A Model for Transaction Management in DDBMS – Ensuring the ACID properties of local transactions can be done easily. However, for global transactions, this task is much more complicated, since several sites are participating in execution. A model for transaction management at each site of a distributed system is shown below. 7/24/2017 17Md. Golam Moazzam, Dept. of CSE, JU Distributed Transaction Management Fig. A Model for Transaction Management at each site in a DDBMS
  • 18.  A Model for Transaction Management in DDBMS – It consists of two sub-modules: • Transaction Manager (TM) and • Transaction Coordinator (TC)  Responsibility of Transaction Manger – It manages the execution of those transactions that access data stored in a local site. Each such transaction may be either a local transaction or a part of a global transaction. – It ensures the ACID properties of those transactions that execute at that site. – It maintains a log for recovery purpose. – It participates in concurrency control scheme to coordinate the concurrent execution of transactions executing at that site. 7/24/2017 18Md. Golam Moazzam, Dept. of CSE, JU Distributed Transaction Management
  • 19.  Responsibility of Transaction Coordinator – It coordinates the execution of the various transactions both local and global initiated at that site. – It breaks the transaction into a number of sub-transactions and distributes these sub-transactions to the appropriate sites for execution. – It coordinates the termination of the transactions which may result in the transaction being committed at all sites or aborted at all sites. 7/24/2017 19Md. Golam Moazzam, Dept. of CSE, JU Distributed Transaction Management
  • 20.  Concurrency Control – It is the activity of coordinating concurrent access to data items in a distributed database environment. – In a distributed database system, users may access data stored at many different sites, and a concurrency control mechanism at one site may not be aware of transactions at other sites instantaneously. Again the replication of data items add extra complexity to the concurrency control mechanism. 7/24/2017 20Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 21.  Objectives of Distributed Concurrency Control A good concurrency control mechanism for a DDBMS has the following objectives: – It must be resilient to site and communication failures. – It should permit parallel execution of transactions to achieve maximum concurrency. – Its computational methods and storage mechanisms should be modest to minimize overhead. – It should perform satisfactorily in a network environment taking into consideration that it involves significant communication delay. – It must impose few constraints on the structure of atomic actions of transactions. – It must preserve the consistency of data items. 7/24/2017 21Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 22.  Concurrency Control Anomalies Different anomalies can arise due to concurrent access of data: – Lost update anomaly – This occurs when a successful completed update operation made by one transaction is overridden by another transaction. – Uncommitted dependency – This problem occurs when one transaction allows other transactions to read its data before it has committed and then decides to abort. – Inconsistent analysis anomaly – The problem occurs when a transaction reads several values from the database but a second transaction updates some of them during the execution of the first. 7/24/2017 22Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 23.  Concurrency Control Anomalies Different anomalies can arise due to concurrent access of data: – Phantom read anomaly – This anomaly occurs when a transaction performs some operation on the database based on a selection predicate, another transaction inserts new tuples satisfying that predicate into the same database. This is known as phantom read. – Multiple-copy consistency problem – This occurs when data items are replicated and stored at different sites. To maintain the consistency, when a replicated data item is updated at one site, all other copies must be updated. Otherwise, the database becomes inconsistent. 7/24/2017 23Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 24.  Locking-based Concurrency Control Protocols – A lock is nothing but a mechanism that tells the DBMS whether a particular data item is being used by any transaction for read/write purpose. Since there are two types of operations, i.e. read and write, whose basic nature are different, the locks for read and write operation may behave differently. – In this locking-based approach, before accessing any data item, a transaction must acquire a lock on that data item. When a transaction acquires a lock on a data item, the lock prevents other transactions from modifying that data item. 7/24/2017 24Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 25.  Locking-based Concurrency Control Protocols – There are two types of locks: • read lock also known as shared lock and • write lock also known as exclusive lock. – Read lock: If a transaction obtains a read lock on a data item, it can only read but cannot update that data item. In this case, other transactions are allowed to read that data item. Because read-read operation is non-conflicting. Therefore, several transactions can acquire read lock on same data item simultaneously. – Write lock: If a transaction obtains a write lock on a data item, it can read as well as update that data item. In this case, no other transactions are allowed to read or update that data item. Because read-write and write-write operations are conflicting. 7/24/2017 25Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 26.  Locking-based Concurrency Control Protocols Basic Operation: In a distributed database system, the lock manager is responsible for managing locks for different transactions that are running on that system. When any transaction requires a lock on data items, the transaction manager passes this request to the lock manager. The lock manager checks whether that data item is currently locked by another transaction or not. If the data item is locked by another transaction and the locking mode is incompatible with the lock requested by the current transaction, the lock manager does not allow the current transaction to obtain the lock. Hence, the transaction is delayed until the existing lock is released. Otherwise, the lock manager permits the current transaction to obtain the desired lock and the information is passed to the transaction manager. 7/24/2017 26Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 27.  Locking-based Concurrency Control Protocols Up-gradation of lock Some systems initially allow the current transaction to acquire a read lock on a data item, if it is compatible with the existing lock and later the lock is converted into a write lock. This is called up- gradation of lock. Down-gradation of lock To allow maximum concurrency, some systems permit the current transaction to acquire a write lock on a data item, and later the lock is converted into a read lock. This is called down-gradation of lock. 7/24/2017 27Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 28.  Two-Phase Locking (2PL) Protocol The 2PL protocol states that no transaction should acquire a lock after it releases one of its lock. According to this protocol, the life time of each transaction is divided into two phases:  Growing phase and  Shrinking phase. In growing phase, a transaction can obtain locks on data items and can access data items, but it can not release any locks. 7/24/2017 28Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 29.  Two-Phase Locking (2PL) Protocol In shrinking phase, a transaction can release locks but cannot acquire any new locks after that. Thus, the ending of growing phase of a transaction determines the beginning of the shrinking phase of that transaction. It is not necessary for each transaction to acquire all locks simultaneously and then start processing. Normally, each transaction obtains some locks initially, does some processing and then requests for new additional locks that are required. However, it never releases any lock until it has reached a stage where no more locks are required. If up-gradation and down- gradation are allowed, then up-gradation of locks can take place in the growing phase, whereas down-gradation of locks can occur in the shrinking phase. 7/24/2017 29Md. Golam Moazzam, Dept. of CSE, JU Concurrency Control in DDBMS
  • 30.  Deadlock In a database environment, a deadlock is a situation when transactions are endlessly waiting for one another. Any lock-based concurrency control algorithm and some timestamp-based concurrency control algorithms may result in deadlocks, as these algorithms require transactions to wait for one another. 7/24/2017 30Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 31.  Deadlock Deadlock situations can be characterized by wait-for graphs, directed graphs that indicate which transactions are waiting for which other transactions. In a wait-for graph, nodes of the graph represent transactions and edges of the graph represent the waiting-for relationships among transactions. An edge is drawn in the wait-for graph from transaction Ti to transaction Tj, if the transaction Ti is waiting for a lock on a data item that is currently held by the transaction Tj. Using wait-for graphs, it is very easy to detect whether a deadlock situation has occurred in a database environment or not. There is a deadlock in the system if and only if the corresponding wait-for graph contains a cycle. 7/24/2017 31Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 32.  Deadlock – The resolution of a deadlock situation is much easier in a centralized DBMS than in a distributed DBMS. In a centralized DBMS, only one local wait-for graph (LWFG) is drawn to detect the deadlock situation. The detection of deadlocks in a distributed DBMS is more complicated, because the circular waiting situation, which determines a deadlock, may involve several different sites. Thus, in a distributed DBMS it is not sufficient to draw a LWFG for each local DBMS only, but it is also necessary to draw a global wait-for graph (GWFG) for the entire system to detect a deadlock situation. In a distributed database, an LWFG is a portion of the GWFG. 7/24/2017 32Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 33.  Deadlock – Three general techniques are available for deadlock resolution in a distributed database system: • Distributed deadlock prevention, • Distributed deadlock avoidance and • Distributed deadlock detection and recovery from deadlock. 7/24/2017 33Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 34.  Distributed Deadlock Prevention Method Distributed Deadlock prevention is a cautious scheme in which a transaction is restarted when the system suspects that a deadlock might occur. Deadlock prevention is an alternative method to resolve deadlock situations in which a system is designed in such a way that deadlocks are impossible. In this scheme, the transaction manager checks a transaction when it is first initiated and does not permit to proceed if there is a risk that it may cause a deadlock. 7/24/2017 34Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 35.  Distributed Deadlock Prevention Method In the case of lock-based concurrency control, deadlock prevention in a distributed system is implemented in the following way: Let us consider that a transaction Ti is initiated at a particular site in a distributed database system and that it requires a lock on a data item that is currently owned by another transaction Tj. Here, a deadlock prevention test is done to check whether there is any possibility of a deadlock occurring in the system. The transaction Ti is not permitted to enter into a wait state for the transaction Tj, if there is the risk of a deadlock situation. In this case, one of the two transactions is aborted to prevent a deadlock. 7/24/2017 35Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 36.  Distributed Deadlock Prevention Method The deadlock prevention algorithm is called non-preemptive if the transaction Ti is aborted and restarted. On the other hand, if the transaction Tj is aborted and restarted, then the deadlock prevention algorithm is called preemptive. The transaction Ti is permitted to wait for the transaction Tj as usual, if they pass the prevention test. The prevention test must guarantee that if Ti is allowed to wait for Tj, a deadlock can never occur. 7/24/2017 36Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 37.  Distributed Deadlock Prevention Method A better approach to implement deadlock prevention test is by assigning priorities to transactions and checking priorities to determine whether one transaction would wait for the other transaction or not. These priorities can be assigned by using a unique identifier for each transaction in a distributed system. For instance, consider that i and j are priorities of two transactions Ti and Tj respectively. The transaction Ti would wait for the transaction Tj, if Ti has a lower priority than Tj, that is, if i<j. This approach prevents deadlock, but one problem with this approach is that cyclic restart is possible. Thus, some transactions could be restarted repeatedly without ever finishing. 7/24/2017 37Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 38.  Distributed Deadlock Prevention Method One solution to the above problem is using the unique timestamp value of each transaction as the priority of that transaction. One way to obtain a global timestamp value for every transaction in a distributed system is a unique local timestamp value to each transaction by its local transactions manager and then appending the site identifier to the low-order bites of this value. Thus, timestamp values are unique throughout the distributed system and do not require that clocks at different sites are synchronized precisely. Based on timestamp values, there are two different techniques for deadlock prevention: Wait-die and Wound-wait. 7/24/2017 38Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 39.  Distributed Deadlock Prevention Method Wait-die is a non-preemptive deadlock prevention technique based on timestamp values of transactions: In this technique, when one transaction is about to block and is waiting for a lock on a data item that is already locked by another transaction, timestamp values of both the transactions are checked to give priority to the older transaction. If a younger transaction is holding the lock on data item then the older transaction is allowed to wait, but if an older transaction is holding the lock, the younger transaction is aborted and restarted with the same timestamp value. This forces the wait-for graph to be directed from the older to the younger transactions, making cyclic restarts impossible. For example, if the transaction Ti requests a lock on a data item that is already locked by the transaction Tj, then Ti is permitted to wait only if Ti has a lower timestamp value than Tj. On the other hand, if Ti is younger than Tj, then Ti is aborted and restarted with the same timestamp value. 7/24/2017 39Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 40.  Distributed Deadlock Prevention Method Wound-Wait is an alternative preemptive deadlock prevention technique by which cyclic restarts can be avoided. In this method, if a younger transaction requests for a lock on a data item that is already held by an older transaction, the younger transaction is allowed to wait until the older transaction releases the corresponding lock. In this case, the wait-for graph flows from the younger to the older transactions, and cyclic restart is again avoided. For instance, if the transaction Ti requests a lock on a data item that is already locked by the transaction Tj, then Ti is permitted to wait only if Ti has a higher timestamp value than Tj, otherwise, the transaction Tj is aborted and the lock is granted to the transaction Ti. 7/24/2017 40Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 41.  Distributed deadlock detection and recovery Method Deadlock detection and recovery is the most popular and most suitable technique for deadlock management in a database environment. In deadlock detection and recovery method, first it is checked whether any deadlock has occurred in the system. After detection of a deadlock situation in the system, one of the involved transactions is chosen as the victim transaction and is aborted to resolve the deadlock situation. Deadlock situations are detected by explicitly constructing a wait-for graph and searching it for cycles. A cycle in the wait-for graph indicates that a deadlock has occurred, and one transaction in the cycle is chosen as the victim, which is aborted and restarted. To minimize the cost of restarting, the victim selection is usually based on the number of data items used by each transaction in the cycle. 7/24/2017 41Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 42.  Distributed deadlock detection and recovery Method The principal difficulty in implementing deadlock detection in a distributed database environment is constructing the GWFG efficiently. In a distributed DBMS, a LWFG for each local DBMS can be drawn easily; however, these LWFGs are not sufficient to represent all deadlock situations in the distributed system. For example, consider that there are three different sites in a distributed system, and each site has constructed a LWFG as shown in figure. The LWFG for each site is constructed in the usual manner using local transactions and data items stored at that particular site. A cycle in a LWFG indicates that a deadlock has occurred locally. The LWFGs in Fig. illustrate that no deadlock has occurred locally in the three different sites, as there are no cycles in the LWFGs, but this does not guarantee that no deadlock has occurred globally. To detect a deadlock situation in the distributed system, it is necessary to construct a GWFG from these different LWFGs and to search it for cycles. 7/24/2017 42Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 43.  Distributed deadlock detection and recovery Method 7/24/2017 43Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management T1 T2 T5 T2 T3 Site 1 T5 T1 Site 2 Site 3 Fig. : Local Wait-For Graphs (LWFGs) at different Sites
  • 44.  Distributed deadlock detection and recovery Method The corresponding GWFG in Fig. illustrates that a deadlock has occurred in the distributed system, although no deadlock has occurred locally. 7/24/2017 44Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management Fig.: Global Wait-For Graph (GWFG) for the above Fig. T1 T2 T5 T3
  • 45.  Distributed deadlock detection and recovery Method There are three different techniques for detecting deadlock situations in a distributed system: – Centralized deadlock detection, – Hierarchical deadlock detection and – Distributed deadlock detection 7/24/2017 45Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 46.  Centralized Deadlock detection In Centralized Deadlock detection method, a single site is chosen as Deadlock Detection Coordinator (DDC) for the entire distributed system. The DDC is responsible for constructing the GWFG for system. Each lock manager in the distributed database transmits its LWFG to the DDC periodically. The DDC constructs the GWFG from these LWFGs and checks for cycles in it. The occurrence of a global deadlock situation is detected if there are one or more cycles in the GWFG. The DDC must break each cycle in the GWFG by selecting the transactions to be rolled back and restarted to recover from a deadlock situation. The information regarding the transactions that are to be rolled back and restarted must be transmitted to the corresponding lock managers by the deadlock detection coordinator. 7/24/2017 46Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 47.  Centralized Deadlock detection – The centralized deadlock detection approach is very simple, but it has several drawbacks. – This method is less reliable, as the failure of the central site makes the deadlock detection impossible. – The communication cost is very high in the case, as other sites in the distributed system send their LWFGs to the central site. – Another disadvantage of centralized deadlock detection technique is that false detection of deadlocks can occur, for which the deadlock recovery procedure may be initiated, although no deadlock has occurred. In this method, unnecessary rollbacks and restarts of transactions may also result owing to phantom deadlocks. 7/24/2017 47Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 48.  Distributed Deadlock detection In distributed deadlock detection method, a deadlock detector exists at each site of the distributed system. In this method, each site has the same amount of responsibility, and there is no such distinction as local or global deadlock detector. A variety of approaches have been proposed for distributed deadlock detection algorithms, but the most well-known and simplified version, which is presented here, was developed by R. Obermarck in 1982.The centralized deadlock detection approach is very simple, 7/24/2017 48Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 49.  Distributed Deadlock detection In this approach, a LWFG is constructed for each site by the respective local deadlock detectors. An additional external node is added to the LWFGs, as each site in the distributed system receives the potential deadlock cycles from other sites. In the distributed deadlock detection algorithm, the external node Tex is added to the LWFGs to indicate whether any transaction from any remote site is waiting for a data item that is being held by a transaction at the local site or whether any transaction from the local site is waiting for a data item is currently being used by any transaction at any remote site. 7/24/2017 49Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 50.  Distributed Deadlock detection For instance, an edge from the node Ti to Tex exists in the LWFG, if the transaction Ti is waiting for a data item that is already held by any transaction at any remote site. Similarly, an edge from the external node Tex to Ti exists in the graph, if a transaction from a remote site is waiting to acquire a data item that is currently being held by the transaction Ti at the local site. 7/24/2017 50Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 51.  Distributed Deadlock detection Thus, the local detector checks for two things to determine a deadlock situation. If a LWFG contains a cycle that does not involve the external node Tex, then it indicates that a deadlock has occurred locally and it can be handled locally. On the other hand, a global deadlock potentially exists if the LWFG contains a cycle involving the external node Tex. However, the existence of such a cycle does not necessarily imply that there is a global deadlock, as the external node Tex represents different agents. 7/24/2017 51Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 52.  Distributed Deadlock detection The LWFGs are merged so as to determine global deadlock situations. To avoid sites transmitting their LWFGs to each other, a simple strategy is followed here. According to this strategy, one timestamp value is allocated to each transaction and a rule is imposed such that one site Si transmits its LWFG to the site Sk, if a transaction, say Tk, at site Sk is waiting for a data item that is currently being held by a transaction Ti at site Si and ts(Ti)<ts(Tk). If ts (Ti)<ts(Tk), the site Si transmits its LWFG to the site Sk, and the site Sk adds this information to its LWFG and checks for cycles not involving the external the node Tex in the extended graph. If there is no cycle in the extended graph, the process continues until a cycle appears and it may happen that the entire GWFG is constructed and no cycle is detected. In this case, it is decided that there is no deadlock in the entire distributed system. 7/24/2017 52Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 53.  Distributed Deadlock detection On the other hand, if the GWFG contains a cycle not involving the external node Tex, it is concluded that a deadlock has occurred in the system. The distributed deadlock detection method is illustrated below. 7/24/2017 53Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management Site 1 Site 2 Site 3 Fig. Distributed Deadlock Detection Ti Tex Tk Site 3 Site 2 Tj Tex Ti Site 1 Site 3 Tk Tex Tj Site 2 Site 1
  • 54.  False Deadlocks To handle the deadlock situation in distributed database systems, a number of messages are transmitted among the sites. The delay associated with the transmission of messages that is necessary for deadlock detection can cause the detection of False Deadlocks. For instance, consider that at a particular time the deadlock detector has received the information that the transaction Ti is waiting for the transaction Tj. Further assume that after some time the transaction Tj releases the data item requested by the transaction Ti and requests for data item that is being currently held by the transaction Ti. If the deadlock detector receives the information that the transaction Tj has requested for a data item that is held by the transaction Ti before receiving the information that the transaction Ti is not blocked by the transaction Tj any more, a false deadlock situation is detected. 7/24/2017 54Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management
  • 55.  Phantom Deadlocks Another problem is that a transaction Ti that blocks another transaction may be restarted for reasons that are not related to deadlock detection. In this case, until the restart message of the transaction Ti is transmitted to the deadlock detector, the deadlock detector can find a cycle in the wait-for graph that includes the transaction Ti. Hence, a deadlock situation is detected by the deadlock detector and this is called a Phantom Deadlock. When the deadlock detector detects a phantom deadlock, it may unnecessarily restart a transaction other than Ti. To avoid unnecessary restarts for phantom deadlock, special safety measures are required. 7/24/2017 55Md. Golam Moazzam, Dept. of CSE, JU Distributed Deadlock Management