Deadlock Term Paper
Abstract-Distributed systems easily get deadlocks if they do not have a distributed shared memory. Deadlocks are primarily caused by open strings of requests and releases in a distributed system. When deadlocks go undetected, they can lead to thread blockage. Current deadlock detection methods are more about timeouts and rollback algorithms, and they cause more delay. This paper critically analysis Deadlock Detector and Solver (DDS) in Java programs as well as other methods or approaches of dealing with deadlocks.
Keywords— Deadlock Detector and Solver, Runtime monitoring and Static Analysis architecture, distributed systems.
Visit this site if you need Deadlock paper writing help from experts!
INTRODUCTION
In the field of computer science, deadlock can be defined as a condition where two or more processes are waiting for each other to release a system resource [1]. In a multiprocessing system deadlock is a common problem and it is commonly referred to as software lock or soft lock. When computers work together as a team, unprecedented problems tend to appear and when there is no shared memory, and computers deadlock occurs. The main advantage of using distributed systems is the sharing of resources [1]. For a computer to work effectively, it has to send process tasks using resources within the system. When processing the tasks, the computer locks resources and releases the resource when the process is complete. If a process locks a resource for long periods of time, deadlocks emerge. The problem can be resolved if the processes causing the deadlock are aborted or restarted. A process is stopped if all the resources that it is holding to have been released. This analysis aimed to analyze the different types of deadlocks and effective ways of solving them.
1.1 MOTIVATION
The evolution of technology has made the world a smaller place, and people can now communicate with one another, regardless of the geographical distance. Computers have changed how people live and interact with one another, and there is no limit to what computers can do. However, many things are hindering computers from reaching their full potential and deadlocks is one of the common challenges. If computer engineers come up with ways that will address deadlocks, computer systems will be high-speed and reliable. Researchers can analyze millions of data in a matter of seconds, and world-changing inventions will work on a weekly basis, in short, there will be no limit to the computer’s ability.
2.0 GOAL/AIM OF THE RESEARCH
The main focus of this paper is to analyze and understand distributed deadlock detection. The focus will be on how to mitigate the deadlocks and the main types of deadlocks that computer affects systems.
3.0 METHODOLOGY
Researchers have used both dynamic and static methods continuously in deadlock solving and detection. Therefore, the best interventions to be used for the distributed system has to be either runtime monitoring or model checking. Both of these techniques rely on determining the cycles in the distributed system. These cycles are going to be detected by deadlock detection approaches. Deadlock Detector and Solver (DDS) is also very efficient in detecting deadlocks as well as resolving them. DDS is mostly used in Java programs. DDS uses static methods to select processes that are in a cycle.
4.0 SYSTEM MODELS
A distributed system is a set of computers connected in a network of interconnected communication links. Within the network, there are several resources as well as processes. A resource controller usually controls the resources. In a system, processes can coexist together with resources at the same computer or workstation. When the computers are connected in a network, the resources and processes communicate by sending messages. The messages flow in a first out manner, and they are usually very reliable. Within the network, there is no specified time limit for messages to be delivered, but one this particular message from process A will be delivered to process B eventually [1]. A process can either be idle or executing, and it is idle when a resource is completing another process.
4.1 Resource and Deadlock model
Resource model and communication models are the two main deadlock models. These models have been the center of discussions with computer engineers for nearly three decades [3].
4.1.1 Resource Model
In order for a process to get a resource, it has to request for it. The same scenario happens in distributed databases with data objects. Several processes can wait for a single resource at the same time, but they cannot proceed to the resource until they get all the locks for the resource [3]. A resource deadlock can be defined as a set of resources waiting for other resources to release a lock on the resource. A system model divides a communication message into two; control and computation message. Computation messages are messages sent when an application process is being executed. Computation messages can be a request message, reply message, or a cancel message. Request messages are usually sent by a process to a resource controller when the process wants to gain access to the resource. A reply message is usually sent by a resource controller to a process confirming that the resource is now available. A cancel request is usually sent by a process to the resource controller informing the controller that the request has been canceled [3].
4.1.2 Communication Model
In the communication model, both the processes and the resources are getting messages. Blocked processes are processes that are waiting for messages to arrive simultaneously. A process can only be unlocked if a subset of the message that it is waiting for arrives [3]. A communication deadlock occurs when it is nonempty in a process and if all other process is permanently idle in the set. A process is said to be permanently idle if it does not receive any message from the process’s dependent sets [3]. Permanent Idle is not easily detected by timeout because it is unknown when a process will send a message. A process F is idle if all the processes in S are Idle, it can also be idle if there are no messages being sent or in transit between the processes [3].
5.0 GRAPH-REPRESENTATION OF DEADLOCKS
It is essential to have a data structure representation of a deadlock because of the dynamic state that deadlocks in runtime. Deadlocks can be represented in WFGs (Wait For Graphs) [5]. WFG is usually represented by N for nodes and L for edges below is an example of an edge.
In the example above, P1 is a process that is blocked from accessing resource x that is currently being used by process P2. The arrow does not mean that P1 is communicating P2, what P1 is doing is communicating with the resource control of X. The deadlock occurs when there is a cycle in the WFG. Below is an example of three processes P1 to P2 to P3 to P1.
Resource allocation graphs are used in understanding more about Deadlocks. The resource allocation graphs have the following properties. Resource categories which are numbered {R1.RN} they are usually drawn as square nodes. Processes are represented by the letter P. Requests or request edges are usually a represented by arrows from a process P to a resource R. This indicates that the Process P has requested resource R. There are also assignment Edges, this is arrows that indicate a particular resource R is allocated to a specific process R. Figure 5.0 Below is an example [2].
If the resource allocation graph has no cycles, then the graph is not deadlocked. In figure 5.0 above, there are no cycles which means that the system has no deadlocks. If a graph contains cycles, then the system has deadlocks. Figure 5.1 below elaborates [2].
6.0 DDS TOOLS
Two primary tools are used in DDS. These are static analysis tool and runtime monitoring.
6.1 Static Analysis
This is the examination of source codes after they have been applied which is done using several methods for example data flow analysis. Static analysis is essential as it can uncover issues like buffering and memory leaks. It works by examining a source file and creating a copy of it for further investigation.
6.2 Runtime Monitoring
This method is also referred to as dynamic analysis. Runtime monitoring is an analysis of a program when it is running. Just like static analysis Runtime monitoring uses different techniques to extract data during compilation. Runtime monitoring is used to identify paths taken during execution of a program. This is important as paths that are not taken by programs may have bugs.
7.0 DEADLOCK HANDLING
Three main approaches are used to handle deadlocks, more so in a distributed system. These three approaches are Deadlock avoidance, prevention, and detection.
7.1 Deadlock prevention
Deadlock can easily be prevented if the processes begin execution after gathering all the resources that they require. By doing so, all the processes can be sure when the start executing they are in control of all the resources. Deadlock prevention has its weaknesses, such as doing away with concurrency [3]. For example, If there is a resource that has to be used by all the processes and there is a single process holding on to it, it will eventually cause a deadlock. Deadlock prevention approach causes deadlocks when acquiring resources.
7.2 Deadlock Avoidance
Deadlock avoidance handling is one of the most preferred deadlock approaches, deadlock avoidance grantees a given process to a given resource. The main problem with this approach is that it has to maintain a big table that determines whether a given process should be guaranteed a resource. The second problem with this approach is that there can be only one processor resource controller that makes all the decisions [1].
7.3 Deadlock Detection
In this approach, there is no predefined method on how a process can acquire locks to resources [3]. Deadlock detection approach uses a set of computations and algorithms to detect deadlocks. The detection algorithms run concurrently with the computations. Deadlock detection has three type’s central, distributed and hierarchical deadlock detection [3].
7.3.1 Centralized Deadlock Detection
In this type of deadlock detection, a control site constructs a WFG diagram of the system [1]. This control site finds cycles and resolves them, this type of detection is straightforward to implement. However, this approach has its drawbacks if the central site fails the entire site fails. This is because the approach has many sites and they all have to communicate with the central site. The central site handles all the message traffics and if overloaded it will affect the performance.
7.3.2 Distributed Deadlock Detection
In the distributed deadlock detection the processes are responsible for detecting deadlocks in the system [1]. They use the messages from the control to detect deadlocks. This approach has many advantages because it enjoys the concurrency that comes with algorithms. The main drawback of this approach is that it is not as efficient as the centralized approach because no process can draw a clear image of the WFG to deal with deadlocks. Another drawback is that processes have to run deadlock detection as concurrently with algorithms as well as computations.
7.3.3 Hierarchical Deadlock Detection
In this approach, sites are arranged in clusters and a hierarchy fashion [5]. The sites detect deadlocks that appear on descendant sites. The main advantage of this approach is that the sites are never overloaded, and there is no specific point of failure. The primary challenge of the hierarchical deadlock detection hierarchically organizing the clusters so that deadlocks are not localized.
8.0 False Deadlocks
Deadlock in a distributed system are problems that cannot be quickly resolved. There several algorithms available that deal with deadlocks and they all claim that they can detect deadlocks, but they are all vulnerable to false deadlocks. False deadlocks are the type of deadlocks that can only be detected by algorithms, but the system cannot detect them. These types of deadlocks are usually referred to as static problems. If reduced by deadlock resolution the problem changes and becomes dynamic. A good example is when two algorithms of fixing deadlocks run concurrently are initiated if the both detect that there is a cycle in the system and one algorithm managers to break the cycle the other algorithm will still think that there is a cycle and this is where false deadlocks come in [3].
9.0 Performance
It is believed that the performance analysis of algorithms does not get much attention from the authors [3]. Most algorithm performances are measured by the number of messages that they exchange, but they do not reflect the actual performance. Deadlock persistence time should be used to measure the performance of an algorithm. Despite communication overheads and persistence time there are other methods of measuring the performance of algorithms. These measures include the time complexity of the algorithms running in the processes, space requirements in the processes. Several factors affect the performance of an algorithm, for example, the request and the resource release pattern of a system and how processes are arranged in the system. How these factors affect the working of an algorithm are still an area of study and interest among computer engenders.
10.0 Conclusion
DDS is a controller that monitors programs during executions, and it detects deadlocks that are as a result of cycles. After detecting deadlocks, DDS uses primitive methods to remove the deadlocks. Deadlock involves both static properties and dynamic properties. This paper has critically analyzed deadlocks, the different types of deadlocks and how they can be handled in distributed systems. Deadlocks can be handled in three ways of prevention, avoidance and deadlock detection. It is practically impossible to avoid deadlocks or to prevent them. However, there are overheads put in place to avoid deadlocks, but they are too large and complex to be implemented in a system. Deadlock detection has been an area of great interest for nearly two decades now. There are three ways of conducting deadlock detection, which includes a centralized control site, hierarchical deadlock detection, and distributed processes. There two types of algorithms that deal with deadlocks as discussed in the paper. The first algorithm solves the deadlocks by constructing a WFG, and then it searches for cycles in the system. The design of algorithms that can prevent deadlocks is hard to find this is because there is not a globally shared memory [1]. If there were no deadlocks, the speed of systems would be undeliverable, and the computers could have the potential to do wonders.
References
[1] Feijen, W. H. J., & Gasteren, A. J. M. (2014). On a method of multiprogramming. New York: Springer.
[2] Ghosh, S. (2014). Distributed systems: an algorithmic approach. Chapman and Hall/CRC. New York: Springer.
[3] In Mishra (2018). Information and communication technology for sustainable development: Proceedings of ICT4SD 2016. Singapore: Springer.
[4] Street N. (2018). Deadlock Detection in Distributed Systems Using the IMDS Formalism and Petri Nets. New York: Springer.
[5] Wang, Y., & Lu, P. (2014). DDS: A deadlock detection-based scheduling algorithm for workflow computations in HPC systems with storage constraints. Parallel Computing, 39 (8), 291-305.