What is external and internal problems?

What are the internal problems related to DCL (Double check locking)?

  • I have read multiple books Like Holub on Pattern, Java Concurrency in practice, Effective java. They all describe the Double check locking and also descibe why it is bad in the context of java but not the internal detailed implementation causing the problem. Alan Holub describe it a little bit saying it is bad because of Hardware memory barrier. Which i dont have a clue. What i am trying to find is the root cause if it is Hardware Memory barrier, then what is. the full detail related to this.

  • Answer:

    Double-Checked Locking was broken in Java 1.4 and earlier because the Java Memory Model only guarantees the integrity of the data when single-threaded. Here's an early article, from 2001, by Goetz, during this time period: http://www.javaworld.com/article/2074979/java-concurrency/double-checked-locking--clever--but-broken.html In Java 1.5 and above, Double-Checked Locking is fixed if the reference to the singleton is made volatile. The synchronized block is a barrier which will ensure that the singleton reference is up-to-date across all the threads.

Miguel Paraz at Quora Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.