<?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"
	>
<channel>
	<title>Comments on: Please Don&#8217;t Rely on Memory Barriers for Synchronization!</title>
	<atom:link href="http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/</link>
	<description>A Blog on Parallel Programming and Concurrency by Michael Suess</description>
	<pubDate>Wed, 09 Jul 2008 02:27:12 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5</generator>
		<item>
		<title>By: Crest</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-18782</link>
		<dc:creator>Crest</dc:creator>
		<pubDate>Sat, 04 Aug 2007 21:38:36 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-18782</guid>
		<description>The used Instructions (sync, lwsync, eieio) are not vendor specific but architecture specific as every assembler code is by design. The PowerPC specification does offer some freedom to implementors e.g. to implement fsel but the syncronisation primitives aren't optional and their semantic is well defined. Nevertheless the critisiced article is no suited for beginners as it encouraged premature optimations.</description>
		<content:encoded><![CDATA[<p>The used Instructions (sync, lwsync, eieio) are not vendor specific but architecture specific as every assembler code is by design. The PowerPC specification does offer some freedom to implementors e.g. to implement fsel but the syncronisation primitives aren&#8217;t optional and their semantic is well defined. Nevertheless the critisiced article is no suited for beginners as it encouraged premature optimations.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sitsofe Wheeler</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-12268</link>
		<dc:creator>Sitsofe Wheeler</dc:creator>
		<pubDate>Sun, 10 Jun 2007 20:34:21 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-12268</guid>
		<description>You aren't the only one warning against casual use of memory barriers. There's a warning that many people wind up misusing them in Linux kernel drivers too over here: http://zaitcev.livejournal.com/144041.html . It seems that intuitive usage of them doesn't tend towards correctness even with experienced (but non-parallel expert) programmers...</description>
		<content:encoded><![CDATA[<p>You aren&#8217;t the only one warning against casual use of memory barriers. There&#8217;s a warning that many people wind up misusing them in Linux kernel drivers too over here: <a href="http://zaitcev.livejournal.com/144041.html" rel="nofollow">http://zaitcev.livejournal.com/144041.html</a> . It seems that intuitive usage of them doesn&#8217;t tend towards correctness even with experienced (but non-parallel expert) programmers&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Peter Holditch's Blog</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-5658</link>
		<dc:creator>Peter Holditch's Blog</dc:creator>
		<pubDate>Wed, 04 Apr 2007 21:58:17 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-5658</guid>
		<description>&lt;strong&gt;The morning after......&lt;/strong&gt;

Roaming the blogosphere, as I all too seldom do, I often feel like a party-goer the morning after a major rave-up... Stumbling between different points of view and commentary, finding interesting tidbits here and there as I pass by. On...</description>
		<content:encoded><![CDATA[<p><strong>The morning after&#8230;&#8230;</strong></p>
<p>Roaming the blogosphere, as I all too seldom do, I often feel like a party-goer the morning after a major rave-up&#8230; Stumbling between different points of view and commentary, finding interesting tidbits here and there as I pass by. On&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Andrew Miehs</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-3039</link>
		<dc:creator>Andrew Miehs</dc:creator>
		<pubDate>Thu, 01 Mar 2007 12:15:24 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-3039</guid>
		<description>I don't think that the ridiculous fish article was trying to say that 'memory barriers' are the only way to do things - I think it was more a case of 'be careful' and 'look - when I poke the machine, it pokes me back'.

Most of the articles on his page are to do with 'performance' - and I think most people would see this article as a performance vs portability tradeoff.</description>
		<content:encoded><![CDATA[<p>I don&#8217;t think that the ridiculous fish article was trying to say that &#8216;memory barriers&#8217; are the only way to do things - I think it was more a case of &#8216;be careful&#8217; and &#8216;look - when I poke the machine, it pokes me back&#8217;.</p>
<p>Most of the articles on his page are to do with &#8216;performance&#8217; - and I think most people would see this article as a performance vs portability tradeoff.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: alexr</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2731</link>
		<dc:creator>alexr</dc:creator>
		<pubDate>Thu, 22 Feb 2007 17:33:28 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2731</guid>
		<description>"Locks are the only safe and portable solution"

Unfortunately, I can't agree with you on this. There is a time and place for hardware atomic primitives including memory barriers. Perhaps in a Cocoa app as shown on the ridiculous_fish site is not the best place, but assuming a POSIX threading model there would be incorrect as well.

Cocoa (Foundation) has the NSThread abstraction, which is the proper place for syncronization techniques related to whatever the underlying threading model is. (NSLock, NSConditionLock, etc.) It is an oversight by the AppKit team that lower-level operations are not supplied in the framework, although portable ones are supplied by libkern below it that could probably be assumed to exist for a Cocoa application. ($5 says they're already implemented on the ARM port for the iPhone.)

Additionally, recent versions of GCC implement quite a full suite of atomic operations like compare_and_swap in the backend such that if one can assume GCC as a compiler, one can assume that these operations are available in a fairly portable fashion. It is a simple exercise to produce a set of macros that convert these calls into those implemented in Visual Studio or many other compilers which now increasingly provide access to hardware atomic primitives.</description>
		<content:encoded><![CDATA[<p>&#8220;Locks are the only safe and portable solution&#8221;</p>
<p>Unfortunately, I can&#8217;t agree with you on this. There is a time and place for hardware atomic primitives including memory barriers. Perhaps in a Cocoa app as shown on the ridiculous_fish site is not the best place, but assuming a POSIX threading model there would be incorrect as well.</p>
<p>Cocoa (Foundation) has the NSThread abstraction, which is the proper place for syncronization techniques related to whatever the underlying threading model is. (NSLock, NSConditionLock, etc.) It is an oversight by the AppKit team that lower-level operations are not supplied in the framework, although portable ones are supplied by libkern below it that could probably be assumed to exist for a Cocoa application. ($5 says they&#8217;re already implemented on the ARM port for the iPhone.)</p>
<p>Additionally, recent versions of GCC implement quite a full suite of atomic operations like compare_and_swap in the backend such that if one can assume GCC as a compiler, one can assume that these operations are available in a fairly portable fashion. It is a simple exercise to produce a set of macros that convert these calls into those implemented in Visual Studio or many other compilers which now increasingly provide access to hardware atomic primitives.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Phil Dawes&#8217; Stuff &#187; Blog Archive &#187; Multithreading links</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2709</link>
		<dc:creator>Phil Dawes&#8217; Stuff &#187; Blog Archive &#187; Multithreading links</dc:creator>
		<pubDate>Thu, 22 Feb 2007 10:43:18 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2709</guid>
		<description>[...] Then a followup re-adjusting newbies to the complexities of using memory barriers for synchronisation. [...]</description>
		<content:encoded><![CDATA[<p>[&#8230;] Then a followup re-adjusting newbies to the complexities of using memory barriers for synchronisation. [&#8230;]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin Ragheb</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2666</link>
		<dc:creator>Benjamin Ragheb</dc:creator>
		<pubDate>Wed, 21 Feb 2007 19:15:07 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2666</guid>
		<description>Shawn why are you rolling your eyes at my attitude?  I am not angry at all.  I am very grateful that there are people like Michael on the Internet to warn people like myself about information that could be dangerous to people who are not as smart as he is.  The only thing that would be better is if the smarter people could keep that stuff away from the Internet to begin with so people like me would not run the risk of reading it in the first place.</description>
		<content:encoded><![CDATA[<p>Shawn why are you rolling your eyes at my attitude?  I am not angry at all.  I am very grateful that there are people like Michael on the Internet to warn people like myself about information that could be dangerous to people who are not as smart as he is.  The only thing that would be better is if the smarter people could keep that stuff away from the Internet to begin with so people like me would not run the risk of reading it in the first place.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Paul Davis</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2657</link>
		<dc:creator>Paul Davis</dc:creator>
		<pubDate>Wed, 21 Feb 2007 16:01:44 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2657</guid>
		<description>Just a quick note: the fact that POSIX doesn't define atomic operations doesn't mean that they cannot be implemented in a portable fashion. glib, the linux kernel and several other libraries all contain a useful set of atomic operations that use architecture specific memory barriers and other techniques.

Its unfortunate that PThreads didn't include this functionality. As much as advocate of PThreads as I am, I see this as the POSIX committee's issue and not mine, and feel free to use atomic operations in my code, portably. 

I also think that those of us who do real-time development with threads in which we cannot take afford to take locks and have thus been forced to grapple with lock-free but safe programming techniques need to spread the news about what we do a little more widely.</description>
		<content:encoded><![CDATA[<p>Just a quick note: the fact that POSIX doesn&#8217;t define atomic operations doesn&#8217;t mean that they cannot be implemented in a portable fashion. glib, the linux kernel and several other libraries all contain a useful set of atomic operations that use architecture specific memory barriers and other techniques.</p>
<p>Its unfortunate that PThreads didn&#8217;t include this functionality. As much as advocate of PThreads as I am, I see this as the POSIX committee&#8217;s issue and not mine, and feel free to use atomic operations in my code, portably. </p>
<p>I also think that those of us who do real-time development with threads in which we cannot take afford to take locks and have thus been forced to grapple with lock-free but safe programming techniques need to spread the news about what we do a little more widely.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Shawn Erickson</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2614</link>
		<dc:creator>Shawn Erickson</dc:creator>
		<pubDate>Tue, 20 Feb 2007 23:18:59 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2614</guid>
		<description>Wow why all the anger at what Michael posted... he is correct in his assessment that you should only start doing stuff like this when you find that you really need to (for performance reasons) and that the post on ridiculous fish is a little to light on the warnings about doing this.

You often will get better performance increases by changing algorithms (after profiling) then attempting to avoid locks using tricks various tricks.

Oh Benjamin nice attitude... *rolls eyes*</description>
		<content:encoded><![CDATA[<p>Wow why all the anger at what Michael posted&#8230; he is correct in his assessment that you should only start doing stuff like this when you find that you really need to (for performance reasons) and that the post on ridiculous fish is a little to light on the warnings about doing this.</p>
<p>You often will get better performance increases by changing algorithms (after profiling) then attempting to avoid locks using tricks various tricks.</p>
<p>Oh Benjamin nice attitude&#8230; *rolls eyes*</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Benjamin Ragheb</title>
		<link>http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2599</link>
		<dc:creator>Benjamin Ragheb</dc:creator>
		<pubDate>Tue, 20 Feb 2007 18:16:42 +0000</pubDate>
		<guid isPermaLink="false">http://www.thinkingparallel.com/2007/02/19/please-dont-rely-on-memory-barriers-for-synchronization/#comment-2599</guid>
		<description>I am so glad you posted this, since you are so smart you can point out how dangerous the information on the Ridiculous Fish blog is when read by people who aren't as smart as you.  I will admit I was disappointed, however, that you didn't make your criticism more portable, so I wouldn't have to modify it to apply to the specific details of other blogs I read.</description>
		<content:encoded><![CDATA[<p>I am so glad you posted this, since you are so smart you can point out how dangerous the information on the Ridiculous Fish blog is when read by people who aren&#8217;t as smart as you.  I will admit I was disappointed, however, that you didn&#8217;t make your criticism more portable, so I wouldn&#8217;t have to modify it to apply to the specific details of other blogs I read.</p>
]]></content:encoded>
	</item>
</channel>
</rss>
