4. constraint automata

advertisement
Proving a distributed deadlock detection/resolution algorithm with constraint automata
Proving a distributed deadlock detection/resolution algorithm with
constraint automata
Hossein Hojjat
University of Tehran
h.hojjat@ece.ut.ac.ir
ABSTRACT
The problem of deadlock detection is addressed many in literature. It is know as a well known
point that the detection and resolution of deadlocks can be done better in a completely distributed
manner, i.e. no central site has a complete knowledge of the whole site. However, omit using the
formal methods in designing the algorithms can be led to several minor or major bugs in the
algorithm design. We use constraint automata for modeling a distributed deadlock detection/
resolution algorithm.
KEYWORDS: Constraint automata, deadlock detection
1.
INTRODUCTION
A deadlock occurs when transactions which hold some resources request some resources that are
already in use by other transactions in the same set. The simplest case of a sample deadlock
consists of two processes, every one holding a different resource in exclusive mode and each
requesting an access to resources held by other processes. Unless the deadlock is resolved, all the
processes involved are blocked indefinitely. Therefore, a deadlock requires the attention of a
process outside those involved in the deadlock for its detection and resolution. A deadlock is
resolved by aborting one or more processes involved in the deadlock and granting the released
resources to other processes involved in the deadlock. A process is aborted by withdrawing all its
resource requests, restoring its state to an appropriate previous state, relinquishing all the
resources it acquired after that state.
The history shows that the algorithms which do not provide some formal methods are vulnerable
to errors. As a classical example, consider the Choudhary algorithm. In [3] they showed that the
priority based probe algorithm of Sinha and Natarjan is incorrect. Their problem have also turned
out to be false, which reported in some researches [17].
2. DEADLOCK HANDLING METHODOLOGIES
The three strategies for handling deadlocks are deadlock prevention, deadlock avoidance, and
deadlock detection. In deadlock prevention, resources are granted to requesting processes in such
a way that a request for a resource never leads to a deadlock. The simplest way to prevent a
deadlock is to acquire all the needed resources before a process starts executing. In another
method of deadlock prevention, a blocked process releases the resources requested by an active
process.
In deadlock avoidance strategy, a resource is granted to a process only if the resulting state is
safe. (A state is safe if there is at least one execution sequence that allows all processes to run to
completion.)
Finally, in deadlock detection strategy, resources are granted to a process without any check.
Periodically (or whenever a request for a resource has to wait) the status of resource allocation
and pending requests is examined to determine if a set of processes is deadlocked. This
examination is performed by a deadlock detection algorithm. If a deadlock is discovered, the
system recovers from it by aborting one or more deadlocked processes.
3. USING FORMAL METHODS
The deadlock problem in distributed systems has been analyzed under several resource allocation
models [8]. The Single Request model -the simplest one- assumes that each process has at most
one outstanding resource request at any time. After performing a request, the process remains
blocked until the resource is assigned to it. Other models accept simultaneous requests for more
than one resource. The multiple request models are classified according to the condition that a
process must fulfill in order to become unblocked:
1) In the AND model, the process remains blocked until all requested resources are assigned to
it,
2) In the OR model, the process remains blocked until at least one of the requested resources is
assigned to it; and
3) In the generalized models-i.e., AND-OR, M-out-of-N-it is assumed that the process waits until
a certain function of the requested and assigned resources becomes true.
A Distributed Deadlock Detection/Resolution (DDD/R) algorithm is considered correct if it
satisfies the following conditions:
1) Safety: the algorithm only detects/resolves true deadlocks;
2) Liveness: the algorithm detects/resolves all deadlocks in finite time.
These correctness criteria are usually considered under the assumption that all abortions
produced in the system are caused by the algorithm, that is, in the absence of spontaneous
abortions. No algorithm can satisfy the Safety condition if spontaneous abortions are considered.
4. CONSTRAINT AUTOMATA
Constraint automata are a formalism to describe the behavior and possible data flow in
coordination models that connect anonymous components to enable their coordinated interaction.
The theory of constraint automata yields a basis for formal verification of coordination
mechanisms (e.g., model checking against temporal-logical specifications or equivalence
checking). Constraint automata can be thought of as conceptual generalizations of probabilistic
automata where data constraints, instead of probabilities, influence applicable state transitions.
Constraint automata can serve as an operational model for the coordination language Reo. Reo is
a channel-based exogenous coordination model wherein complex coordinators, called
connectors, are compositionally built out of simpler ones.
Advanced Database Course
2/4
5. MODELING WITH CONSTRAINT AUTOMATA
A manager satisfying the single request model provides to the resolution algorithm a set of well
formed histories, denoted H0, as it is formalized in the following Definition. In the following
definition, we introduce the abuses of notation πk0…πk1 denoting the set {πk | k0≤k≤k1}, πk0…as π
k0…∞. Finally, the set B={(ij) I i #J} r N x N , is a fixed set indicating the possible arcs to be
performed by the Manager.
6. CONCLUSION
We presented a formal approach for proving a distributed deadlock detection and resolution.
ACKNOWLEDGMENTS
We are grateful to Masoud Rahgozar for his elegant ability to teach database.
REFERENCES
[1] Baier C., Sirjani M., Arbab F., Rutten J., “Modeling Component Connectors in Reo by
Constraint Automata”, SCP Journal, 2004.
[2] Chandy K.M. and Misra J., “A Distributed Algorithm for Detecting Resource Deadlocks in
Distributed Systems”, Proc. ACM Symp. Principles of Distributed Computing, pp. 157-164,
Ottawa, Canada, Aug. 1982.
[3] Choudhary A.L., W.H. Kohler, J.A. Stankovic, and D. Towsley, “A Modified Priority Based
Probe Algorithm for Distributed Deadlock Detection and Resolution”, IEEE Trans. Software
Eng., vol. 15, no. 1, pp. 10-17, Jan. 1989.
[4] Choudhary A.L., W. H. Kohler, J.A. Stankovic, and D. Towsley, "Correction to "a modified
priority based probe algorithm for distributed deadlock detection and resolution"”, IEEE
Transactions on Software Engineering, vol. 15, p. 1644, Dec. 1989.
[5] González de Mendívil J.R., Bernabeu J., Demaille A., and Garitagoitia J.R., “Correctness of
a Distributed Deadlock Resolution Algorithm for the Single Request Model”, Proc. Third
Euromicro Workshop Parallel and Distributed Systems, pp. 254-261, San Remo, Italy, Jan.
1995.
[6] González de Mendívil J.R., Fariña F., Garitagoitia J.R., Alastruey C.F., Bernabéu-Aubán
J.M., “A Distributed Deadlock Resolution Algorithm for the AND Model”, IEEE
Transactions on Parallel Distributed Systems, vol. 10, no. 5, pp. 433 – 447, 1999.
[7] González de Mendívil J.R., Fariña F., Villadangos J., and Garitagoitia J.R., “Liveness
Conditions for a Safe Distributed Deadlock Resolution Algorithm”, Proc. Fourth Euromicro
Workshop Parallel and Distributed Processing, pp. 139-146, Braga, Portugal, Jan. 1996.
[8] Knapp E., “Deadlock Detection in Distributed Databases”, ACM Computing Surveys, vol. 19,
no. 4, pp. 303-328, Dec. 1987.
[9] Kshemkalyani A.D. and Singhal M., “Invariant-Based Verification of a Distributed Deadlock
Detection Algorithm”, IEEE Trans. Software Eng., vol. 17, no. 8, pp. 789-799, Aug. 1991.
[10] Kshemkalyani A.D. and Singhal M., “Efficient Detection and Resolution of Generalized
Distributed Deadlocks”, IEEE Trans. Software Eng., vol. 20, no. 1, pp. 43-53, Jan. 1994.
[11] Lee D. and Kim M., “A Distributed Scheme for Dynamic Deadlock Detection and
Resolution”, Information Sciences, vol. 64, pp. 149-164, 1992.
Advanced Database Course
3/4
[12] Lynch N.A. and Tuttle M.R., “An Introduction to Input/Output Automata”, CWI
Quarterly, vol. 2, no. 3, pp. 219-246, Sept. 1989.
[13] Menasce D.A. and Muntz R.R., “Locking and Deadlock Detection in Distributed Data
Bases”, IEEE Trans. Software Eng., vol. 5, no. 3, pp. 195-202, May 1979.
[14] Mitchell D.P. and Merritt M.J., “A Distributed Algorithm for Deadlock Detection and
Resolution”, Proc. Third ACM Symp. Principles of Distributed Computing, pp. 282-284,
Vancouver, Canada, Aug. 1984.
[15] Obermarck R.L., “Distributed Deadlock Detection Algorithm”, ACM Trans. Database
Systems, vol. 7, no. 2, pp. 187-208, June 1982.
[16] Roesler M. and Burkhard W. A., “Resolution of Deadlocks in Object-Oriented
Distributed Systems”, IEEE Trans. Computers, vol. 38, no. 8, pp. 1,212-1,224, Aug. 1989.
[17] Shyam B. and Dhamdhere D.M., "A New Priority Based Probe Algorithm for Distributed
Deadlock Detection," IIT Bombay Technical Report, 1990.
[18] Singhal M., “Deadlock Detection in Distributed Systems”, Computer, pp. 37-48, Nov.
1989.
[19] Sinha M.K. and Natarajan N., “A Priority Based Distributed Deadlock Detection
Algorithm”, IEEE Trans. Software Eng., vol. 11, no. 1, pp. 67-80, Jan. 1985.
[20] Tuttle M.R. and Lynch N.A., “Hierarchical Correctness Proofs for Distributed
Algorithms”, Technical Report MIT/LCS/TR-387, MIT Laboratory for Computer Science,
1987.
[21] Wang S. and Vossen G., “Towards Efficient Algorithms for Deadlock Detection and
Resolution in Distributed Systems”, Proc. Fifth Int'l Conf. Data Eng., pp. 287-294, 1989.
Advanced Database Course
4/4
Download