<?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 Concurrency Bugs #3 &#8211; atomic + atomic != atomic</title>
	<atom:link href="http://tech.puredanger.com/index.php/2009/01/30/java-concurrency-bugs-atomic/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.puredanger.com/2009/01/30/java-concurrency-bugs-atomic/</link>
	<description>Alex Miller&#039;s technical blog</description>
	<lastBuildDate>Mon, 06 Feb 2012 19:39:50 -0800</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.4</generator>
	<item>
		<title>By: Alex</title>
		<link>http://tech.puredanger.com/2009/01/30/java-concurrency-bugs-atomic/comment-page-1/#comment-139150</link>
		<dc:creator>Alex</dc:creator>
		<pubDate>Sat, 31 Jan 2009 09:40:22 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/30/java-concurrency-bugs-atomic/#comment-139150</guid>
		<description>@Neil: Yep, thanks for another good point to keep in mind.

@Mario: That does sound like another good topic!  In some ways, it&#039;s the same point I&#039;m making here, although more at the data level than at the method level.  Thanks for the thought.

@Raoul: STM is one option (although that brings its own set of questions).  The model used in Clojure is the most useful implementation of it that I&#039;ve seen - you can mostly rely on functional programming and immutability but drop into mutable refs and an STM when needed.  Actor concurrency is another model getting some play lately (Erlang, Scala, etc).  And I think some of the CCR, F#, and other stuff coming out of Microsoft is really interesting as well.</description>
		<content:encoded><![CDATA[<p>@Neil: Yep, thanks for another good point to keep in mind.</p>
<p>@Mario: That does sound like another good topic!  In some ways, it&#8217;s the same point I&#8217;m making here, although more at the data level than at the method level.  Thanks for the thought.</p>
<p>@Raoul: STM is one option (although that brings its own set of questions).  The model used in Clojure is the most useful implementation of it that I&#8217;ve seen &#8211; you can mostly rely on functional programming and immutability but drop into mutable refs and an STM when needed.  Actor concurrency is another model getting some play lately (Erlang, Scala, etc).  And I think some of the CCR, F#, and other stuff coming out of Microsoft is really interesting as well.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raoul Duke</title>
		<link>http://tech.puredanger.com/2009/01/30/java-concurrency-bugs-atomic/comment-page-1/#comment-139085</link>
		<dc:creator>Raoul Duke</dc:creator>
		<pubDate>Sat, 31 Jan 2009 00:40:24 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/30/java-concurrency-bugs-atomic/#comment-139085</guid>
		<description>&quot;issues with producing reusable concurrent code and of composing large systems in Java&quot;

here&#039;s hoping somebody comes up with a viable alternative some day (e.g. STM).</description>
		<content:encoded><![CDATA[<p>&#8220;issues with producing reusable concurrent code and of composing large systems in Java&#8221;</p>
<p>here&#8217;s hoping somebody comes up with a viable alternative some day (e.g. STM).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mario Gleichmann</title>
		<link>http://tech.puredanger.com/2009/01/30/java-concurrency-bugs-atomic/comment-page-1/#comment-138987</link>
		<dc:creator>Mario Gleichmann</dc:creator>
		<pubDate>Fri, 30 Jan 2009 12:50:48 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/30/java-concurrency-bugs-atomic/#comment-138987</guid>
		<description>Hi Alex,

nice and useful &#039;Trap-Collection&#039; - enjoyed reading so far!

When i first read the title of this post, i thought you&#039;ll speak about having two or more atomic fields which are related to each other in the sense that they participate within a &#039;combined&#039; invariant. 
As pointed out in Goetz&#039; brilliant Book, of course you also have to make all operations atomic that will manipulate both of those atomic fields in order to hold the invariant. 

I think you will elaborate on that specific topic on a further post ... :o)

Greetings

Mario</description>
		<content:encoded><![CDATA[<p>Hi Alex,</p>
<p>nice and useful &#8216;Trap-Collection&#8217; &#8211; enjoyed reading so far!</p>
<p>When i first read the title of this post, i thought you&#8217;ll speak about having two or more atomic fields which are related to each other in the sense that they participate within a &#8216;combined&#8217; invariant.<br />
As pointed out in Goetz&#8217; brilliant Book, of course you also have to make all operations atomic that will manipulate both of those atomic fields in order to hold the invariant. </p>
<p>I think you will elaborate on that specific topic on a further post &#8230; :o)</p>
<p>Greetings</p>
<p>Mario</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Neil Bartlett</title>
		<link>http://tech.puredanger.com/2009/01/30/java-concurrency-bugs-atomic/comment-page-1/#comment-138943</link>
		<dc:creator>Neil Bartlett</dc:creator>
		<pubDate>Fri, 30 Jan 2009 08:35:30 +0000</pubDate>
		<guid isPermaLink="false">http://tech.puredanger.com/2009/01/30/java-concurrency-bugs-atomic/#comment-138943</guid>
		<description>Even worse, the following is not atomic either:

    private long value;
    // later...
    value = 64;

Because longs are 64 bit, if you run this on a 32-bit chip then the assignment can happen as two separate 32 bit operations. To fix this you need to make the field volatile.</description>
		<content:encoded><![CDATA[<p>Even worse, the following is not atomic either:</p>
<p>    private long value;<br />
    // later&#8230;<br />
    value = 64;</p>
<p>Because longs are 64 bit, if you run this on a 32-bit chip then the assignment can happen as two separate 32 bit operations. To fix this you need to make the field volatile.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

