×

Deadlock Detection and Recovery

Deadlock Detection and Recovery

In deadlock detection and recovery, to avoid or prevent a deadlock, the operating system uses various methods. For checking deadlock, an operating system continuously monitors the system. Then also, if a deadlock occurs in the system, it applies the techniques to remove the deadlock.

In deadlock detection and recovery, the major task performed by the operating system is to detect the deadlock. By using a resource allocation graph, the operating system can easily detect the deadlock.

In single instance resource type, to detect deadlock in the system, we check whether any cycle is formed in the system or not. If there is a cycle created in the system, then it means deadlock has occurred in the system, and if there is no cycle, then the system is free from deadlock.

In multiple instance, resource types also, we check the cycle is formed or not in the system, but that’s not enough to detect the deadlock. We also need to use some safety algorithm on the system so that we can convert the resource allocation graph into the request and the allocation matrix.

In an operating system, to recover deadlock, the operating system examines either resources or processes.

For Resources

Preempt the Resource: - In this, we take the resource from one process to the process that needs it to finish its execution, and after the execution is completed, the process soon releases the resource. In this, the resource selection is difficult, and the snatching of the resource is also difficult.

Rollback to a safe State: - To enter into the deadlock, the system goes through several states. In this, the operating system can easily roll back the system to the earlier safe state. To do so, we require to implement checkpoints at every state. At the time when we detect deadlock, then we need to rollback every allocation so that we can enter into the earlier safe state.

For Process                                   

Kill a Process: - In this, we kill the process due to which deadlock occurred. But the selection of the process to kill is a tough task. In this, the operating system mainly kills that process, which does not work more till now.

Kill all Process: - Kill all the processes is not a suitable approach. We can use this approach when the problem becomes critical. By killing all the processes, the system efficiency will be decreased, and we have to execute all the processes further from the start.


Related Topics

Deadlock Prevention in Operating System

Deadlock Prevention The conditions which we used for deadlock prevention are: Mutual ExclusionHold and WaitNo PreemptionCircular Wait 1. Mutual Exclusion: - From the resource point of view, the mutual exclusion means that simultaneously more...

4 minutes read.

File in Operating System

What is File in Operating System?  A file is defined as a collection of the interrelated information that is stored in the secondary memory or the non-volatile memory such as optical...

4 minutes read.

Process Synchronization | Operating System

Process Synchronization Process Synchronization means managing the process in such a manner so that no two processes have access to share similar data and resources. We can use Process Synchronization in a Multi-Process System...

4 minutes read.

Linux Operating System

What is Linux? The Linux operating system is used on various devices, including cellphones, automobiles, supercomputers, household gadgets, personal computers, and business servers. You can find Linux on your phones, thermostats, vehicles,...

8 minutes read.

Ubuntu Operating System

Ubuntu Operating System Ubuntu is an open-source and a Linux based operating system. Ubuntu is developed for the Network Servers, Computers, and Smartphones. The Ubuntu operating system was developed by Canonical...

3 minutes read.

Distributed Shared Memory

Distributed Shared Memory is a process of managing memory over more than one node and makes inter-process communication which transfers to end users. It is a mechanism that allows user...

2 minutes read.

Need of Operating System

There are various needs of operating system: Managing Input-Output UnitThe Operating system as a platform for application programsMultitaskingConsistent user interface Managing Input-Output Unit: - With the help of the operating system, the...

2 minutes read.

What is Scheduling on OS

Scheduling is the process which is used to share the computing resources such as memory, processor time, and bandwidth to the different processes, data flows, threads, and applications which need them. Scheduling is...

5 minutes read.

Deadlock Avoidance

Deadlock Avoidance In an operating system, for deadlock avoidance, we perform the following: We only grant the request of the resources if the resulting state of the system will not cause any deadlock in the...

3 minutes read.

Test Set Lock Mechanism | Operating System

Modification in the Assembly Code The problem in the lock variable is that, in some cases, the process reads the previous or old value of the lock variable and enters into the critical...

4 minutes read.

Difference between Seek Time and Disk Access Time in Disk Scheduling

Seek Time The time taken for the hard disk controller to detect a specific piece of recorded data is known as the seek time. The amount of time it takes to...

4 minutes read.

Directory Structure in Operating System

Directory Structure in Operating System What is a Directory A Directory is the collection of the correlated files on the disk. In simple words, a directory is like a container which contains...

8 minutes read.

Operating System Services

The Operating System provides various types of services:   I/O operationProgram executionFile system manipulationCommunicationError HandlingResource allocationAccountingProtection 1. I/O Operation: - To execute a program, needs I/O, which consists of a file, or I/O device. Due to the protection...

3 minutes read.

What is Deadlock in OS?

Deadlock in Operating System In an Operating System, a process uses various resources, and the resources are used in the following manner: Request the ResourceUse the ResourceRelease the Resource In the Operating System, Deadlock is a condition...

4 minutes read.

Bit Vector in Operating System

What is Bit vector? Bit vector is one of the most important methods used in the free space management of operating system. Free space management which is used by the operating...

3 minutes read.

N-Step-SCAN Disk Scheduling

Before you study about N-Step-SCAN Disk Scheduling, it requires prerequisite of what is Disk Scheduling Algorithms: Operating systems use disc scheduling to schedule I/O requests that arrive at the disc....

4 minutes read.

What is Demand Paging?

Demand Paging is defined as a process in which the pages are loaded into the memory (when the page fault occurs) or on-demand. It consists of the following steps: If there is...

4 minutes read.

Banker’s Algorithm in Operating System

What is Banker’s Algorithm? Bankers algorithm is an algorithm which is used for deadlock avoidance and resource allocation. It was established by Edsger Dijkstra. The reason behind the name ‘banker’s algorithm’...

8 minutes read.

Semaphore in Operating System

What is Semaphore in Operating System Semaphore is defined as an integer variable which is used to solve the problem of the critical section in process synchronization. In semaphore, we use...

3 minutes read.

Round-Robin Scheduling Algorithm in OS

Round-Robin is a Preemptive Scheduling Algorithm and is the most commonly used algorithm in CPU Scheduling.In this, each Process is assigned with a fix time interval to execute, which is...

5 minutes read.