deadlock detection using goldman's algorithm by aniket choudhury

Post on 13-Aug-2015

129 Views

Category:

Engineering

2 Downloads

Preview:

Click to see full reader

TRANSCRIPT

DEADLOCK DETECTION

Presented By : Submitted To:

Aniket Choudhury Narendrasinh Limbad

140320702501(C.E)

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

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.

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

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.

RESOURCE DEADLOCK

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

CONDITIONS FOR DEADLOCK

Mutual exclusion condition

Hold and wait condition

No preemption condition

Circular wait condition

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.

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.

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.

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.

DEADLOCK DETECTION

Deadlock can be detected using following approaches:

Centralized approach for

deadlock detection

Hierarchical approach for

deadlock detection

Distributed approach for

deadlock detection

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.

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.

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.

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).

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

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.

       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.

    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.

    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.

THANK YOU

top related