deadlock detection using goldman's algorithm by aniket choudhury

22
DEADLOCK DETECTION Presented By : Submitted To: Aniket Choudhury Narendrasinh Limbad 140320702501(C.E)

Upload: aniket-choudhury

Post on 13-Aug-2015

129 views

Category:

Engineering


2 download

TRANSCRIPT

Page 1: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

DEADLOCK DETECTION

Presented By : Submitted To:

Aniket Choudhury Narendrasinh Limbad

140320702501(C.E)

Page 2: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

OUTLINE:

Introduction What is deadlock? Communication deadlock Resource deadlock

Condition for deadlock Mutual exclusion Hold and wait No preemption Circular wait

Deadlock detection Centralized approach Hierarchical approach Distributed approach

Advantages Conclusion Reference

Page 3: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

INTRODUCTION

What is Deadlock?

Before we proceed on how to detect a deadlock it is important to know what is deadlock and how it occurs.

Page 4: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

CONT..

A deadlock can be defined as permanent blocking of a set of processes that are either competing for system resources or communicating with each other.

Deadlock can be of two types Communication Deadlock Resource Deadlock

Page 5: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

COMMUNICATION DEADLOCK

This type of deadlock occurs among a set of process when they are blocked and are waiting for messages from other processes in order to start execution, but there is no message exchange between them.

Page 6: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

RESOURCE DEADLOCK

This type of deadlock occur when two or more process wait permanently for resource held by each other.

Page 7: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

CONDITIONS FOR DEADLOCK

Mutual exclusion condition

Hold and wait condition

No preemption condition

Circular wait condition

Page 8: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

MUTUAL EXCLUSION CONDITION In this condition the resource is in a non-shareable state.

That is if one process is using the resource and at the same time another process requests for the same particular resource then it has to wait until the first process releases the resource.

Page 9: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

HOLD AND WAIT CONDITION

In this condition a process is holding a resource and at the same time requesting for another resource which is held by another process.

Page 10: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

NON-PREEMPTION CONDITION

In this condition no resource can be forcefully taken away from a process, a waiting process needs to wait until the process holding the resource releases it voluntarily.

Page 11: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

CIRCULAR WAIT CONDITION This situation arises when two or more processes form a

circular ring in which each process is waiting for resource which is held by next member for chain.

Page 12: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

DEADLOCK DETECTION

Deadlock can be detected using following approaches:

Centralized approach for

deadlock detection

Hierarchical approach for

deadlock detection

Distributed approach for

deadlock detection

Page 13: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

CENTRALIZED APPROACH

In this approach, there is a local coordinator at each site that maintains a Weight For Graph(WFG) for its local resource.

There is also a central coordinator, which constructs a global WFG from information received form local coordinators of all sites.

Using this global WFG a deadlock can be detected.

Page 14: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

HIERARCHICAL APPROACH

This approach uses logical hierarchy of deadlock detectors.

These detectors are called controllers.

Each controller is responsible for detecting those deadlocks which fall within its range in the hierarchy.

Therefore, unlike the centralized approach in which the entire global WFG is maintained at a single site, in this approach it is distributed over a number of different controllers.

Page 15: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

DISTRIBUTED APPROACH

Goldman’s Algorithm

Goldman’s algorithm[1] exchanges deadlock-related information in the form of an ordered blocked process list (OBPL).

In OBPL each process (except the last) is blocked by its successor.

The last process in an OBPL may either be waiting to access a resource or be running.

Page 16: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

For example, In OBPL P1,P2,P3,P4 represents the state graph in figure.

Algorithm detects deadlock by repeatedly expanding the OBPL, appending the process that holds the resource needed by the last process in the list until a deadlock is discovered(the last process is blocked by a process in the list) or OBPL is discarded(the last process is running).

Page 17: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

For example, consider the above figure, in this the process P1 initiates deadlock detection and sends OBPL P1,P2 to process P2.

Page 18: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

CONT..

When process P2 receives the OBPL, it appends P3 to the OBPL and sends the new OBPL P1,P2,P3 to P3.

Similarly P3 sends OBPL to P1,P2,P3,P4.

Ultimately P4 Sends OBPL to P1,P2,P3,P4,P5

When P5 receives the OBPL, it discards the OBPL because it is not blocked by P1,P2,P3 or P4.

Had P5 been blocked by P1,P2,P3 or P4, a deadlock would have been detected by P5.

Page 19: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

       ADVANTAGES AND LIMITATIONS

The advantage of Goldman’s algorithm is that it does not require continuous maintenance of WFG.

It constructs an OBPL whenever deadlock detection is to be carried out.

Page 20: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

    CONCLUSION

There are various approaches such as centralized approach, hierarchical approach and distributed approach for deadlock detection. Every approach has its own advantages and disadvantages however, out of them the goldman’s algorithm[1] in the distributed approach is more effective as it does not require continuous maintenance of WFG.

Page 21: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

    REFERENCES

[1] Mukesh Singhal “Deadlock Detection in Distributed Systems,” IEEE Trans. Computers, Nov. 1989, pp. 0018-9162/89/1100-0037.

[2] Ahmed K. Elmagarmid ”A SURVEY OF DISTRIBUTED DEADLOCK DETECTION ALGORITHMS,” SIGMOD RECORD, Vol. 15, No. 3, September 1986.

Page 22: deadlock detection using Goldman's algorithm by ANIKET CHOUDHURY

THANK YOU