Question

give the difinition of deadlock prevention and deadlock avoidance. describe the similarity and different of them.

give the difinition of deadlock prevention and deadlock avoidance. describe the similarity and different of them.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Definitions and similarities :

Deadlock Prevention

We can prevent Deadlock by eliminating any of the above four conditions.

They are :

Eliminate Mutual Exclusion
It is not possible to dis-satisfy the mutual exclusion because some resources, such as the tap drive and printer, are inherently non-shareable.

Eliminate Hold and wait

  1. Allocate all required resources to the process before the start of its execution, this way hold and wait condition is eliminated but it will lead to low device utilization. for example, if a process requires printer at a later time and we have allocated printer before the start of its execution printer will remain blocked till it has completed its execution.
  2. The process will make a new request for resources after releasing the current set of resources. This solution may lead to starvation.

Eliminate No Preemption
Preempt resources from the process when resources required by other high priority processes.

Eliminate Circular Wait
Each resource will be assigned with a numerical number. A process can request the resources only in increasing order of numbering.

Deadlock avoidance

In deadlock avoidance, the request for any resource will be granted if the resulting state of the system doesn't cause deadlock in the system. The state of the system will continuously be checked for safe and unsafe states.

In order to avoid deadlocks, the process must tell OS, the maximum number of resources a process can request to complete its execution.

The simplest and most useful approach states that the process should declare the maximum number of resources of each type it may ever need. The Deadlock avoidance algorithm examines the resource allocations so that there can never be a circular wait condition.

DIFFERENCES:

Prevention:

• The goal is to ensure that at least one of the necessary conditions for deadlock can never hold.

• Deadlock prevention is often impossible to implement.

• The system doesnot require additional apriori information regarding the overall potential use of each resource for each process.

• In order for the system to prevent the deadlock condition it does not need to know all the details of all resources in existence, available and requested.

• Deadlock prevention techniques include non-blocking synchronization algorithms, serializing tokens, Dijkstras algorithm etc.

• Resource allocation strategy for deadlock prevention is conservative, it under commits the resources.

• All resources are requested at once.

• In some cases preempts more than often necessary.

Avoidance:

• The goal for deadlock avoidance is to the system must not enter an unsafe state.

• Deadlock avoidance is often impossible to implement.

• The system requires additional apriori information regarding the overall potential use of each resource for each process.

• In order for the system to be able to figure out whether the next state will be safe or unsafe, it must know in advance at any time the number and type of all resources in existence, available, and requested.

• Deadlock avoidance techniques include Banker’s algorithm, Wait/Die, Wound/Wait etc.

• Resource allocation strategy for deadlock avoidance selects midway between that of detection and prevention.

• Needs to be manipulated until atleast one safe path is found.

• There is no preemption.

Add a comment
Know the answer?
Add Answer to:
give the difinition of deadlock prevention and deadlock avoidance. describe the similarity and different of them.
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT