title: Methodologies and frameworks to ensure lack of deadlocks
body: <p>Although this applies to any multithreaded environment here I am only asking about Java. And only about pure Java, deadlocks caused by external devices accessed from Java, like database deadlocks, are not the topic of this.<br>
  What methodologies and supporting frameworks are there that, when properly used, give a guarantee that your code is deadlock free?</p>
  
  <p>The ones I am aware of are :</p>
  
  <ul>
  <li><strong>No multithreading.</strong> Which is the solution used by many GUI frameworks.</li>
  <li><strong>Single global lock.</strong> Not a good solution since efficiency suffers.</li>
  <li><strong>Accessing locks in a fixed order.</strong> I know of no framework to support this.</li>
  </ul>
  
  <p>Static analysis is helpful since it can detect many cases of potential deadlocks but gives no guarantees.</p>