On receiving this message, a site sends its local waitfor graph to the
coordinator. Note that such a graph contains all the local information that
the site has about the state of the real graph. The waitfor graph re±ects
an instantaneous state of the site, but it is not synchronized with respect
to any other site.
When the controller has received a reply from each site, it constructs a
graph as follows:
•
The graph contains a vertex for every transaction in the system.
•
The graph has an edge (
T
i
,
T
j
) if and only if:
◦
There is an edge (
T
i
,
T
j
) in one of the waitfor graphs.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentPractice Exercises
5
◦
An edge (
T
i
,
T
j
,
n
) (for some
n
) appears in more than one waitfor
graph.
Show that, if there is a cycle in the constructed graph, then the system is
in a deadlock state, and that, if there is no cycle in the constructed graph,
then the system was not in a deadlock state when the execution of the
algorithm began.
Answer:
Let us say a cycle
T
i
→
T
j
→ ··· →
T
m
→
T
i
exists in the graph
built by the controller. The edges in the graph will either be local edges
of the from (
T
k
,
T
l
) or distributed edges of the form (
T
k
,
T
l
,
n
). Each local
edge (
T
k
,
T
l
) deFnitely implies that
T
k
is waiting for
T
l
. Since a distributed
edge (
T
k
,
T
l
,
n
) is inserted into the graph only if
T
k
’s request has reached
T
l
and
T
l
cannot immediately release the lock,
T
k
is indeed waiting for
T
l
.
Therefore every edge in the cycle indeed represents a transaction waiting
for another. ±or a detailed proof that this imlies a deadlock refer to Stuart
et al. [1984].
We now prove the converse implication. As soon as it is discovered that
T
k
is waiting for
T
l
:
a.
a local edge (
T
k
,
T
l
) is added if both are on the same site.
b.
The edge (
T
k
,
T
l
,
n
) is added in both the sites, if
T
k
and
T
l
are on
different sites.
Therefore, if the algorithm were able to collect all the local waitfor graphs
at the same instant, it would deFnitely discover a cycle in the constructed
graph, in case there is a circular wait at that instant. If there is a circu
lar wait at the instant when the algorithm began execution, none of the
edges participating in that cycle can disappear until the algorithm Fn
ishes. Therefore, even though the algorithm cannot collect all the local
graphs at the same instant, any cycle which existed just before it started
will anyway be detected.
19.10
Consider a relation that is fragmented horizontally by
plant
number
:
employee
(
name, address, salary, plant
number
)
Assume that each fragment has two replicas: one stored at the New York
site and one stored locally at the plant site. Describe a good processing
strategy for the following queries entered at the San Jose site.
a.
This is the end of the preview.
Sign up
to
access the rest of the document.
 Spring '13
 Dr.Khansari
 site, sites

Click to edit the document details