How to prevent Dead Lock?

Using synchronization mechanism.
For Deadlock avoidance use Simplest algorithm where each process tells max number of resources it will ever need. As process runs, it requests resources but never exceeds max number of resources. System schedules processes and allocates resoures in a way that ensures that no deadlock results.

Showing Answers 1 - 3 of 3 Answers

sri

  • Jan 21st, 2006
 

dead lock occurs due to synchronization mechanism so to prevent dead lock we need to violate one of the following conditions:

1.mutual exclusion

2.no preemption

3.circular wait

4.hold and wait

  Was this answer useful?  Yes

svsathya

  • Mar 31st, 2007
 

Because threads can become blocked and because objects can have synchronized methods that prevent threads from accessing that object until the synchronization lock is released, it's possible for one thread to get stuck waiting for another thread, which in turn waits for another thread, etc., until the chain leads back to a thread waiting on the first one. You get a continuous loop of threads waiting on each other, and no one can move. This is called deadlock

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions