Deadlock-Issues in deadlock detection & Resolutions

DEADLOCK-ISSUES IN DEADLOCK DETECTION & RESOLUTIONS


Deadlock:

Ø  Deadlock is a fundamental problem in distributed systems.

Ø  A process may request resources in any order, which may not be known a priori and a process can request resource while holding others.

Ø  If the sequence of the allocations of resources to the processes is not controlled, deadlocks can occur.

Ø  A deadlock is a state where a set of processes request resources that are held by other processes in the set.

System model:
Ø  A distributed program is composed of a set of n asynchronous processes p1, p2, . . . , p, . . . , pthat communicates by message passing over the communication network.

Ø  Without loss of generality we assume that each process is running on a different processor.

Ø  The processors do not share a common global memory and communicate solely by passing messages over the communication network.

Ø  There is no physical global clock in the system to which processes have instantaneous access.

Ø  The communication medium may deliver messages out of order, messages may be lost garbled or duplicated due to timeout and retransmission, processors may fail and communication links may go down.

Ø  We make the following assumptions:
·         The systems have only reusable resources.
·          Processes are allowed to make only exclusive access to resources.
·         There is only one copy of each resource.

Ø  A process can be in two states: running or blocked.

Ø  In the running state (also called active state), a process has all the needed resources and is either executing or is ready for execution.

Ø  In the blocked state, a process is waiting to acquire some resource.

Wait-For-Graph (WFG)
Wait for graph (WFG)

Ø  The state of the system can be modeled by directed graph, called a wait for graph (WFG).

Ø  In a WFG , nodes are processes and there is a directed edge from node P1 to mode P2 if P1 is blocked and is waiting for P2 to release some resource.

Ø  A system is deadlocked if and only if there exists a directed cycle or knot in the WFG.

Ø  Figure 1 shows a WFG, where process P11 of site 1 has an edge to process P21 of site 1 and P32 of site 2 is waiting for a resource which is currently held by process P21.

Ø  At the same time process P32 is waiting on process P33 to release a resource.

Ø  If P21 is waiting on process P11, then processes P11, P32m and P21 form a cycle and all the four processes are involved in a deadlock depending upon the request model.

Preliminaries
An example of a WFG

Deadlock Handling Strategies:

Ø  There are three strategies for handling deadlocks, viz., deadlock prevention, deadlock avoidance, and deadlock detection.

Ø  Handling of deadlock becomes highly complicated in distributed systems because no site has accurate knowledge of the current state of the system and because every inter-site communication involves a finite and unpredictable delay.

Ø  Deadlock prevention is commonly achieved either by having a process acquire all the needed resources simultaneously before it begins executing or by preempting a process which holds the needed resource.

Ø  This approach is highly inefficient and impractical in distributed systems.

Ø  In deadlock avoidance approach to distributed systems, a resource is granted to a process if the resulting global system state is safe (note that a global state includes all the processes and resources of the distributed system).

Ø  However, due to several problems, deadlock avoidance is impractical in distributed systems.

Ø  Deadlock detection requires examination of the status of process-resource interactions for presence of cyclic wait.

Ø  Deadlock detection in distributed systems seems to be the best approach to handle deadlocks in distributed systems.

Issues in deadlock detection:

·         Deadlock handling using the approach of deadlock detection entails addressing two basic issues: First, detection of existing deadlocks and second resolution of detected deadlocks.

·         Detection of deadlocks involves addressing two issues: Maintenance of the WFG and searching of the WFG for the presence of cycles (or knots).


Correctness Criteria:

A deadlock detection algorithm must satisfy the following two conditions:

(i) Progress (No undetected deadlocks):

·         The algorithm must detect all existing deadlocks in finite time.

·         In other words, after all wait-for dependencies for a deadlock have formed, the algorithm should not wait for any more events to occur to detect the deadlock.


(ii) Safety (No false deadlocks):

·         The algorithm should not report deadlocks which do not exist (called phantom or false deadlocks).

Resolution of detected deadlock:

Ø  Deadlock resolution involves breaking existing wait-for dependencies between the processes to resolve the deadlock.

Ø  It involves rolling back one or more deadlocked processes and assigning their resources to blocked processes so that they can resume execution.


DISTRIBUTED SYSTEM

EasyExamNotes.com covered following topics in these notes.
Python Programming ↓ 👆
Java Programming ↓ 👆
JAVA EasyExamNotes.com covered following topics in these notes.
JAVA Programs
Principles of Programming Languages ↓ 👆
Principles of Programming Languages
EasyExamNotes.com covered following topics in these notes.

Practicals:
Previous years solved papers:
A list of Video lectures References:
  1. Sebesta,”Concept of programming Language”, Pearson Edu 
  2. Louden, “Programming Languages: Principles & Practices” , Cengage Learning 
  3. Tucker, “Programming Languages: Principles and paradigms “, Tata McGraw –Hill. 
  4. E Horowitz, "Programming Languages", 2nd Edition, Addison Wesley

    Computer Organization and Architecture ↓ 👆

    Computer Organization and Architecture 

    EasyExamNotes.com covered following topics in these notes.

    1. Structure of desktop computers
    2. Logic gates
    3. Register organization
    4. Bus structure
    5. Addressing modes
    6. Register transfer language
    7. Direct mapping numericals
    8. Register in Assembly Language Programming
    9. Arrays in Assembly Language Programming

    References:

    1. William stalling ,“Computer Architecture and Organization” PHI
    2. Morris Mano , “Computer System Organization ”PHI

    Computer Network ↓ 👆
    Computer Network

    EasyExamNotes.com covered following topics in these notes.
    1. Data Link Layer
    2. Framing
    3. Byte count framing method
    4. Flag bytes with byte stuffing framing method
    5. Flag bits with bit stuffing framing method
    6. Physical layer coding violations framing method
    7. Error control in data link layer
    8. Stop and Wait scheme
    9. Sliding Window Protocol
    10. One bit sliding window protocol
    11. A protocol Using Go-Back-N
    12. Selective repeat protocol
    13. Application layer
    References:
    1. Andrew S. Tanenbaum, David J. Wetherall, “Computer Networks” Pearson Education.
    2. Douglas E Comer, “Internetworking with TCP/IP Principles, Protocols, And Architecture",Pearson Education
    3. KavehPahlavan, Prashant Krishnamurthy, “Networking Fundamentals”, Wiley Publication.
    4. Ying-Dar Lin, Ren-Hung Hwang, Fred Baker, “Computer Networks: An Open Source Approach”, McGraw Hill.