When the controller has received a reply from each

Info icon This preview shows pages 4–7. Sign up to view the full content.

View Full Document Right Arrow Icon
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 wait-for graphs.
Image of page 4

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Practice Exercises 5 An edge ( T i , T j , n ) (for some n ) appears in more than one wait-for 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 ) definitely 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. For 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 wait-for graphs at the same instant, it would definitely 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 fin- 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. Find all employees at the Boca plant. b. Find the average salary of all employees. c. Find the highest-paid employee at eachof the following sites: Toronto, Edmonton, Vancouver, Montreal. d. Find the lowest-paid employee in the company.
Image of page 5
6 Chapter 19 Distributed Databases Answer: a. i. Send the query Pi1 name ( employee ) to the Boca plant. ii. Have the Boca location send back the answer. b. i. Compute average at New York.
Image of page 6

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern