Anonymous

What Is Deadlock Prevention?

3

3 Answers

Anonymous Profile
Anonymous answered
Deadlock prevention means that what things (steps) we need to do to avoid deadlock condition. There are four conditions which causes a deadlock. If we handle these situations or if we get solution to resolve all these conditions (Mutual Exclusion, Hold and Wait, No Preemption, Circular Wait) then we can prevent the occurrence of a deadlock.
* Mutual Exclusion: This condition occurs when multiple processes tries to access a non sharable resource.

For example only one user can use a printer at a time and if more than one user will try access it then deadlock may occur. But on the other hand if many users are accessing a read-only file at a time, then they can access it without generating deadlock condition because read-only file is a sharable resource.

* Hold and Wait: We can avoid this condition by using a suitable method. As if we make it possible that a process cannot access two resources at a time then we can avoid this condition.
* No Preemption: A resource will not be immediately available to a process if that process already hold a resource.
Similarly we can check whether a resource is available and if it is available then we can allocate it to that process.

* Circular Wait: We can use a method to avoid this condition. In this method, we assign a number to resources as well as processes. For example, if there are ten processes in waiting queue which want to hold resource number 7 then the process with the integer number 1 can use that because it was the first process that wanted to access resource number 7 and was entered in queue.
Anonymous Profile
Anonymous answered
Deadlock prevention method of system gaurantees that deadlock will be never generated in your system.because in this situation we a system in such a way that one the four condition of deadlock generating gaurantees satisfy which may be mutual exclusion or may be hold & wait or may be circular wait or may be no preemption.thus we can prevent our system from deadlock problem in advance by build our system in such a way that deadlock will never occur in our system forever  before deadlock occurs.deadlock is nothing but a problem like traffic jam in case of concurrent processing,where 2 concurrent competing processes waits for single shared resource at same time to getting access of resource but no one process get it,& no one can finish it's work,this critical situation is called deadlock.
shahid tauqeer Profile
shahid tauqeer answered
Deadlock prevention methods guarantee that deadlocks cannot occur in the first place. Thus the transactions manager checks a transaction when it is first initiated and does not permit it to precede it may cause a deadlock. To perform this check, it is require that all of the data items that will be accessed, by a transaction be predeclared. The transactions manager then permits a transactions be predeclared. The transaction manager then permits a transaction to proceed if all the data items that it will access are available. Otherwise, the transaction is not permitted to proceed. The transaction manager reserves all the data items that are predeclared by a transaction that it allows proceeding.

Unfortunately such systems are not very suitable for database environments. The fundamental problem is that it is usually difficult to know precisely which data items will be accessed by a transaction. Access to certain data item may depend upon condition that may not be resolved until run time. To be safe system needs to be chose maximum sets of times. Even if they end up not being accessed this would certainly reduced concurrency. Furthermore there is additional overhead in evaluating whether a transaction can proceed safely. On the other hand such systems do not require run-time support.

Answer Question

Anonymous