After Detecting the Deadlock, we must have to Apply Some Conditions for Removing a Deadlock. After Examining the Four Conditions which Occurs deadlock. Means Detect how and why a deadlock has occurred. Avoidance and Prevention means handle the Deadlock or Remove the Deadlock. Or Make a Program to handle the Deadlock. Various Ways for handing a deadlock.
1) Hold & Wait: -The Process those are using the System Resources, after using the Resources after Completion the Process, we can force them to Release the Resources. Means Process those are on Waiting Stage, will be not able to use the System Resources. Means the System Resources are Available to only that Process; those are running on the System.
If a Process on the Wait State means if he is waiting for Some Input and Output or For CPU to Execute the Process. Then System Resources are not available to Process. All the System Resources are Allocated to the Various Process by using Some Priority or System Resources are Allocated to different Process according to Some Time Cards.
2) Remove pre-claim: pre-claim means Some Processes Consumes System Resources are Consumed in advance for their Processing. Means currently at this Time they are on the Waiting stage or they are Running some Process. But they allocate the System Resources in advance Manner. So this will also Create Problem for the other Process. So avoid pre-claiming. Means all the System Resources are not available in advance means all the processes will Allocate Resources when they are Executed by the CPU.
3) Maintain Available Resources: There must be a Table which contains all the Entries of the System Resources those are allocated to the various Processes. In this Table we can got the information, that which Resources is Currently using by which Process. And the Table must be Updated means if after performing the Operation, if a System Resource if free, then the table must contains the Entry for that Resource State.
There must be a Resource Request and Release Request means when a Process is Requesting for a System Resource. Then table must contain the information, which Process is Requesting and the Total Time which a Process will use the System Resource.
The Resource Release is used when the Process completed his Work. So that all the Requests and Releasing of System Resources then the table must be updated after Some Time.