Java Deadlock

How to avoid deadlock in Java?

Questions by jimmy514in   answers by jimmy514in

Showing Answers 1 - 0 of 0 Answers

A deadlock occurs when one thread has the control for A and tries to get the control for B while another thread has the control for B and tries to get the control for A. Each will wait forever for the other and hence give up a lock. One trick is to always access resources in the same order. If thread 1 tries to get A then B and thread 2 tries to get A then B theyll eventually get what they need and complete. This solution might help in small subsystems.

  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