GeekInterview.com
Series: Subject: Topic:
Question: 41 of 46

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.
Asked by: Interview Candidate | Asked on: Dec 18th, 2003
Showing Answers 1 - 2 of 2 Answers
sri

Answered On : 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

  
Login to rate this answer.
svsathya

Answered On : 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

  
Login to rate this answer.

Give your answer:

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

Related Open Questions

Ads

Connect

twitter fb Linkedin GPlus RSS

Ads

Interview Question

 Ask Interview Question?

 

Latest Questions

Interview & Career Tips

Get invaluable Interview and Career Tips delivered directly to your inbox. Get your news alert set up today, Once you confirm your Email subscription, you will be able to download Job Inteview Questions Ebook . Please contact me if you there is any issue with the download.