Answers were Sorted based on User's Feedback
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
|Is This Answer Correct ?||79 Yes||7 No|
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..
3)Hold and wait
and the sufficient condition for deadlock to occur is
so to occur a deadlock all 4 conditions must be happened at
a time..either of the case is not present..deadlock will not
if we can avoid any one of the condition we can avoid deadlock..
and as mentioned in above answer..one can avoid deadlock as
|Is This Answer Correct ?||22 Yes||3 No|
Answer / muthu
situation in which no operarions can be done further
|Is This Answer Correct ?||16 Yes||11 No|
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
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
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
This may however be even more conservative than deadlock
Attacking Mutex condition
never grant exclusive access. but this may not be possible
for several resources.
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.
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 is one where
It is not a deadlocked state
There is some sequence by which all requests can be
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|
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|
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|
Answer / chunduru.devianusha
progress is not possible further
|Is This Answer Correct ?||1 Yes||3 No|
Answer / swe
|Is This Answer Correct ?||9 Yes||14 No|
Give an example of microkernel.
Describe different job scheduling in operating systems.
what are the rules u follow when u r writing critical section of code?
what is the need of creating 4GB of pages in linux?
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
What is a mission critical system ?
What is a Real-Time System ?
When would you choose bottom up methodology?
What is the difference between Hard and Soft real-time systems ?
Write a small dc shell script to find number of FF in the design
What is the difference b/n any GPOS and RTOS?Give suitable examples or characteristic of RTOS to support your answer. What changes can be done in a GPOS to make it work like a RTOS? What basic features will you support, if you have to design a RTOS?
What is priority inversion ? and What is the solution ?