<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Java Volatile is Powerful</title>
	<atom:link href="http://blog.webscale.co.in/?feed=rss2&#038;p=19" rel="self" type="application/rss+xml" />
	<link>http://blog.webscale.co.in/?p=19</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Sun, 27 Jun 2010 15:52:43 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: concurrent threads</title>
		<link>http://blog.webscale.co.in/?p=19&#038;cpage=1#comment-48</link>
		<dc:creator>concurrent threads</dc:creator>
		<pubDate>Thu, 01 Apr 2010 21:47:03 +0000</pubDate>
		<guid isPermaLink="false">http://pitfalls.wordpress.com/?p=19#comment-48</guid>
		<description>[...] were used in multiple concurrent threads. Some things to note about this approach are: The ...Java Volatile is PowerfulC.) Ordering : It determines when actions of one Thread seem to happen out of order to other [...]</description>
		<content:encoded><![CDATA[<p>[...] were used in multiple concurrent threads. Some things to note about this approach are: The &#8230;Java Volatile is PowerfulC.) Ordering : It determines when actions of one Thread seem to happen out of order to other [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Coffey</title>
		<link>http://blog.webscale.co.in/?p=19&#038;cpage=1#comment-46</link>
		<dc:creator>Neil Coffey</dc:creator>
		<pubDate>Wed, 03 Sep 2008 08:22:14 +0000</pubDate>
		<guid isPermaLink="false">http://pitfalls.wordpress.com/?p=19#comment-46</guid>
		<description>Agree with the poster who said that volatile is poorly understood, though I think this is partly because the JMM &lt;i&gt;per se&lt;/i&gt; is poorly understood (and that in turn because it is badly explained in the JLS).

In the tests above, it would also be interesting to measure overall &lt;i&gt;throughput&lt;/i&gt;, and to look at how this &lt;strong&gt;changes with concurrency&lt;/strong&gt; (number of accessing threads). Also, unless I missed it, you don&#039;t mention what &lt;em&gt;platform&lt;/em&gt; you&#039;re running the tests on. The relative speed of processor instructions (and hence of the different locking mechanisms) almost certainly varies.

In case you&#039;re interested, I&#039;ve actually published some related test results looking e.g. at the performance of &lt;a href=&quot;http://www.javamex.com/tutorials/synchronization_concurrency_8_hashmap.shtml&quot; rel=&quot;nofollow&quot;&gt;ConcurrentHashMap&lt;/a&gt;,
some timings of &lt;a href=&quot;http://www.javamex.com/tutorials/synchronization_concurrency_8_copy_on_write.shtml&quot; rel=&quot;nofollow&quot;&gt;comparing locking mechanisms&lt;/a&gt; for concurrent array access,
plus some other information on &lt;a href=&quot;http://www.javamex.com/tutorials/synchronization_volatile.shtml&quot; rel=&quot;nofollow&quot;&gt;volatile&lt;/a&gt; and synchronization that readers may find interesting.</description>
		<content:encoded><![CDATA[<p>Agree with the poster who said that volatile is poorly understood, though I think this is partly because the JMM <i>per se</i> is poorly understood (and that in turn because it is badly explained in the JLS).</p>
<p>In the tests above, it would also be interesting to measure overall <i>throughput</i>, and to look at how this <strong>changes with concurrency</strong> (number of accessing threads). Also, unless I missed it, you don&#8217;t mention what <em>platform</em> you&#8217;re running the tests on. The relative speed of processor instructions (and hence of the different locking mechanisms) almost certainly varies.</p>
<p>In case you&#8217;re interested, I&#8217;ve actually published some related test results looking e.g. at the performance of <a href="http://www.javamex.com/tutorials/synchronization_concurrency_8_hashmap.shtml" rel="nofollow">ConcurrentHashMap</a>,<br />
some timings of <a href="http://www.javamex.com/tutorials/synchronization_concurrency_8_copy_on_write.shtml" rel="nofollow">comparing locking mechanisms</a> for concurrent array access,<br />
plus some other information on <a href="http://www.javamex.com/tutorials/synchronization_volatile.shtml" rel="nofollow">volatile</a> and synchronization that readers may find interesting.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: roScripts &#45; Webmaster resources and websites</title>
		<link>http://blog.webscale.co.in/?p=19&#038;cpage=1#comment-45</link>
		<dc:creator>roScripts &#45; Webmaster resources and websites</dc:creator>
		<pubDate>Wed, 28 May 2008 23:15:06 +0000</pubDate>
		<guid isPermaLink="false">http://pitfalls.wordpress.com/?p=19#comment-45</guid>
		<description>&lt;strong&gt;Java Volatile is Powerful &#xAB; Pit Falls in Java Development...&lt;/strong&gt;

Java Volatile is Powerful &#xAB; Pit Falls in Java Development...</description>
		<content:encoded><![CDATA[<p><strong>Java Volatile is Powerful &#xAB; Pit Falls in Java Development&#8230;</strong></p>
<p>Java Volatile is Powerful &#xAB; Pit Falls in Java Development&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ben</title>
		<link>http://blog.webscale.co.in/?p=19&#038;cpage=1#comment-44</link>
		<dc:creator>Ben</dc:creator>
		<pubDate>Wed, 28 May 2008 11:14:26 +0000</pubDate>
		<guid isPermaLink="false">http://pitfalls.wordpress.com/?p=19#comment-44</guid>
		<description>The problem with volatile is that it wasn&#039;t well defined until the JMM and, since so few developers seem to understand proper locking as is, I tend to avoid it.  Instead I use the Atomic* implementations, even for a simple boolean flag, where a volatile would work just as well.  An atomic is more obvious, better documented, and has nearly the same performance characteristics.

I think its good to inform people of the tricks, but best to advise them to use the library implementations instead.  Otherwise, you&#039;ll find more people implement counters using volatile and other such incorrect abuses because they only half understood your post.</description>
		<content:encoded><![CDATA[<p>The problem with volatile is that it wasn&#8217;t well defined until the JMM and, since so few developers seem to understand proper locking as is, I tend to avoid it.  Instead I use the Atomic* implementations, even for a simple boolean flag, where a volatile would work just as well.  An atomic is more obvious, better documented, and has nearly the same performance characteristics.</p>
<p>I think its good to inform people of the tricks, but best to advise them to use the library implementations instead.  Otherwise, you&#8217;ll find more people implement counters using volatile and other such incorrect abuses because they only half understood your post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pavitar</title>
		<link>http://blog.webscale.co.in/?p=19&#038;cpage=1#comment-43</link>
		<dc:creator>pavitar</dc:creator>
		<pubDate>Tue, 27 May 2008 06:51:10 +0000</pubDate>
		<guid isPermaLink="false">http://pitfalls.wordpress.com/?p=19#comment-43</guid>
		<description>Hi Peter,

I havent used term piggybacking explicitly but i have tried to explain the same concept. As when volatile write will happen it will execute a memory flush and all writes on other variables before volatile write will also get flushed. And due to ordering guarantees on volatile these other variable (non-volatile) writes wont jump over this volatile write. So thats nothing but piggybacking synchronization as explained by Brian in JCIP.</description>
		<content:encoded><![CDATA[<p>Hi Peter,</p>
<p>I havent used term piggybacking explicitly but i have tried to explain the same concept. As when volatile write will happen it will execute a memory flush and all writes on other variables before volatile write will also get flushed. And due to ordering guarantees on volatile these other variable (non-volatile) writes wont jump over this volatile write. So thats nothing but piggybacking synchronization as explained by Brian in JCIP.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: pveentjer</title>
		<link>http://blog.webscale.co.in/?p=19&#038;cpage=1#comment-42</link>
		<dc:creator>pveentjer</dc:creator>
		<pubDate>Tue, 27 May 2008 04:19:27 +0000</pubDate>
		<guid isPermaLink="false">http://pitfalls.wordpress.com/?p=19#comment-42</guid>
		<description>You are forgettin one of the most powerful features of volatile: piggybacking on synchronization. It makes it possible to share objects with visibility problems in a threadsafe manner. Check the JMM topic in &quot;Java Concurrency in Practice&quot; for more info</description>
		<content:encoded><![CDATA[<p>You are forgettin one of the most powerful features of volatile: piggybacking on synchronization. It makes it possible to share objects with visibility problems in a threadsafe manner. Check the JMM topic in &#8220;Java Concurrency in Practice&#8221; for more info</p>
]]></content:encoded>
	</item>
</channel>
</rss>
