Many Java programmers are familiar with the double-checked locking idiom, which allows you to perform lazy initialization with reduced synchronization overhead. Though many Java books and articles recommend double-checked locking, unfortuna...More
Many Java programmers are familiar with the double-checked locking idiom, which allows you to perform lazy initialization with reduced synchronization overhead. Though many Java books and articles recommend double-checked locking, unfortunately, it is not guaranteed to work. In this article I explore some of the issues underlying that odd discovery and dive into the murky waters of the Java Memory Model. (2,400 words)
Details on the reasons - some very subtle - why double-checked locking cannot be relied upon to be safe. Signed by a number of experts, including Sun engineers.
www.cs.umd.edu/~pugh/java/memoryModel/DoubleCheckedLocking.html
-
Get Site Info
JSR 133, which has been active for nearly three years, has recently issued its public recommendation on what to do about the Java Memory Model (JMM). Several serious flaws were found in the original JMM, resulting in some surprisingly diffi...
www.ibm.com/developerworks/library/j-jtp02244.html
-
Get Site Info