DEADLOCK PREVENTION AND AVOIDANCE.pptx

PugalenthiSomasundar 1,090 views 9 slides Feb 09, 2023
Slide 1
Slide 1 of 9
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9

About This Presentation

deadlock prevention and avoidance


Slide Content

DEADLOCK PREVENTION AND AVOIDANCE ASSIGNMENT SERIES - 75 7376212CB137 PUGALENTHI M S

INTRODUCTION Deadlocks in computer systems refer to a situation where multiple processes are blocked because each process is waiting for another process to release a resource it needs. This creates a vicious cycle where none of the processes can continue executing. Deadlocks can occur in various types of computer systems, including operating systems, databases, and distributed systems. Deadlock prevention is the process of avoiding deadlocks in the system by designing the system in such a way that deadlocks cannot occur. This can be achieved by implementing strict ordering rules for resource allocation, ensuring that processes only request resources in a specific order. Another way to prevent deadlocks is by implementing a timeout mechanism, where a process will release its resources after a certain time if it cannot acquire all the resources it needs. Deadlock avoidance is the process of detecting potential deadlocks before they occur and taking steps to prevent them. This can be achieved by dynamically allocating resources based on the current state of the system, ensuring that the resources are always available to the processes that need them. Another way to avoid deadlocks is by implementing a resource allocation graph, where processes and resources are represented as nodes and the resource allocation relationship is represented as edges. The resource allocation graph can be used to detect potential deadlocks and take steps to prevent them.

TECHNIQUES TO AVOID DEADLOCKS 1. Deadlock Prevention 2. Deadlock Avoidance 3. Deadlock Detection and Recovery 4. Deadlock Ignorance

DEADLOCK PREVENTION Deadlock prevention involves avoiding scenarios that can lead to deadlocks. One common technique is the use of resource ordering. In this method, resources are acquired in a specific order to ensure that they are not requested simultaneously by multiple processes. Another technique is the use of time-outs, in which a process will automatically release a resource if it is not used within a specified time period.

DEADLOCK AVOIDANCE Deadlock avoidance is a proactive approach that uses algorithms to determine if a deadlock is about to occur and takes measures to prevent it. There are two main approaches to deadlock avoidance: 1. The banker's algorithm: This is a resource-allocation algorithm that ensures that a deadlock will never occur by keeping track of the resources currently being held by each process and ensuring that a new resource allocation request can be safely granted. 2. The wait-for graph: This approach involves constructing a graph that represents the relationships between processes and resources, and checking the graph for cycles to determine whether a deadlock is likely to occur. If a cycle is detected, the request for a new resource allocation is rejected, preventing the deadlock.

DEADLOCK DETECTION AND RECOVERY Deadlock detection is a reactive approach that involves periodically checking for deadlocks in the system. If a deadlock is detected, the system takes measures to resolve the deadlock. There are two main approaches to deadlock detection and recovery: 1. Resource allocation graph: This approach involves constructing a graph that represents the relationships between processes and resources, and checking the graph for cycles to determine whether a deadlock has occurred. If a cycle is detected, one of the processes involved in the deadlock is terminated to break the cycle and allow the other processes to continue. 2. Wait-for timeout: This approach involves setting a timeout on a process waiting for a resource. If the process takes too long to obtain the resource, it is terminated, breaking the deadlock.

DEADLOCK IGNORANCE Deadlock ignorance is a technique used in computer science to handle deadlocks in a multitasking operating system, where the system simply ignores the existence of deadlocks. This technique assumes that deadlocks will eventually resolve themselves, either through the release of resources by one of the processes involved or through the termination of one of the processes. The main advantage of deadlock ignorance is that it is the simplest approach to handling deadlocks, as it requires no additional code or algorithms to detect or recover from deadlocks. However, it also has several disadvantages, such as reduced system performance and the possibility of a process remaining deadlocked indefinitely.

CONCLUSION In conclusion, deadlocks are a common problem in multitasking operating systems, and various techniques have been developed to handle them. Deadlock prevention involves avoiding situations that could lead to a deadlock, deadlock avoidance involves checking for potential conflicts before allocating resources, deadlock detection and recovery involves periodically checking for deadlocks and recovering from them by aborting one of the processes involved, and deadlock ignorance involves simply ignoring the existence of Deadlocks. Each of these techniques has its own advantages and disadvantages, and the best approach depends on the specific requirements of the system.

THANK YOU!!