What do you mean by deadlock?




Answers were Sorted based on User's Feedback



What do you mean by deadlock?..

Answer / guest

Deadlock is a situation in which the processes waits for
the other resource which is occupied by another process in
a loop for example take processes P1 and P2 and resources
R1 and R2
in the deadlock condition

P1 -R1 waits for R2
P2 -R2 waits for R1 so
both processes waits for the other resource to get free for
their complete operation.
In such cases - One can avoid deadlocks by following methods
1) Prevention
2) Detection
3) Avoidance
4) Recovery

Is This Answer Correct ?    79 Yes 7 No

What do you mean by deadlock?..

Answer / sravan reddy

Deadlock is a situation where the resources are not
allocated to the process because they are already used by
another process..ie../suppose P1 requests resources of P2
which is already used by P3 and so on...
this is not the only case for occurence of deadlock..
for a dead lock to occur there are 3 necessary conditions
and 1 sufficient condition..so totally 4..
the 3 necessary conditions are..
1)Mutual Exclusion
2)Non-Preemption
3)Hold and wait
and the sufficient condition for deadlock to occur is
Circular wait.
so to occur a deadlock all 4 conditions must be happened at
a time..either of the case is not present..deadlock will not
occur..
if we can avoid any one of the condition we can avoid deadlock..
and as mentioned in above answer..one can avoid deadlock as
follows..
1)prevention
2)avoidance
3)detection
4)recovery

Is This Answer Correct ?    22 Yes 3 No

What do you mean by deadlock?..

Answer / muthu

situation in which no operarions can be done further

Is This Answer Correct ?    16 Yes 11 No




What do you mean by deadlock?..

Answer / sreenath kambly n

A set of processes is deadlocked if each process in the set
is waiting for an event that only another process in the
set can cause (including itself).

Waiting for an event could be:

waiting for access to a critical section
waiting for a resource Note that it is usually a non-
preemptable (resource). pre-emptable resources can be
yanked away and given to another.
Conditions for Deadlock

Mutual exclusion: resources cannot be shared.
Hold and wait: processes request resources incrementally,
and hold on to what they've got.
No preemption: resources cannot be forcibly taken from
processes.
Circular wait: circular chain of waiting, in which each
process is waiting for a resource held by the next process
in the chain.
Strategies for dealing with Deadlock

ignore the problem altogether ie. ostrich algorithm it may
occur very infrequently, cost of detection/prevention etc
may not be worth it.
detection and recovery
avoidance by careful resource allocation
prevention by structurally negating one of the four
necessary conditions.
Deadlock Prevention

Difference from avoidance is that here, the system itself
is build in such a way that there are no deadlocks.

Make sure atleast one of the 4 deadlock conditions is never
satisfied.

This may however be even more conservative than deadlock
avoidance strategy.

Attacking Mutex condition
never grant exclusive access. but this may not be possible
for several resources.
Attacking preemption
not something you want to do.
Attacking hold and wait condition
make a process hold at the most 1 resource at a time.
make all the requests at the beginning. All or nothing
policy. If you feel, retry. eg. 2-phase locking
Attacking circular wait
Order all the resources.
Make sure that the requests are issued in the correct order
so that there are no cycles present in the resource graph.

Resources numbered 1 ... n. Resources can be requested only
in increasing order. ie. you cannot request a resource
whose no is less than any you may be holding.
Deadlock Avoidance

Avoid actions that may lead to a deadlock.

Think of it as a state machine moving from 1 state to
another as each instruction is executed.

Safe State
Safe state is one where

It is not a deadlocked state
There is some sequence by which all requests can be
satisfied.
To avoid deadlocks, we try to make only those transitions
that will take you from one safe state to another. We avoid
transitions to unsafe state (a state that is not
deadlocked, and is not safe)

Is This Answer Correct ?    6 Yes 1 No

What do you mean by deadlock?..

Answer / myls

if thread 1 is running and locks M1 resource, but before it can lock M2 resource , it is interrupted. Thread 2 starts running; it locks M2, when it tries to obtain and lock M1, it is blocked because M1 is already locked (by thread 1). Eventually thread 1 starts running again, and it tries to obtain and lock M2, but it is blocked because M2 is already locked by thread 2. Both threads are blocked; each is waiting for an event which will never occur.This kind of situation is called Dead Lock.

Is This Answer Correct ?    4 Yes 1 No

What do you mean by deadlock?..

Answer / ravi a joshi

Deadlock is a situation in which everybody in the system is
waiting for some or the other event to continue but nobody
is there to generate those events, since everybody is
waiting. In this case,

1. The CPU usage is NIL
2. System resource usage is NIL

Is This Answer Correct ?    7 Yes 5 No

What do you mean by deadlock?..

Answer / chunduru.devianusha

progress is not possible further

Is This Answer Correct ?    1 Yes 3 No

What do you mean by deadlock?..

Answer / swe

bye bye

Is This Answer Correct ?    9 Yes 14 No

Post New Answer



More RTOS AllOther Interview Questions

What is a mission critical system ?

3 Answers  


what is the need of creating 4GB of pages in linux?

1 Answers   TCS,


Explain the difference between microkernel and macro kernel.

5 Answers   Tech Mahindra, Infosys,


what are the rules u follow when u r writing critical section of code?

6 Answers   TCS,


What is the important aspect of a real-time system ?

6 Answers  






what is major concerns about any RTOS selection ?

4 Answers   Bosch,


What is priority inversion ? and What is the solution ?

6 Answers   Wipro, Qualcomm, Tandberg,


What is the state of the processor, when a process is waiting for some event to occur?

14 Answers   MTS,


what is difference between IRQ and FRQ ?

4 Answers   Bosch,


When would you choose bottom up methodology?

5 Answers   Knowx Innovations,


Write a small dc shell script to find number of FF in the design

0 Answers  


I have been working on one thread which manage and control a couple of circular buffers. It has api for other thread to access. As the thread grows bigger and bigger, I split it as 3 to 4 threads which need to share common buffers, and also their api could be used by other threads, (not these three threads). Inside api, I also allow other threads to access these three threads' common buffers(more than one buffer). SO I have to use mutex to avoid race condition . But I found mutex will be everwhere in all the threads when they update the common buffer. I am wondering whether I could reduce mutex usage(more mutex will hure my system performance). any ideas for how to reduce mutex usage meanwhile to avoid race condition. Thanks

2 Answers  






Categories