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
Related Q & A:
- What are the new problems regarding drug-eluting stents?Best solution by Yahoo! Answers
- What are some major problems in North Carolina?Best solution by Yahoo! Answers
- What are some good jobs related to science?Best solution by Yahoo! Answers
- What is the internal energy of an ideal gas at room tempature?Best solution by ChaCha
- What is my internal email server?Best solution by Yahoo! Answers
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
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.