How do you ensure that n threads can access n resources without deadlock?



How do you ensure that n threads can access n resources without deadlock?..

Answer / Vakeel Chand

To avoid deadlock in multi-threaded programming, follow these practices: (1) Acquire resources in the same order every time. (2) Don't hold locks on multiple resources for a long time. (3) Use synchronized blocks instead of methods whenever possible.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Core Java Interview Questions

Explain java coding standards for methods?

1 Answers  


What are types of Java applications?

14 Answers  


What is use of static in java?

1 Answers  


Can memory leak happen java?

1 Answers  


What is the name of the java compiler?

1 Answers  


Explain the difference between static and dynamic binding in java?

1 Answers  


Is void a wrapper class?

1 Answers  


Name the components that are termed to be Heavy-weight component but available in Light-weight components?

1 Answers  


How to create packages in java?

1 Answers  


What are streams?

1 Answers  


Explain the difference between getAppletInfo and getParameterInfo?

1 Answers  


Why java does not support pointers?

1 Answers  


Categories