DEADLOCK

Jan 21 • General • 4769 Views • 19 Comments on DEADLOCK

Q1:what is dead lock?
ans:
In simple words
A deadlock is a situation in which two or more competing actions are each waiting for the other to finish, and thus neither ever does.

Q2. Give any example of dead lock.
ans.
ex.1
When two trains approach each other at a crossing, both shall come to a full stop and neither shall start up again until the other has gone.
ex2.
In a computer Suppose a computer has three CD drives and three processes. Each of the three processes holds one of the drives. If each process now requests another drive, the three processes will be in a deadlock. Each process will be waiting for the “CD drive released” event, which can be only caused by one of the other waiting processes. Thus, it results in a circular chain.

Q3. Conditions for the dead lock??
ans.
Mutual exclusion – Each resource is either currently allocated to exactly one process or it is available. (Two processes cannot simultaneously control the same resource or be in their critical section).
Hold and Wait – processes currently holding resources can request new resources
No preemption – Once a process holds a resource, it cannot be taken away by another process or the kernel.
Circular wait – Each process is waiting to obtain a resource which is held by another process.

Q4 .Can we say that the deadlock is trafficked jam situation??
ans.
Indeed we can.

Q5. What is deadlock avoidence??
ans.
Deadlock can be avoided if certain information about processes are available to the operating system before allocation of resources, such as which resources a process will consume in its lifetime. For every resource request, the system sees whether granting the request will mean that the system will enter an unsafe state, meaning a state that could result in deadlock. The system then only grants requests that will lead to safe states. In order for the system to be able to determine whether the next state will be safe or unsafe, it must know in advance at any time:

resources currently available
resources currently allocated to each process
resources that will be required and released by these processes in the future
It is possible for a process to be in an unsafe state but for this not to result in a deadlock. The notion of safe/unsafe states only refers to the ability of the system to enter a deadlock state or not. For example, if a process requests A which would result in an unsafe state, but releases B which would prevent circular wait, then the state is unsafe but the system is not in deadlock.

Q6.How to handle dead lock?
ans.
There are methods for that
1. Ignoring deadlock
2.Detection
3.Prevention
4.Avoidance.

Q7.How to break the deadlock situation?
ans.
1. Process termination
2. process pre-emptetetion

Q8.What is distributed dead lock?
ans.
Distributed deadlocks can occur in distributed systems when distributed transactions or concurrency control is being used. Distributed deadlocks can be detected either by constructing a global wait-for graph from local wait-for graphs at a deadlock detector or by a distributed algorithm like edge chasing.

Q9.What is live deadlock?
ans.
A livelock is similar to a deadlock, except that the states of the processes involved in the livelock constantly change with regard to one another, none progressing. This term was defined formally at some time during the 1970s ‒ an early sighting in the published literature is in Babich’s 1979 article on program correctness. Livelock is a special case of resource starvation; the general definition only states that a specific process is not progressing.

Q10.Give any real time example of deadlock.
ans.
A situation when brother are fighting for playing video game

One brother has remote control for playing and other has game cd or whatever we call

Now only one person can play but both are not ready to cooperate and hence it results in deadlock, no one can play now, same is with operating system.

.

Tell us Your Queries, Suggestions and Feedback

Your email address will not be published.

« »