<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - Programming in the Age of Concurrency: Software Transactional Memory</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory/RSS"></atom:link>
	<image>
		<url>http://ecn.channel9.msdn.com/o9/previewImages/100/226244_100x75.jpg</url>
		<title>Channel 9 - Programming in the Age of Concurrency: Software Transactional Memory</title>
		<link></link>
	</image>
	<description>Recently, we visited MSR Cambridge(UK) to meet some of the great minds working there. In this case, we were fortunate enough to get an hour&#39;s time with
Simon Peyton-Jones and
Tim Harris, who are researchers working on a very hard problem: making it easier (more predictable, more reliable, more composable) to write concurrent applications in this the age of Concurrency (multi-core
 is a reality, not a dream). Specifically, Simon and Tim (and team) are working on a programming technology called Software Transactional Memory (STM) which provides an elegant, easy to use&amp;nbsp;language-level abstraction&amp;nbsp;for writing concurrent applications that is based on widely-understood
 conceptual constructs like Atomic operations (and, well, Transactions...). Simon, Tim and team do all the nasty locking work for you. With STM-enabled languages, you can just concentrate on the algorithms at hand and leave the low-level&amp;nbsp;heavy lifting to the
 sub-system. Sound familiar?So, imagine this:atomic{&amp;nbsp;&amp;nbsp;&amp;nbsp;//do stuff - if failure, then throw ex out&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;//of block, roll back - this is a transaction...}/*next code fragment... So, code flow appears sequential to the programmer(as we would expect), even though under the covers it is of course not always processing&amp;nbsp;sequentially*/Read scientific papers 
here. Play with STM here and 
here.[My apologies for the somewhat shaky camera work. This conversation took place shortly after the terrorist scare at London&#39;s Heathrow airport (I had to leave some of my camera equipment in New Delhi)]</description>
	<link></link>
	<language>en</language>
	<pubDate>Wed, 19 Jun 2013 11:47:30 GMT</pubDate>
	<lastBuildDate>Wed, 19 Jun 2013 11:47:30 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[Good stuff.&nbsp; Couple questions:<br /><br />1) I missed a fundamental idea I think.&nbsp; It sound as if the last writer wins.&nbsp; So if I have an atomic block, I can make changes to state.&nbsp; But another thread can write to the state and commit, but the first atomic block will then rollback.&nbsp; What did I miss?<br /><br />2) Charles, you had a good question that don't think was fully answered in the vid.&nbsp; Doing async in the block.<br /><br />atomic()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Do some stuff<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BeginXXX(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delegate(int i)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Do some stuff in callback.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />}<br /><br />We do some stuff and then kick off an async operation.&nbsp; But then we exit the atomic block right away because the async operation does not block.&nbsp; So the callback is not executed in atomic anymore.&nbsp; And worse yet,&nbsp; the code appears as if it is still executed
 in the block.&nbsp; What I am missing?&nbsp; Or was the answer just to never do this?<br /><br />3)&nbsp; How does long running I/O and DB transactions play with this.&nbsp; So in a normal app, I would need both to be atomic.&nbsp; I need the in-memory objects to be atomic and the DB to be atomic in a single transaction.&nbsp; How does this work?<br /><br />Thanks!<br /><p>posted by staceyw</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927593450000000</link>
		<pubDate>Sat, 02 Sep 2006 02:02:25 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927593450000000</guid>
		<dc:creator>staceyw</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>Niners, please play with this (the C#/VB.net library may be easier to grasp given that Haskell is purely functional...). Tim and Simon need real world feedback. How would you use atomic blocks in your applications? What scenarios make use of atomic hard
 for you? See the links in the video post description. Also, please read the Composability paper (you don't have to be a scientist to understand it...)</p>
<p>Play with STM!</p>
<p>C</p>
<p>posted by Charles</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927628080000000</link>
		<pubDate>Sat, 02 Sep 2006 03:00:08 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927628080000000</guid>
		<dc:creator>Charles</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[Another great one Charles. This is some pretty complex stuff to wrap your head around, and the bit about the garbage collector and all that's required to implement atomic transactions really went way over my head!<br /><br />But I tell you, I wish I had this technology in the languages I use (C&#43;&#43; and Pascal) RIGHT NOW!<br /><br />And Haskell is really getting some air time these days <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-5.gif' alt='Wink' /><br /><br />I love C9 videos!<br /><p>posted by efortier</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927699270000000</link>
		<pubDate>Sat, 02 Sep 2006 04:58:47 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927699270000000</guid>
		<dc:creator>efortier</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[&quot;1) I missed a fundamental idea I think.&nbsp; It sound as if the last writer wins.&nbsp; So if I have an atomic block, I can make changes to state.&nbsp; But another thread can write to the state and commit, but the first atomic block will then rollback.&nbsp; What did I
 miss?&quot;<br /><br />The first one, like all blocks,&nbsp;will check for changes before commit and recalculate if they exist, i think.<p>posted by apoc</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927703990000000</link>
		<pubDate>Sat, 02 Sep 2006 05:06:39 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927703990000000</guid>
		<dc:creator>apoc</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>staceyw wrote:</div>
<div>1) I missed a fundamental idea I think.&nbsp; It sound as if the last writer wins.&nbsp; So if I have an atomic block, I can make changes to state.&nbsp; But another thread can write to the state and commit, but the first atomic block will then rollback.&nbsp; What did I
 miss?</div>
</blockquote>
<br />Your understanding sounds on par with mine, except that I don't see why the thread that commits its data wins and the other looses (except for the performance penalty).<br /><br />If thread A tries to withdraw $100 from an account but there's no money in it, it retries which in effect puts it to sleep.<br /><br />Then thread B comes along and credits $100 to the same account. Since no other threads are accessing that account, thread B can commit and continue its processing.<br /><br />Then thread A wakes up since it detects a write to the account's memory and then retries the whole transaction which succeeds since the money is there.<br /><br />Of course the thread that got into the retry state hits an additional performance penalty, but I think the whole idea of this system is to make things easier, not faster.<br /><br />That sounds extremely powerful. <br /><br />When you said the last writer wins, were you talking about performance? <br /><br /><br /><blockquote>
<div>staceyw wrote:</div>
<div>3)&nbsp; How does long running I/O and DB transactions play with this.&nbsp; So in a normal app, I would need both to be atomic.&nbsp; I need the in-memory objects to be atomic and the DB to be atomic in a single transaction.&nbsp; How does this work?</div>
</blockquote>
<br />Yeah, there's still a lot of things that are still unknown.<br /><br />In the debit/credit example, what if the money never gets deposited in the account? Does an atomic transaction has a timeout value? What if an atomic block triggers an external process of some kind by setting a property of an object?<br /><br />I suppose there's a whole set of guidelines and restrictions we'd have to follow when using atomic blocks. Reading the papers available would surely answer most of the unknowns.<br /><br />Eric<br /><p>posted by efortier</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927713920000000</link>
		<pubDate>Sat, 02 Sep 2006 05:23:12 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927713920000000</guid>
		<dc:creator>efortier</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>It seems to me that&nbsp; STM creates &nbsp;new problems with composability.&nbsp; You create two classes of code: atomic methods and non atomic methods.</p>
<p>Nonatomic methods can easily call atomic ones – the compiler could even automatically inject the atomic block if the programmer forgot.</p>
<p>Atomic methods and blocks cannot be allowed to call nonatomic code.&nbsp; The nonatomic code could do I/O or other irrevocable things that would be duplicated when the block had to retry.</p>
<p>This creates the exact problem that the “const” modifier has in C&#43;&#43;.&nbsp; Your library writer has to anticipate everything you may want to do inside a transaction and provide you with an atomic version.&nbsp; By liberally making methods atomic, the author seriously
 limits future versions of the library because making a previously atomic method non-atomic is a breaking change.</p>
<p>In C&#43;&#43; they cop out and let you cast away the “constness” of a variable because there were too many places where the composition, exactly the problem you are trying to fix, didn’t work when you had one class of code that couldn’t call another class of code.</p>
<p>Its worse for STM because you can’t even cop out and say “use this sparingly.”&nbsp; Letting a transaction call nonatomic code creates the very race condition that you are trying to avoid, and makes them worse by running code many times that you have told the
 programmer to think about as only running once.</p>
<p>I am certain this will not be the first time this problem has come up, especially since you mention statically enforcing it in the compiler.&nbsp; I am just curious to hear what people think about what it will do to composability.</p>
<p>&nbsp;</p>
<p>posted by John Melville-- MD</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927872250000000</link>
		<pubDate>Sat, 02 Sep 2006 09:47:05 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927872250000000</guid>
		<dc:creator>John Melville-- MD</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[Hi, great questions --<br /><br /><blockquote>
<div>staceyw wrote:</div>
<div>1) I missed a fundamental idea I think.&nbsp; It sound as if the last writer wins.&nbsp; So if I have an atomic block, I can make changes to state.&nbsp; But another thread can write to the state and commit, but the first atomic block will then rollback.&nbsp; What did I
 miss?</div>
</blockquote>
<br /><br />You're right, this is what the implementation in Haskell will do.&nbsp; But there's actually a lot of flexibility for the implementation to do other things -- maybe to guarantee some kind of fairness between threads so that the atomic blocks of one thread don't
 keep on getting rolled back by the atomic blocks of another, or to hold off the execution of one thread's atomic block because it's really likely to conflict with another (if conflicts are really likely then its best to run the atomic blocks sequentially rather
 than in parallel).<br /><br />I think this is one of the nice things about atomic blocks -- the abstraction provided to the programmer is &quot;all this happens atomically&quot;, but the implementation can do smarter things to reduce the wasted work caused by atomic blocks being rolled back.&nbsp;<br /><br />If you want to read more about this aspect of transactional memory, then Michael Scott's group at U Rochester has done a lot of nice work in the area.<br /><br /><blockquote>
<div>staceyw wrote:</div>
<div>2) Charles, you had a good question that don't think was fully answered in the vid.&nbsp; Doing async in the block.<br /><br />atomic()<br />{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Do some stuff<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; BeginXXX(<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delegate(int i)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;// Do some stuff in callback.<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />}<br /><br />We do some stuff and then kick off an async operation.&nbsp; But then we exit the atomic block right away because the async operation does not block.&nbsp; So the callback is not executed in atomic anymore.&nbsp; And worse yet,&nbsp; the code appears as if it is still executed
 in the block.&nbsp; What I am missing?&nbsp; Or was the answer just to never do this?</div>
</blockquote>
<br /><br />That's a difficult question!&nbsp; As you say, one answer could be that this should never be done -- in Haskell we have a very clear separation between things that can be done in atomic blocks (like updates to shared memory), and things that can't (like creating
 new threads).&nbsp; <br /><br />Another answer could be that the BeginXXX action kicks off the async operation as normal when the atomic block commits, but that the delegate runs in its own transaction when its called.&nbsp;&nbsp;<br /><br />A third option is that the&nbsp;async actions are kicked off when the atomic block commits, and the delegates then&nbsp;just run normally.&nbsp; This option fits in with one of the ways that we've sometimes explained the semantics of atomic blocks: think of &quot;atomic&quot; as causing
 the thread entering the block to suspend all of the others in the system and then run in isolation, resuming the other threads when it reaches the end of the block.<br /><br />As I said though, it's a difficult question; maybe there are better options than these three!<br /><br /><blockquote>
<div>staceyw wrote:</div>
<div>3)&nbsp; How does long running I/O and DB transactions play with this.&nbsp; So in a normal app, I would need both to be atomic.&nbsp; I need the in-memory objects to be atomic and the DB to be atomic in a single transaction.&nbsp; How does this work?</div>
</blockquote>
<br /><br />Another great topic <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif' alt='Smiley' />.&nbsp; At the moment we're looking at adding features to the Haskell implementation to do this kind of thing.&nbsp; Basically it involves doing a two-phase commit that involves the transactional memory and the database -- that means getting the
 transactional memory and database to both vote that their part of the transaction is OK to commit, and then only doing the commit once both have voted OK.&nbsp; It adds some complexity to the implementation -- after the transactional memory has voted OK then it
 can't go back on its decision and abort.&nbsp; I did actually look at this kind of technique in an earlier system using transactional memory -- there's a bit about it in a paper &quot;Exceptions and side effects in atomic blocks&quot; linked from my page
<a href="http://research.microsoft.com/~tharris">http://research.microsoft.com/~tharris</a>.<br /><br />The thing that's really important to remember for atomic blocks, though, is that it must make sense for the block's contents to occur as a single atomic action.&nbsp; For instance, atomic blocks that just perform input or just perform output are OK (e.g. we can
 buffer up the output until the block commits), but an atomic block that writes something on the screen, waits for a user's interaction, and then continues isn't OK -- that's really two separate actions (one before the user's input, and one after the user's
 input), rather than a single atomic action.<br /><br />Tim<p>posted by TimHarris</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927923650000000</link>
		<pubDate>Sat, 02 Sep 2006 11:12:45 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632927923650000000</guid>
		<dc:creator>TimHarris</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[This looks like fantastic work and a great step forward for solid concurrent programming without the the pain of deadlocks and race conditions.<br /><br />I have one question, on timing: Say we have a long, slow atomic method A, and a swift method B. The System runs hundreds of B calls sequentially while on a different thread, method A is called. Now if I understand the model correctly, if a B call commits before
 A is done, A is restarted with the new data. Considering that B calls are run continuously and&nbsp; are always faster than A, will A ever be able to complete? Locking solves that with a ready queue, which keeps track of the next method to have exclusivity. How
 is that handled in STM?<br /><p>posted by Alexis</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632929340520000000</link>
		<pubDate>Mon, 04 Sep 2006 02:34:12 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632929340520000000</guid>
		<dc:creator>Alexis</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>Excellent video!<br />I downloaded the C# code and took a quick look.<br />Good work with the runtime proxy generation. Geez, it must have been painful writing all that emit IL code!<br /><br />I'll take a look at writing some Nemerle macros to make the syntax nice. I'm thinking macros along the lines of:<br /><br />foo = atomic(Foo(arg1, arg2))<br />&lt;==&gt;<br />foo = XAction.MakeFactory(typeof(Foo)).Create(arg1, arg2) : Foo;<br />-------------------------<br />atomic(foo.Bar(x,y,z))<br />&lt;==&gt;<br />XAction.Run(XStart(foo.Bar), x, y, z);<br />--------------------------<br />retry<br />&lt;==&gt;<br />XAction.Retry();<br />--------------------------<br />y = attempt { Get1, Get2 } (arg1, arg2)<br />&lt;==&gt;<br />y = XAction.Run(XAction.OrElse(new XStart(Get1), new XStart(Get2)), arg1, arg2) : int;</p>
<p>y = attempt {Get1, Get2, Get3} (arg1, arg2)<br />&lt;==&gt;<br />y = XAction.Run(XAction.OrElse(XAction.OrElse(new XStart(Get1), XAction.OrElse(new XStart(Get2), new XStart(Get3)))), arg1, arg2) : int;</p>
<p>posted by Andrew Davey</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632930018930000000</link>
		<pubDate>Mon, 04 Sep 2006 21:24:53 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632930018930000000</guid>
		<dc:creator>Andrew Davey</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p><br />Suppose I have a cache of some calculation, that I calculate in a lock with double checking to be thread safe, like this:</p>
<p><br />private static readonly Dictionary&lt;Type, int[]&gt; _typeInts = new Dictionary&lt;Type, int[]&gt;();</p>
<p>public int[] TypeInts<br />{<br />&nbsp;&nbsp;&nbsp; get<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type thisType = this.GetType();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!_typeInts.ContainsKey(thisType))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lock (_typeInts)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!_typeInts.ContainsKey(thisType))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _typeInts[thisType] = &lt;&lt;calculate int[]&gt;&gt;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return _typeInts[thisType];<br />&nbsp;&nbsp;&nbsp; }<br />}</p>
<p><br />Would I be able to replace this with:</p>
<p><br />private static readonly Dictionary&lt;Type, int[]&gt; _typeInts = new Dictionary&lt;Type, int[]&gt;();</p>
<p>public int[] TypeInts<br />{<br />&nbsp;&nbsp;&nbsp; get<br />&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; atomic<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Type thisType = this.GetType();<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (!_typeInts.ContainsKey(thisType))<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _typeInts[thisType] = &lt;&lt;calculate int[]&gt;&gt;;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return _typeInts[thisType];<br />&nbsp;&nbsp;&nbsp; }<br />}</p>
<p>my intuition says it should work if I do all looking up and updating of the _typeInts inside an atomic block.<br />But suppose the ContainsKey is run and another thread interrupts before the int[] is calculated. The other thread runs the same atomic operation to completion, would the first atomic opration retry because some state it read was updated or would it throw an
 exception when trying to insert a duplicate key?<br /></p>
<p>posted by ebdrup</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632932324200000000</link>
		<pubDate>Thu, 07 Sep 2006 13:27:00 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632932324200000000</guid>
		<dc:creator>ebdrup</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>ebdrup wrote:</div>
<div>&#65279;my intuition says it should work if I do all looking up and updating of the _typeInts inside an atomic block.<br />But suppose the ContainsKey is run and another thread interrupts before the int[] is calculated. The other thread runs the same atomic operation to completion, would the first atomic opration retry because some state it read was updated or would it throw an
 exception when trying to insert a duplicate key?<br /></div>
</blockquote>
<br /><br />Hi -- yes, if the second thread's atomic block commits while the first thread's one is still running then the runtime system will detect the conflict, roll back the first thread's attempt, and then re-execute it (when it will see the update that the second
 thread has made).&nbsp; <br /><br />Tim<br /><br /><p>posted by TimHarris</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632933014540000000</link>
		<pubDate>Fri, 08 Sep 2006 08:37:34 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632933014540000000</guid>
		<dc:creator>TimHarris</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>I can see how STM could have some performance implications, I mean if the atomic blocks get large ther is a lot of bookkeeping about what memory has been read and written. I can also see there is a lot of room for smart soultions in reducing the amount of
 bookkeping nessesary. But I love the power of the concept of transactional memory.</p>
<p>I'm wondering, couldn't STM have been implemented by you inserting the locks nessesary or probably better, a combination of locks where they would be smart and not deadlock and reevaluating where that would be deemed smart. I mean it's easy to think up scenarioes
 where there would be performance problems with reevaluating and you need a lot of good heuristics to ensure good performance in most cases. If you let the compiler insert the locks nessesary you can have it analyze for deadlocks at least in&nbsp;some cases and
 you eliminate the problem of having to keep a global order of locks that you talk about in the video.</p>
<p>Why did you opt for reevaluating instead of inserting locks. (guess the answer is composability)</p>
<p>posted by ebdrup</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632935720090000000</link>
		<pubDate>Mon, 11 Sep 2006 11:46:49 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632935720090000000</guid>
		<dc:creator>ebdrup</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[Hi,<br /><br />For starters, this is really amazingly cool. The first time I heard of this was in one of Herb Sutters presentations on concurrency.&nbsp;I have always hated locks, because you just can't get them right in non-trivial applications. And don't trust anyone you that
 says you can. <br /><br />Can we have it tomorrow? <br /><br />I do have some lowlevel questions:<br /><br />Of course it is easy to make a private copy for the current thread of all the objects participating in the transaction. But how is it prevented that you accidently see a pointer to the &quot;public&quot; version of one of the objects in the transaction?&nbsp;Potentially expensive...<br /><br />Do you aquire locks under the covers? <br /><br />Are there also people looking at hardware support? With the processors virtual memory support, and copy-on-write features at this level, you could get some of the transactional features fairly cheap. It would complicate the garbage collector implementation
 a little....<br /><br /><p>posted by jan.devaan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632990560840000000</link>
		<pubDate>Mon, 13 Nov 2006 23:08:04 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632990560840000000</guid>
		<dc:creator>jan.devaan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>jan.devaan wrote:</div>
<div>Can we have it tomorrow?</div>
</blockquote>
<br /><br />You can have it today!<br /><br />This is already implemented in Haskell (as mentioned in the video), and in a much more elegant way than will ever be possible in an imperative language. Haskell already separates code with side effects from code without side effects because it's purely functional,
 so it's &quot;trivial&quot; to simply disallow the side effecting code within transactions (except, of course, the transactional side effects, which are kind of the point <img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-1.gif' alt='Smiley' />). Basically you'll layer your code into three layers, the lowest layer is the IO layer which
 does all the nasty side effecting things like networking, user input, etc., on top of that is the transactional layer in which you do all your reads and writes to shared memory (in atomic blocks as needed), and from both of these lower layers you'll call the
 topmost layer, the purely functional layer (which is where the actual application logic is written). They key is that you only allow calls &quot;up&quot;, not &quot;down&quot;. I.e. you can call pure functions and transactions from IO, but you can't call IO from transactions
 and pure functions. Likewise you can call pure functions from transactions, but you can't call transactions from pure functions.<br /><br />The transactional layer is &quot;new&quot; (added late 2005, IIRC), but the strategy of separating your code into layers of increasing purity (now three, previously two) is not new and has been proven to be extremly elegant and viable. In fact, even well written imperative
 code usually does this for design reasons - Haskell just enforces it and buys all sorts of cool things with the properties that hold because of it, such as easy parallellism (&quot;These two functions can provably not interfere with each other due to lack of side
 effects you say? Well then I'll just go ahead and compute them on different threads then!&quot;), transactions, far easier reasoning (and therefor maintenance) etc.
<br /><br />Check it out! <a href="http://www.haskell.org">http://www.haskell.org</a><p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632999132290000000</link>
		<pubDate>Thu, 23 Nov 2006 21:13:49 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632999132290000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[<a href="http://groups.google.com/group/comp.arch/msg/e0958ecf43f95f51">http://groups.google.com/group/comp.arch/msg/e0958ecf43f95f51</a><br /><br />Any thoughts?<br /><br /><br />P.S.--<br /><br /><p>may I suggest that you all visit comp.programming.threads once and a while… We have the goods wrt scalability and throughput. We will give you the honest appraisal, and not mislead you with TM!<br /><br />Thank you,<br /><br />Chris Thomasson<br /><a href="http://appcore.home.comcast.net/">http://appcore.home.comcast.net/</a><br />(portable lock-free data-structures)</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632999344180000000</link>
		<pubDate>Fri, 24 Nov 2006 03:06:58 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632999344180000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>cristom wrote:</div>
<div>&#65279;<a href="http://groups.google.com/group/comp.arch/msg/e0958ecf43f95f51">http://groups.google.com/group/comp.arch/msg/e0958ecf43f95f51</a><br /><br />Any thoughts?<br /><br /><br />P.S.--<br /><br /><p>may I suggest that you all visit comp.programming.threads once and a while… We have the goods wrt scalability and throughput. We will give you the honest appraisal, and not mislead you with TM!<br /><br />Thank you,<br /><br />Chris Thomasson<br /><a href="http://appcore.home.comcast.net/">http://appcore.home.comcast.net/</a><br />(portable lock-free data-structures)</p>
</div>
</blockquote>
<br /><br />Lock-less programming is all well and good for a few very specific cases, but you still don't get composability (which is the whole point of using transactions).<br /><br />Also, the performance argument is inherently flawed. First of all, &quot;sufficient performance&quot; is&nbsp;a moving target. If I can make use of four times as many threads in my program, but it runs twice as slow, then it's still a win (if not now, then in a few years).
 Also, don't forget that STM basically gives you exception safety for free.<br /><br />I also think it's a misstake to consider transactions for <strong>everything</strong>. I understand why this is such a common knee-jerk reaction since most programmers are more familiar with imperative languages, but in my opinion using a language whose fundamental
 method of computation is &quot;modify state&quot; in a multithreaded environment where the state is shared and all the threads depend on the state remaining consistent from
<em>their</em> point of view, is pretty much a bad idea. You're just asking for problems.
<br />STM really begins to make perfect sense when you consider it in a purely functional context. You may sprinkle in some imperative nuggets here and there when needed for algorithmic reasons (see the ST monad in Haskell - imperative code in a pure setting with
 static guarantees that no side effects leak out). These small sections of imperative code wouldn't be parallellized, of course. Then the vast majority of your code uses the pure functional approach with parallellism (e.g. using the &quot;par&quot; keyword in Haskell,
 or some of the new data parallel stuff), and then at the very bottom you have some thread based shared memory concurrency where it makes sense, which is where STM comes in.<br /><br />I don't think shared state concurrency with threads is the best way to do concurrency,&nbsp;but I don't think we can do&nbsp;completely without it either.&nbsp;And for that code, which in typical programs would be a very small fraction, you need something clever to get composability
 -&nbsp;STM fits the bill perfectly.<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632999921560000000</link>
		<pubDate>Fri, 24 Nov 2006 19:09:16 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c632999921560000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>“Lock-less programming is all well and good for a few very specific cases, but you still don't get composability (which is the whole point of using transactions).”</p>
<p>&nbsp;</p>
<p>I completely disagree. There are many different *types of lock-free algorithms you can use to solve many of the fundamental problems that are attributed to the Reader/Writer Problem:</p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.programming.threads/browse_frm/thread/576ad37c34dd673a">http://groups.google.com/group/comp.programming.threads/browse_frm/thread/576ad37c34dd673a</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>This particular race-condition is common to basically any multi-threaded application. So lock-free is more useful than you think… As for composability, well I have invented a lock-free eventcount algorithm which can be used as a completely composabile signal
 with atomic operation free fast-pathing on every call. This algorithm can work with basically any lock-based or lock-free algorithm. The heavy fast-pathing makes it work with lock-free. So, your assertion that lock-free algorithms are not composaible is fundamentally
 flawed.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>“Also, the performance argument is inherently flawed. First of all, &quot;sufficient performance&quot; is a moving target. If I can make use of four times as many threads in my program, but it runs twice as slow, then it's still a win (if not now, then in a few years).
 Also, don't forget that STM basically gives you exception safety for free.”</p>
<p>&nbsp;</p>
<p>Nonsense, I advise you to take the challenge on my appcore site:</p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/">http://appcore.home.comcast.net/</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Have fun trying to get the STM version of a FIFO queue to compete with an algorithm that has no atomic operations (e.g., interlocked), and no #StoreLoad or #LoadStore memory barriers. This is just one example. If you use STM, then I can always design something
 that will have better scalability, throughput and overall performance characteristics. There is another class of lock-free algorithms that allow you raw pointer access into mutable shared data-structures’ without using any atomic operations or #StoreLoad,
 or even #LoadStore style memory barriers. There are many different ways to implement this. I suggest that you search Google groups, in comp.programming.threads, for ‘Partial Copy-On-Write Deferred Reclamation (PDR)’…
</p>
<p>&nbsp;</p>
<p>*--<a href="http://groups.google.com/group/comp.programming.threads/search?hl=en&amp;group=comp.programming.threads&amp;q=pdr&amp;qt_g=1">http://groups.google.com/group/comp.programming.threads/search?hl=en&amp;group=comp.programming.threads&amp;q=pdr&amp;qt_g=1</a></p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.programming.threads/search?hl=en&amp;group=comp.programming.threads&amp;q=vzoom&amp;qt_g=1">http://groups.google.com/group/comp.programming.threads/search?hl=en&amp;group=comp.programming.threads&amp;q=vzoom&amp;qt_g=1</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.arch/search?hl=en&amp;group=comp.arch&amp;q=vzoom&amp;qt_g=1">http&#58;&#47;&#47;groups.google.com&#47;group&#47;comp.arch&#47;search&#63;hl&#61;en&#38;group&#61;comp.arch&#38;q&#61;vzoom&#38;qt_g&#61;1</a></p>
<p>&nbsp;</p>
<p>… Lock-Free atomic reference counted pointers:</p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.programming.threads/browse_frm/thread/f2c94118046142e8">http://groups.google.com/group/comp.programming.threads/browse_frm/thread/f2c94118046142e8</a></p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/vzoom/refcount/">http://appcore.home.comcast.net/vzoom/refcount/</a></p>
<p>&nbsp;</p>
<p>, please note that Boost shared_ptr&lt;&gt; doesn’t for this kind of stuff because its thread safety level is Basic.
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>… Fast-pathed read-write locks:</p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.programming.threads/search?hl=en&amp;group=comp.programming.threads&amp;q=fast-path&#43;rw&#43;mutex&amp;qt_g=1">http://groups.google.com/group/comp.programming.threads/search?hl=en&amp;group=comp.programming.threads&amp;q=fast-path&#43;rw&#43;mutex&amp;qt_g=1</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>… Mutexs, or 100% lock-based STM:</p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.programming.threads/browse_frm/thread/e0c011baf08844c4">http://groups.google.com/group/comp.programming.threads/browse_frm/thread/e0c011baf08844c4</a></p>
<p>(a simple multi-mutex algorithm)</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>“I also think it's a misstake to consider transactions for everything. I understand why this is such a common knee-jerk reaction since most programmers are more familiar with imperative languages, but in my opinion using a language whose fundamental method
 of computation is &quot;modify state&quot; in a multithreaded environment where the state is shared and all the threads depend on the state remaining consistent from their point of view, is pretty much a bad idea. You're just asking for problems.“</p>
<p>&nbsp;</p>
<p>Speak for yourself. No reason to fear mutable shared data-structures’. Heck, you want me to give one of the main fast-paths for my database server? Oh boy… Its made up of PDR and huge lock-free shared linked data-structures… STM will livelock for the kind
 of stuff I am programming unless it folds under its ‘contention-manager security blanket’ under load. This in unacceptable, IMHO, anytime your application “depends” on an explicit contention manager, IMHO, you know you have problems…</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>“STM really begins to make perfect sense when you consider it in a purely functional context. You may sprinkle in some imperative nuggets here and there when needed for algorithmic reasons (see the ST monad in Haskell - imperative code in a pure setting
 with static guarantees that no side effects leak out). These small sections of imperative code wouldn't be parallellized, of course. Then the vast majority of your code uses the pure functional approach with parallellism (e.g. using the &quot;par&quot; keyword in Haskell,
 or some of the new data parallel stuff), and then at the very bottom you have some thread based shared memory concurrency where it makes sense, which is where STM comes in.”</p>
<p>&nbsp;</p>
<p>Humm… STM is using shared memory so you can’t get rid of it at all. Plus, if you put it in the hardware, the cache coherency mechniasism would simply have to be really strict. I am in favor of weak cache and well defined/documented memory model, not monolithich
 cache coherence designs! Nasty!</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>“I don't think shared state concurrency with threads is the best way to do concurrency, but I don't think we can do completely without it either. And for that code, which in typical programs would be a very small fraction, you need something clever to get
 composability - STM fits the bill perfectly.”</p>
<p>&nbsp;</p>
<p>You have to learn the fundamentals’ of multi-threaded programming. I recommend “Programming with POISX Threads” by David Butenhof. It’s excellent. Don’t sacrifice yourself to composability or nothing programming paradigm! You will end up binding yourself
 to tons of overhead. STM will lead you down the wrong road, IMO. You can always design lock-based algorithms with POSIX that consistently outperform their well crafted STM equivalents. STM has to orchestrate to many things. Its kind of like a giant LL/SC atomic
 operations. Of course… LL/SC is subject to livelock, even in hardware. Special care has to be taken. You have to consider the size of the reservation granularity. The larger the granule, the more prone to livelock. STM is a giant LL/SC with the reservation
 granule being every single operation you make. If there are any interferences, your transaction, or LL reservation, gets shot in the head!!</p>
<p>&nbsp;</p>
<p>;^)</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>STM, well, that’s not an ideal synchronization scheme at all. IMHO, of course.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>-- P.S.</p>
<p>&nbsp;</p>
<p>Please visit comp.arch, or comp.programming.threads some time…</p>
<p>&nbsp;</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000330540000000</link>
		<pubDate>Sat, 25 Nov 2006 06:30:54 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000330540000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[Man... What the heck happened to my post!?!?!!<br /><br />I will put it on my site, and post it here when I am done...<br /><br />Sorry... It looked fine in the preview!!<br /><br />Anyway, it will be on my site shortly.<br /><br />Sorry for any confusion!<br /><br />;^(...<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000336970000000</link>
		<pubDate>Sat, 25 Nov 2006 06:41:37 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000336970000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[Well, on second look, the link work, and you can read the post... So I don't really need to repost it.<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000340380000000</link>
		<pubDate>Sat, 25 Nov 2006 06:47:18 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000340380000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[What about this:<a href="http://groups.google.com/group/comp.programming.threads/browse_frm/thread/a0966697738790c4"><br /><br />http://groups.google.com/group/comp.programming.threads/browse_frm/thread/a0966697738790c4</a><br /><br /><br />The interviewer did not press them on any other major alternatives'...<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000403050000000</link>
		<pubDate>Sat, 25 Nov 2006 08:31:45 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000403050000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>Cristom, I'm not a huge fan of your style of argument. You take on a very superior tone (such as assuming I don't know anything about multithreading) and make your point by posting tons of links, which makes following your argument very time consuming if
 not impossible. No doubt that leads you to &quot;win&quot; a lot of arguments by walk-over, but you're not actually convincing anyone. Summarize your point in way which is relevant to
<em>this</em> discussion, don't assume I'm willing to get involved in 20 previous discussions to try to deduce your point from there.</p>
<p>However you're missing the target completely. I already conceded that lock free programming is all well and good in certain cases, so there is no point linking a whole bunch of lock free abstractions. What I claimed was that while&nbsp;it is possible to&nbsp;write
 a lock free abstraction that will run faster than an STM based one (as you point out), you can trivially write an STM transaction that simply is not expressible with lock free programming. STM gives you
<em>general</em> composability (i.e. <em>always</em>), lock free programming does not - which does not mean that it's impossible to write composable abstractions in specific cases (i.e
<em>sometimes</em>).<br /><br />You also seemed to have misunderstood my point about using STM in purely functional programming because I can't make sense of your response to that. You're not making the erronous assumption that &quot;purely functional programming == no mutable data&quot;&nbsp;are you? Pure
 FP simply means that there are strong static guarantees that will ensure that a pure function won't use mutable state in any way which interferes with other pure functions (read about the ST monad). You also need some &quot;impure functions&quot; (really they're just
 pure values which <em>represents</em> impure functions through monads - so it's still pure) to do IO and some of the low level stuff - and
<em>that's</em> the only place you'd use STM. So even if you think performance is horrible for STM, a typical functional program only has a handful of places where it would be useful anyway, so it's not a big problem -- 90% of the program is purely functional
 and thus has no problem with parallellism (which is different from concurrency). Most of my FP applications have no mutable variables at all, and the ones that do typicall have one or two or so (usually the ones with GUIs or lots of IO stuff). This is an ideal
 setting to introduce STM.<br /><br /></p>
<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000483990000000</link>
		<pubDate>Sat, 25 Nov 2006 10:46:39 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000483990000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>“Cristom, I'm not a huge fan of your style of argument. You take on a very superior tone (such as assuming I don't now anything about multithreading)”<br /><br /></p>
<p>IMHO, you were coming across as if mutable shared data is too advanced or something… The ability to access mutable data without using atomic operations and memory barriers is key to scalability. This is impossible with STM. Period. End of story. BTW, if
 you know of a TM implementation that doesn’t make frequent use of those expensive operations, please post a link. I would be interested. Indeed.<br /></p>
<p><br />“and make your point by posting tons of links, which makes following your argument very time consuming if not impossible.”<br /></p>
<p>If you follow those links, you should have a better understanding of STM…<br /><br /></p>
<p>“No doubt that leads you to &quot;win&quot; a lot of argument by walk-over, but you're not actually convincing anyone.&quot;<br /><br /></p>
<p>I usually convince those who follow the links and do some research. There is more than one issue involved.<br /><br /><br />“Summarize your point in way which is relevant to this discussion, don't assume I'm willing to get involved in 20 previous discussion to try to deduce your point from there.”<br /><br />The summary would be a couple of pages long… I would rather post links to prior art.<br /><br /><br /><br />“However you're missing the target completely. I already conceded that lock free programming is all well and good in certain cases, so there is no point linking a whole bunch of lock free abstractions.”<br /><br />Just showing you what’s out there. The video did not point out any alternatives’. I felt I just had to.<br /><br /><br /><br />“What I claimed was that while you can write a lock free abstraction that will run faster than an STM based one (as you point out), you can trivially write an STM transaction that simply is not expressible with lock free programming.”<br /><br />Well, the STM can be lock-free, although they are usually only obstruction-free but that’s another matter. I would post a link, but you don’t like that. So research on your own I guess. So, you are incorrect to say that you can do stuff with STM that you can’t
 do with lock-free programming; a STM can be based on a lock-free algorithm. See my point here?<br /><br /><br /><br />“STM gives you general composability (i.e. always), lock free programming does not - which does not mean that it's impossible to write composable abstractions in specific cases(i.e sometimes).”<br /><br />Its not impossible. The price you pay for general composability is far to great. BTW, check this out:<br /><br /><a href="http://groups.google.com/group/comp.programming.threads/browse_frm/thread/a0966697738790c4/"></a><a href="http://groups.google.com/group/comp.programming.threads/browse_frm/thread/a0966697738790c4/">http://groups.google.com/group/comp.programming.threads/browse_frm/thread/a0966697738790c4/</a><br /><br />you can get composability with POSIX mutexs and condition variables. The video did not mention any major alternatives’. Unimpressed.<br /><br />“You also seemed to have misunderstood my point about using STM in purely functional programming because I can't make sense of your response to that. You're not making the erronous assumption that &quot;purely functional programming == no mutable data&quot; do you?”<br /><br />You abstract the shared memory away so much that all of its advantages are rendered useless by all of the massive amounts of coherency traffic that the TM generates.</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000484570000000</link>
		<pubDate>Sat, 25 Nov 2006 10:47:37 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000484570000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>The video mentions overheads, and seems to fall back on the good ol’ saying:<br /><br /></p>
<p>“Oh well, we will wait for hardware support”<br /><br />Man… TM on the hardware is a no go.<br /><br />The cache coherency mechanism that could properly support a robust transactional memory scheme would have to be really strict IMHO... Think of scenarios in which there could be lots of reader threads iterating over large shared linked data-structures in parallel...
 The transactional coherency system could potentially wind up having to track all of those many thousands of reads transactions' that will be generated my the frequently reading threads... It would die from livelock; ahh the explicit contention manager to the
 rescue! So, when the times get tough for TM, it basically is forced to fold under its security blanket, and wait for things to cool way down for a while... This is because TM is kind of like obstruction free algorithms... One small trivial interference from
 another thread, and the operations dies and asks the contention manager if it can retry... I don't think TM can scale very well at all wrt the previous scenarios that I briefly described...<br /><br />That is a lot of work for a synchronization instruction... Whatever happened to plain old CAS!<br /><br />:O<br /><br />IMHO, they have to implement transactional memory in the hardware if they want it to be even remotely usable. I can make use of a transactional instruction in vZOOM, however I would try to avoid its use at all costs...<br /><br />The transactional instructions have simply got to be more expensive than a &quot;normal&quot; CAS or LL/SC... I would not allow my reader threads to use the transaction instructions when they are traversing through large data-structures. This is not because I don't like
 TM; I don't let my reader threads use CAS, or any atomic operations for that matter... Reader threads don't seem to like to call these types of instructions. The amount of searches' they can perform per-second getschanges drastically when CAS and/or memory
 barriers are used. I could only imagine the overhead involved with many reader threads frequentlysearching/traversing throughout a data-structure that has hundreds-of-thousands or evenmillion&#43; nodes during periods of load. Design a TM can be tedious.<br /><br />My main problem with TM is that reader threads have to call into the transaction api before they traverse a data-structure. In most cases every read has to be tracked; validating at the page-level is too coarse. If they end up traversing tens-of-thousands of
 nodes, that's a lot of checking/validating. If the application is under load, and writer threads modify the page of memory that a reader thread happens to be reading from
<br />seems to raise a red-flag in the presented algorithm. Then the validation process has to drill down on the page, to enhance transaction granularity. If alls that it takes is a simple store into the page to abort a transaction, then live-lock can and should
 occur... So they have to get more fine grain than a page...<br /><br />Cache-coherency protocol deals with transaction that fit into cache line... Humm, this may make the protocol too complex/strong. I am NOT to a big fan of extremely strong cache. t a shame than TM might be responsible this nosense with the strong cache. I want
 an architecture very weak cache coherency, with crystal clear memory model documentation. I would be fine with the Alpha. But STM on an Alpha would be a joke. Heck, can’t even use it for any sort of distributed algorithms either.<br /><br />Any thoughts?</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000525810000000</link>
		<pubDate>Sat, 25 Nov 2006 11:56:21 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000525810000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>I really think you're not really trying to see the point here. It also seems that you may have a financial interest in not seeing the point. Which makes arguing with you pretty much a waste of time.<br /><br />Look at the video again. They specifically say that skilled programmers can use existing techniques to write correct code - they're not claiming that it's not possible to work around the difficulties of multi threaded programming with existing techniques. The
 point here, though, is that it <em>is</em> difficult. Your own posts is are a case in point. Why are you so proud of your inventions of various lock-free data structures if it's so easy? Because it isn't very easy, which is the whole reason for why you want
 STM instead. <br />Getting everything right with locks or lock-free programming techniques is difficult - if you're selling software based on this I can understand why you would argue otherwise, but I'm not going to waste my time arguing against a paycheck (everyone whose salary
 isn't based on pretending it's easy will agree that it's difficult). Not impossible, but difficult. Your argument that it's possible to use other strategies is completely pointless. It's possible to write a full comercial business application using nothing
 but assembly as well, but is it practical? No not really, and as concurrency becomes more common using the sophisticated and clever lock-free programming techniques will stop being practical as well.<br /><br />Also, I don't think you're using the word &quot;composability&quot; in the same way I am (nor indeed the way they use it in the video). E.g. my point is that if you have language support for STM, you take a hash table, then you can do the operation &quot;remove A insert B&quot;
 without leaving the intermediate state visible (then you can do that in combination with other techniques, without leaving any intermediate states visible). If the hashtable is written using lock free and/or lock based&nbsp;abstractions to be thread safe for insertions
 and deletions, that still doesn't mean you can do the operation you want in an atomic way.
<br />What if I want to read 4 elements, or none at all, from your nice lock free FIFO queue? What if I want to do that operation on two different FIFOs (from different vendors), or none at all? What if I want to combine
<em>that</em> with some operations of my own, or do none at all?<br />STM&nbsp;<em>composes</em> because you can create new concurrency abstractions from existing ones without having to have access to the source code of the original abstractions.
</p>
<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000527560000000</link>
		<pubDate>Sat, 25 Nov 2006 11:59:16 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000527560000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>cristom wrote:</div>
<div>&#65279;<br />IMHO, they have to implement transactional memory in the hardware if they want it to be even remotely usable.
</div>
</blockquote>
<br /><br />Meanwhile, Haskell programmers have been &quot;using&quot; (!= usable?) STM for quite a while now and found it quite neat.<br />You're pitting STM up against lock free data structures in very simple cases, but who says you HAVE to use STM in those cases? You would use STM in cases where there are complex interaction patterns with the shared data where simple lock free structures don't
 work as well. Using e.g. a transactional message queue between two threads when there is no need for atomic&nbsp;transactions is something you wouldn't do if you're concerned for performance.<br />And again, this is not something that would work well with C, it works well with a paradigm which is more suited for multitheading in the first place (FP) because the number of places where you need to even worry about shared state is very limited.<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000533960000000</link>
		<pubDate>Sat, 25 Nov 2006 12:09:56 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000533960000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>For those who don't follow links, here are some important snippets from some of them:</p>
<p><br />&gt; I am wondering where RW locks are appropriate ?? </p>
<p><br />Basically, they work fairly well with &quot;read-mostly&quot; data-structures. If you <br />don't really care about performance and scalability, then most rw-mutex <br />implementations should work perfectly fine; however, in some cases they are <br />definitely not an &quot;optimal solution&quot;. For instance, IMHO a rw-mutex would <br />probably not be an ideal candidate for protecting a &quot;critical shared <br />collection&quot; than can experience episodic periods of sustained <br />&quot;moderate-to-heavy write activity&quot;. Reader threads that use rw-mutexs to <br />protect such a container would probably not perform and/or scale very well <br />at all with regard to adding cpus. One of the reasons why is usually due to <br />the fact that most rw-mutex implementations force reader threads to use some <br />rather expensive atomic/membar/blocking methods in order to enforce <br />synchronization and proper data-coherency among the participating <br />processors; this is not very cache friendly, not at all. Reader threads <br />would not really be able to keep the processors &quot;caches primed&quot; and probably <br />would not experience the full benefits of a modern multi-processor system. <br />For instance, a reader thread that &quot;frequently&quot; executes a store/load style <br />membar would constantly be &quot;invalidating and thrashing the cache&quot;; not good <br />at all! The thread could spend most of its time &quot;waiting&quot; for the <br />modifications to the &quot;rw-mutexs internal state&quot; to become &quot;fully visible&quot; to <br />all of processors involved. This process is usually made up of fairly <br />expensive operation(s) that may involve the overhead of cache snooping <br />and/or locking the system bus. The overhead involved could actually prevent <br />reader threads from truly exeuting in parallel; not good. </p>
<p>Therefore, IMHO, a rw-mutex is generally a bad solution for a critical <br />shared data-structure if the overhead of acquiring and releasing it is <br />greater than the overhead of &quot;reading the data-structure in a <br />single-threaded application&quot;... </p>
<p>&nbsp;</p>
<p>&gt; is it appropriate when only you don't want 'dirty' reads?? </p>
<p><br />Not really, but yes they do eliminate the possibility of processing &quot;stale <br />data&quot;; however, as stated above the methods involved are usually expensive. <br />Fortunately, there is a more advanced class of algorithms out there that do <br />not tend to add a boatload of extra overhead and can allow reader and writer <br />threads to execute in parallel. Please note that this behavior alone can be <br />beneficial to many application designs. For instance, since readers no <br />longer block writers an existing synchronization design can usually be based <br />on a &quot;much simpler locking scheme&quot;; however, stale reads can and will occur <br />in this type of setup. Luckily, one can address stale/dirty reads in a <br />number of interesting ways: </p>
<p><a href="http://groups.google.com/group/comp.programming.threads/msg/523aa1e77">http://groups.google.com/group/comp.programming.threads/msg/523aa1e77</a>...
</p>
<p><br />Another solution for stale reads involves writer threads making copies of <br />existing shared data-structures and then atomically swapping them with the <br />existing ones. A garbage collection scheme can be used to free the &quot;old&quot; <br />data-structures. This solution does not add overhead to reader threads, <br />unless, the method of garbage collection used is sub-optimal... </p>
<p>&nbsp;</p>
<p><br />&quot;John Hickin&quot; &lt;<a href="mailto:hic...@nortelnetworks.com">hic...@nortelnetworks.com</a>&gt; wrote in message
</p>
<p><br /><a>news:ec4u46$hvv$1@zcars129.ca.nortel.com</a>... </p>
<p><br />&gt; &quot;David Schwartz&quot; &lt;<a href="mailto:dav...@webmaster.com">dav...@webmaster.com</a>&gt; wrote in message
<br />&gt; <a>news:1155889979.905637.238660@i42g2000cwa.googlegroups.com</a>... <br />[...] </p>
<p><a href="http://www.computer.org/portal/site/computer/menuitem.5d61c1d591162e4b0ef1bd108bcd45f3/index.jsp?&amp;pName=computer_level1_article&amp;TheCat=1005&amp;path=computer/homepage/0506&amp;file=cover.xml&amp;xsl=article.xsl">http://www.computer.org/portal/site/computer/menuitem.5d61c1d591162e4b0ef1bd108bcd45f3/index.jsp?&amp;pName=computer_level1_article&amp;TheCat=1005&amp;path=computer/homepage/0506&amp;file=cover.xml&amp;xsl=article.xsl</a>&amp;<br />(&quot;The Problem with Threads&quot; - IEEE's Computer magazine article)</p>
<p><br />&gt; This example is quite good and it explains what I don't like with threads. <br />&gt; In the real world, 8 of the 10 people in your example will go on to do <br />&gt; something else. In a multi-threaded world, 8 threads are blocked. </p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.programming.threads/msg/a3e38e27d">http://groups.google.com/group/comp.programming.threads/msg/a3e38e27d</a>...
<br />( refer to the pseudo-code at the bottom of the msg ) </p>
<p>Any thoughts? </p>
<p>&nbsp;</p>
<p>&gt; Unless, of <br />&gt; course, you use some sort of lock-free algorithm. Unless I've missed the <br />&gt; mark, lock-free is quite avant guard, and not taught at the undergraduate <br />&gt; level. It may be time for a change there. </p>
<p><br />Totally agreed: </p>
<p><a href="http://groups.google.com/group/comp.lang.c&#43;&#43;.moderated/msg/d07b79e963">http://groups.google.com/group/comp.lang.c&#43;&#43;.moderated/msg/d07b79e963</a>...
</p>
<p><br />FWIW: </p>
<p><br />I don't agree with the commonly assertion that lock-free programming is far <br />to complicate for a &quot;normal&quot; programmer to learn. </p>
<p><br />I also don't agree with the assertion that threads are vastly too difficulty <br />and fragile for any programmer to use... The paper the OP linked to seems to <br />attempt to make this type of assertion. </p>
<p>&nbsp;</p>
<p>&gt; Anyway, the article was interesting to read. The author is an IEEE Fellow, <br />&gt; and you don't get that designation without earning it. </p>
<p>&nbsp;</p>
<p>Humm... Did you read the part where is basically says that programmers that <br />use threads are insane? He points to a &quot;folk saying&quot;, </p>
<p>'repeatedly performing the same action and expecting different results <br />defines a form of insanity' <br />(paraphrase) </p>
<p><br />The he says this, again paraphrasing </p>
<p><br />'if programmers that use threads were not insane, they simply would not be <br />able to understand any of their programs' </p>
<p><br />I wonder if he was being serious... Anyway.... </p>
<p><br />Yikes! I guess that I am INSANE!!!!!!!!! <br />YeeeHaw.... Weeeee..... </p>
<p><br /><img src='http://ecn.channel9.msdn.com/o9/content/images/emoticons/emotion-5.gif' alt='Wink' /> </p>
<p><br />I find it amusing that the IEEE Fellow seems to not be able to create a <br />thread-safe observer pattern... I have several lock-free observer patterns <br />that can rely on my vZOOM or Joe Seighs RCU-SMR algorithms. </p>
<p><br />For some reason, I don't think that the author could create a highly <br />scaleable thread-safe, lock-based or lock-free, observer pattern <br />implementation if his life depended on it??? </p>
<p><br />:O </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br />(simply EXECELLENT Wheeler posts!!!)</p>
<p><br />&quot;Chris Thomasson&quot; &lt;<a href="mailto:_no_spam_cristom@no_spam_comcast._net">_no_spam_cristom@no_spam_comcast._net</a>&gt; writes:
<br />&gt; IMHO, I believe its too early in the game for actual hardware <br />&gt; support, even though they really do need it in order for TM to <br />&gt; become really useful. All of the software emulations I have seen are <br />&gt; loaded with expensive atomic operations; mutexs seem more <br />&gt; efficient... </p>
<p><br />original 801 had a form ... it was used by journal filesystem <br />for aix in rs/6000. </p>
<p>filesystem metadata was organized ... and the memory system caught all <br />changes ... so basically you avoided having to do all the explicit <br />logging/locking statements in the filesystem code ... you did have to <br />add commit calls. </p>
<p><br />there was some disagreement whether the overhead of explicit <br />logs/locks were more expensive than the implicit overhead involved in <br />transaction memory. turns out there was the overhead of scanning the <br />whole memory area for changes at commits. </p>
<p><br />a portable version of the journal filesystem code with explicit <br />lock/logging changes in the code turned up the explicit lock/logging <br />calls had lower overhead than transactional memory (at least in the <br />journal filesystem case). </p>
<p><br />and unrelated old reference from about same period as aixv3 ... the <br />Proceedings of the 20th International Symposium on Fault-Tolerant <br />Computing Systems, pp 89--96, Newcastle, June 1990. </p>
<p><br />A Fault Tolerant Tightly Coupled Multiprocessor Architecture based on <br />Stable Transactional Memory </p>
<p><br />Authors: Michel Banatre and Philippe Joubert <br />Abstract: </p>
<p><br />Traditionally, tightly coupled multiprocessors allow data sharing <br />between multiple caches by keeping cached copies of memory blocks <br />coherent with respect to shared memory. This is difficult to achieve <br />in a fault tolerant environment due to the need to save global <br />checkpoints in shared memory from where consistent cache states can be <br />recovered after a failure. </p>
<p><br />The architecture presented in this report solves this problem by <br />encapsulating the memory modifications done by a process into an <br />atomic transaction. Caches record dependencies between the <br />transactions associated with processes modifying the same memory <br />blocks. Dependent transactions may then be atomically committed. Such <br />an operation requires a cache coherence protocol responsible for <br />recording process dependencies as well as keeping coherent cached <br />copies of blocks and a shared Stable Transactional Memory owing to <br />which all memory updates are atomic to allow recovery after a <br />processor failure. </p>
<p><br />-- <br />Anne &amp; Lynn Wheeler | <a href="http://www.garlic.com/~lynn/">http://www.garlic.com/~lynn/</a>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&quot;Chris Thomasson&quot; &lt;<a href="mailto:cris...@comcast.net">cris...@comcast.net</a>&gt; writes:
<br />&gt; Good point. Do you happen to know if they implemented it so they could <br />&gt; successfully pop from a lock-free stack? I wonder.... </p>
<p><br />charlie had invented compare&amp;swap as part of his work on fine-grain <br />locking (leading to some number of lock free operations) for cp67 <br />(360/67) mutliprocessor support at the science center <br /><a href="http://www.garlic.com/~lynn/subtopic.html#545tech">http://www.garlic.com/~lynn/subtopic.html#545tech</a>
</p>
<p>the trick then was to come up with a mnemonic that matched Charlie' <br />initials, CAS. </p>
<p><br />the attempt was then made to get the instruction into the up and <br />coming 370 architecture. working with ron smith in the pok 370 <br />architecture group (they owned the 370 architecture &quot;red book&quot;), the <br />response was that 370 didn't need another multiprocessor specific <br />instruction, that the test and set from 360 was sufficient.&nbsp;&nbsp; </p>
<p><br />to get compare and swap into the 370 architecture we had to come up <br />with useage for compare&amp;swap that wasn't multiprocessor specific. <br />thus was born some number of examples that were applicable to <br />multi-threaded applications that might be running enabled for <br />interrupts ... independent of whether the machine was single processor <br />or multiprocessor. </p>
<p><br />originally in the 370 principles of operation, the examples were part <br />of the programming notes that were part of the compare&amp;swap <br />instruction. in subsequent version of the principle of operations the <br />examples were moved to a section in the appendix. </p>
<p><br />also as part of this activity, compare&amp;swap double instruction was <br />added in addition to compar&amp;swap. that resulted in two instructions <br />for 370, compare&amp;swap along with compare&amp;swap double ...&nbsp; so the <br />instruction mnemonics become CS and CDS (instead of CAS ... defeating <br />the original objective of coming up with instruction name <br />compare&amp;swap). </p>
<p><br />total topic drift ... science center was like that ... GML <br /><a href="http://www.garlic.com/~lynn/subtopic.html#sgml">http://www.garlic.com/~lynn/subtopic.html#sgml</a>
</p>
<p><br />precusor to SGML, HTML, XML, etc ... also invented at the science <br />center, actually are the first initials of the last name of the three <br />inventors (and you probably thot it stood for generalized markup <br />language). </p>
<p><br />misc. past posts on multiprocessor support and/or compare&amp;swap <br />instruction <br /><a href="http://www.garlic.com/~lynn/subtopic.html#smp">http://www.garlic.com/~lynn/subtopic.html#smp</a>
</p>
<p><br />esa/390 principles of operation appendix for multiprogramming <br />(i.e. multithread) and multiprocessing <br /><a href="http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A">http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A</a>...
</p>
<p><br />cs &amp; cds appendix: <br /><a href="http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A">http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A</a>...
</p>
<p><br />bypassing post and wait <br /><a href="http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A">http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A</a>...
</p>
<p><br />lock/unlock: <br /><a href="http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A">http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A</a>...
</p>
<p><br />free pool manipulation <br /><a href="http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A">http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9AR004/A</a>...
</p>
<p><br />and more recent z/architecture (64-bit) principles of operation <br />multiprogramming and multiprocessing examples appendix <br /><a href="http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9ZR003/A">http://publibz.boulder.ibm.com/cgi-bin/bookmgr_OS390/BOOKS/DZ9ZR003/A</a>...
</p>
<p><br />note that the above also includes discussion of the newer PLO ...perform lock <br />operation instruction </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>-- <br />Anne &amp; Lynn Wheeler | <a href="http://www.garlic.com/~lynn/">http://www.garlic.com/~lynn/</a>
</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>- conversation with Andy...</p>
<p><a href="http://groups.google.com/group/comp.arch/browse_frm/thread/71f8e0094e353e5/a3ebfe80363a4399?lnk=gst&amp;q=why&#43;do&#43;double&#43;wide&#43;compare&#43;and&#43;swap&amp;rnum=1#a3ebfe80363a4399">http://groups.google.com/group/comp.arch/browse_frm/thread/71f8e0094e353e5/a3ebfe80363a4399?lnk=gst&amp;q=why&#43;do&#43;double&#43;wide&#43;compare&#43;and&#43;swap&amp;rnum=1#a3ebfe80363a4399</a></p>
<p>&nbsp;</p>
<p>&quot;Andy Glew&quot; &lt;<a href="mailto:first.l...@employer.domain">first.l...@employer.domain</a>&gt; wrote in message
</p>
<p><br /><a>news:peyp8xnzl9g2.fsf@PXPL8591.amr.corp.intel.com</a>... </p>
<p><br />&gt;&gt; &gt; Are there a rule of thumb as to when LL/SC starts showing <br />&gt;&gt; &gt; scalability issues? </p>
<p>&gt;&gt; IMHO there is no rule of thumb. Scalability issues are not typically <br />&gt;&gt; induced by LL/SC itself. </p>
<p><br />&gt; I disagree. </p>
<p><br />&gt; Although maybe it's not really scalability issues.&nbsp; LL/SC starts <br />&gt; introducing deadlock / forward progress issues the moment you have <br />&gt; more than one processor on any interconnect that is not a simple <br />&gt; snoopy bus, and they just get worse as you add more, and have more <br />&gt; complicated interconnects. </p>
<p>&nbsp;</p>
<p>Something like this?: </p>
<p><a href="http://groups.google.com/group/comp.arch/msg/d40cf092b679169d">http://groups.google.com/group/comp.arch/msg/d40cf092b679169d</a>
</p>
<p><br />Coarse reservation granularity can cause live-lock in LL/SC via. simple <br />false-sharing. I really do believe that HTM is going to suffer from the same <br />thing... Multiple processors can live-lock if they keep interfering with the <br />reservations that track the TM. </p>
<p><br />Humm... Kind of like the live-lock that is inherent in any obstruction-free <br />algorithm; they need to use &quot;backoff-and-retry&quot; algorithms to keep up <br />forward-progress... </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Good response post form Intel Architect Andy Glew:</p>
<p><br />&gt; Humm... Kind of like the live-lock that is inherent in any obstruction-free <br />&gt; algorithm; they need to use &quot;backoff-and-retry&quot; algorithms to keep up <br />&gt; forward-progress... </p>
<p><br />Yeah, I was thinking of correcting my older post to try to get to this. </p>
<p>It is not fundamentally LL/SC vs. CAS and other atomic RMWs. </p>
<p><br />It is more that LL/SC was originally proposed and implemented via an <br />&quot;optimistic concurrency&quot; type of address &quot;link&quot;, whereas CAS and other <br />atomic RMWs are traditionally implemented via a &quot;lock&quot; - whether bus <br />lock, cache lock, or address lock. </p>
<p><br />If other people try to access the lock while the RMW is in flight they <br />are stalled or told to go away, come back later. This guarantees <br />forward progress. </p>
<p><br />Whereas if other people access the link between the LL and SC, it is <br />the SC that fails. In the presence of an adversary doing ordinary <br />stores, the LL/SC might never complete. </p>
<p><br />But these are just implementation artifacts.&nbsp; E.g. you can implement <br />CAS or an atomic RMW with LL/SC, whether in user code or microcode - <br />and such an RMW would have the same forward progress problems as <br />LL/SC. You can implement a hybrid - try the optimistic concurreny <br />approach first, and then try the lock approach. </p>
<p><br />Similarly, you can implement LL/SC by acquiring a lock, guaranteeing <br />that the SC will finish.&nbsp; But then you need some way of backing out, <br />protecting yourself against a malicious user who does the LL but never <br />the SC. E.g. the Intel 860 released such a lock after 32 instructions. </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><br />Chris Thomasson wrote: <br />&gt; &quot;Joe Seigh&quot; &lt;<a href="mailto:jseigh...@xemaps.com">jseigh...@xemaps.com</a>&gt; wrote
<br />&gt;&gt;What's with the Sparc architects? </p>
<p>&gt; IMHO, I believe the major reason 32-bit architectures support DWCAS was to <br />&gt; be &quot;64-bit ready&quot;; DWCAS gets converted to normal CAS on 64-bit systems. So, <br />&gt; if your 32-bit applications used DWCAS, then they can be run 64-bit arch <br />&gt; without changes... Of course there is a caveat... </p>
<p><br />&gt; A 32-bit application cannot use DWCAS to manipulate a pointer along with <br />&gt; another contiguous variable... </p>
<p><br />&gt; struct dosent_work_on_64_bit_s { <br />&gt;&nbsp;&nbsp; void *a; <br />&gt;&nbsp;&nbsp; whatever b; <br />&gt; }; </p>
<p><br />&gt; IMO, the hardware architects' did NOT have lock-free algorithms in mind when <br />&gt; they decided to put DWCAS in their 32-bit instruction sets. The fact that <br />&gt; 128-bit CAS is not reliably supported seems to support my opinion... </p>
<p>&nbsp;</p>
<p>IBM S370 had double wide compare and swap long before 64 bit support <br />became an issue. </p>
<p><br />&gt;&gt;There's a bit of a disconnect here I think. </p>
<p><br />&gt; Perhaps they are designing the lock-free algorithms for a upcoming processor <br />&gt; design. Maybe one that has hardware transactional memory... That could be <br />&gt; the reason they designed KCSS: </p>
<p>&nbsp;</p>
<p>They've done a bit on STM (software transactional memory).&nbsp; If they did <br />come out with hardware based transactional memory it would be after the <br />fact of 64 bit sparc and wouldn't be generally available.&nbsp; So it would <br />have to be hidden behind some system or library api with alternate <br />implementations on non TM platforms.&nbsp; That would limit its applicability. <br />For example, you couldn't have atomically thread-safe refcounted smart <br />pointers.&nbsp; Well, not without RCU and/or SMR.&nbsp; If they go with STM to <br />compliment hw TM, it's only going to work at a lower contention level <br />if the STM algorihtm is only obstruction-free. </p>
<p>It's a big problem.&nbsp; You can design efficient synchronization mechanisms <br />that are portable if you ignore Sparc.&nbsp; If you want portability to <br />Sparc you have to sacrifice performance or functionality. </p>
<p><br />If Sun has a 64 bit JVM implementation, I wonder what they do for <br />the AtomicMarkedReference and AtomicStampedReference implementations <br />for non Sparc platforms.&nbsp; Cripple them so they perform as poorly as <br />the Sparc implementations? </p>
<p><br />-- <br />Joe Seigh </p>
<p><br />When you get lemons, you make lemonade. <br />When you get hardware, you make software. </p>
<p>&nbsp;</p>
<p><br />Text taken from:</p>
<p><br /><a href="http://groups.google.com/group/comp.arch/msg/e1e391055c7acecb">http://groups.google.com/group/comp.arch/msg/e1e391055c7acecb</a></p>
<p><a href="http://groups.google.com/group/comp.programming.threads/browse_frm/thread/9c572b709248ae64">http://groups.google.com/group/comp.programming.threads/browse_frm/thread/9c572b709248ae64</a></p>
<p><a href="http://groups.google.com/group/comp.programming.threads/browse_frm/thread/f6399b3b837b0a40">http://groups.google.com/group/comp.programming.threads/browse_frm/thread/f6399b3b837b0a40</a></p>
<p><a href="http://groups.google.com/group/comp.arch/msg/1b9e405080e93149">http://groups.google.com/group/comp.arch/msg/1b9e405080e93149</a></p>
<p><a href="http://groups.google.com/group/comp.arch/msg/bbbc035cf1a8502c">http://groups.google.com/group/comp.arch/msg/bbbc035cf1a8502c</a></p>
<p><a href="http://groups.google.com/group/comp.arch/msg/11b14c4bda2d5d82">http://groups.google.com/group/comp.arch/msg/11b14c4bda2d5d82</a></p>
<p><a href="http://groups.google.com/group/comp.arch/msg/9b00fda2752966f9">http://groups.google.com/group/comp.arch/msg/9b00fda2752966f9</a></p>
<p><a href="http://groups.google.com/group/comp.arch/msg/335aeb22fd6fe526">http://groups.google.com/group/comp.arch/msg/335aeb22fd6fe526</a></p>
<p><a href="http://groups.google.com/group/comp.arch/msg/1ace9400b1b16cd4">http://groups.google.com/group/comp.arch/msg/1ace9400b1b16cd4</a></p>
<p><a href="http://groups.google.com/group/comp.arch/msg/995379a16beb3b69">http://groups.google.com/group/comp.arch/msg/995379a16beb3b69</a><br />(simply excellent Wheeler post)</p>
<p>and more...<br /><br />Any thoughts?<br />;^)</p>
<p>&nbsp;</p>
<p><br />&nbsp;</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000538040000000</link>
		<pubDate>Sat, 25 Nov 2006 12:16:44 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000538040000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>cristom wrote:</div>
<div>&#65279;
<p>For those who don't follow links, here are some important snippets from some of them:<br /></p>
<br />SNIP!<br /><br /></div>
</blockquote>
<br /><br />Okay, this is only slightly less annoying/insulting than&nbsp;outright spam. Clicking links was not the problem, having to deduce your points from multiple related discussions, was. You're not that important to me. I don't care about you enough to read everything
 you've posted on related subjects and from there figure out where you stand on <em>
this</em> issue.<br /><br />If you have a specific point that has to do with STM, please make it. If you have a specific point to anything someone else posted here, please make it.<br />If, however, you don't feel like you have time and energy&nbsp;to extend the common courtesy of doing so in a coherent way&nbsp;by formulating it specifically for this discussion, in a way which flows naturally together with the topic of discussion, then please note
 that posting here is completely volontary.<br /><br />Also, please note that examples are not proof. Yes there are, as said many times already, cases where STM will be slower than other methods, but listing them is completely irrelevant. The point here is that there are plenty of cases where STM helps out a lot,
 and is probaby the only practical way of writing software in certain circumstances. E.g. let's say you have a game world, and 10000 game objects that interact with it in complex and data dependent ways (i.e. there is no way to partition the world into lockable
 regions). Each of these objects interact with about half a dozen of the other objects, and they do so concurrently, and the interactions must be atomic. How do you solve that with lock free data structures? The game world consists of multiple different data
 structures nested in complex ways (oct-trees, portal cell graphs, BSP trees, etc.). How do you solve it with locks? You really don't, unless you stick a big lock on the entire world, or use some global locking order or something equally detrimental to composability
 and productivity. STM in this case &quot;Just Works&quot;.<br /><br />Yeah, STM for a FIFO is overkill, but showing how a non-STM implementation of a FIFO is faster than an STM based one does not prove that STM is a waste of time. Again, you're pitting STM up against other approaches only in very simple cases, which proves exactly
 nothing.<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000553250000000</link>
		<pubDate>Sat, 25 Nov 2006 12:42:05 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000553250000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>&quot;I really think you're not really trying to see the point here. It also seems that you may have a financial interest in not seeing the point. Which makes arguing with you pretty much a waste of time.&quot;</p>
<p>IMHO, STM is a deceptive marking ploy. They never get into the alternatives’. BTW, I mention many different ways to do things. I did not just refer you to my vZOOM algorithm; I also refer you to Joe Seighs RCU&#43;SMR algorithm, and some others. So you wrong
 again… Unlike the video, I point out all of the caveats, and explain them in detail.</p>
<p>&nbsp;</p>
<p><br />&quot;Look at the video again. They specifically say that skilled programmers can use existing techniques to write correct code - they're not claiming that it's not possible to work around the difficulties of multi threaded programming with existing techniques.
 The point here, though, is that it is difficult. Your own posts is are a case in point. Why are you so proud of your inventions of various lock-free data structures if it's so easy?&quot;</p>
<p>The complexity can be hidden behind a simple and portable API, that anybody can use. Like the pthreads api. We all know that a particular pthread implementation may be very complex, and may very well use some lock-free algorithms. But, does the average user
 actually care about this kind of stuff? My point is, again &quot;The complexity can be hidden behind a simple API&quot;. Really.
</p>
<p>Would there be bugs... Well, maybe; it depends on the implementer. There may be very subtle bugs in your pthread implementation as well...
</p>
<p>&nbsp;</p>
<p>&quot;Because it isn't very easy, which is the whole reason for why you want STM instead.&quot;</p>
<p>No. STM is NOT a good solution if you’re interested in execellent scalability and performance.</p>
<p><br />&quot;Getting everything right with locks or lock-free programming techniques is difficult - if you're selling software based on this I can understand why you would argue otherwise, but I'm not going to waste my time arguing against a paycheck (everyone whose salary
 isn't based on pretending it's easy will agree that it's difficult). Not impossible, but difficult. Your argument that it's possible to use other strategies is completely pointless. It's possible to write a full comercial business application using nothing
 but assembly as well, but is it practical? No not really, and as concurrency becomes more common using the sophisticated and clever lock-free programming techniques will stop being practical as well.&quot;</p>
<p>Utter nonsense. The power of lock-free programming techniques will be in demand. Man. Concurrency has been common for a very long time now. Ever heard of RCU? Heck, this stuff, including STM and HTM has been around for the past 25 years at least. Don't try
 to act like this is something new. Lock-free has been around for ages, and it not going to go out of practice. Its going to be in demand. That is, if you want your application to have excellent scalability and throughput characteristics</p>
<p>&nbsp;</p>
<p><br />&quot;What if I want to read 4 elements, or none at all, from your nice lock free FIFO queue?&quot;</p>
<p>Simple, you use an eventcount.</p>
<p>&nbsp;</p>
<p><br />&quot;What if I want to do that operation on two different FIFOs &gt; (from different vendors), or none at all? What if I want to combine that with some operations of my&nbsp; &gt; own, or do none at all?&quot;</p>
<p><br />This is example of bad programming practice. Having to force things together is a sign that there is a MUCH better way. The overhead involved with your request is too great. Again, I urge to you to post to comp.programming.theads and comp.arch. Please.
<br />Anyway, you can use the eventcount to add fine-grain ultra low-overhead conditional blocking and coordination of your data with lock-free collections. Too much to post here. The technique deserves its own thread. STM can’t compare with this wrt scalability;
 its dead in the water. The performance increases of most alternatives to STM are usually an order of magnitude.</p>
<p>&nbsp;</p>
<p>&quot;STM composes because you can create new concurrency abstractions from existing ones without having to have access to the source code of the original abstractions.&quot;</p>
<p>I am not willing to sacrifice my server applications performance. Sorry, not sold.<br /></p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000553430000000</link>
		<pubDate>Sat, 25 Nov 2006 12:42:23 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000553430000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>C is fine. You can create STM implementation in C/Assembly. Just follow the rules:</p>
<p>&nbsp;</p>
<p><a href="http://groups-beta.google.com/group/comp.programming.threads/msg/423df394a0370fa6">http&#58;&#47;&#47;groups-beta.google.com&#47;group&#47;comp.programming.threads&#47;msg&#47;423df394a0370fa6</a></p>
<p>&nbsp;</p>
<p>Okay… If I had to use STM, I would use it in C, not Haskell. Humm, I have created experimental STM that try to get around some of the overheads. Still not sure I want to Patent it or not. Perhaps I should patent it, and sell it as a much faster alternative
 to most of the STM implementations’. Humm. A couple of implementations of mine beat Haskell by a wide margin. Indeed.</p>
<p>&nbsp;</p>
<p>Okay… If I can’t convince you the STM is not a good solution at all… How would you feel about using a STM algorithm with a pure C interface? I have several solutions. I created them way back when I was experimenting/inventing my vZOOM algorithm. I needed
 something to test it against. I was very disappointed with every STM implementation out there. So, I invented a couple of new ways to implement STM… I guess if STM is going to be rammed down programmer’s throats, I might as well get the experimental prototypes’
 and post them here…</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>I have 2 STM word-based implementations. One is written is about 75% IA-32 assembly language, and the other is in about 90% SPARC V9 assembly language… The all have C API/ABI. Standard transaction API (e.g., begin, load, store, commit, abort, validate),
 and they all outperform Haskel.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Interested?</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000566190000000</link>
		<pubDate>Sat, 25 Nov 2006 13:03:39 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000566190000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>cristom wrote:</div>
<div>&#65279;<br />I am not willing to sacrifice my server applications performance. Sorry, not sold.<br /></div>
</blockquote>
<br /><br />And you don't have to.&nbsp;Writing a web server probably doesn't require STM at all.<br /><br />The whole point here is, again, that you take some very simple cases say &quot;X is faster than STM in case x, Y is faster than STM in case y&quot; and you ignore all the difficult cases alltogether, or the fact that STM is an easy to use technology which Just Works
 for both x and y without having to do anything special&nbsp;(again, nobody has claimed that it isn't possible to write multithreaded programs without STM, please try to understand that very important point).<br /><br />Embarassingly parallel applications (like e.g. a web sever) are not hard to write, and you can get a way with very light weight abstractions that are very fast indeed. But try writing, say, a game engine which scales to hundreds or thousands of threads and
 you'll understand that a couple of clever lock-free data structures is not a viable solution for parallellizing problems
<em>in general</em>.<br />Again, if you're going to compare against &quot;alternatives&quot;, please do so in an intellectually honest way, rather than cherry picking specific examples where there are existing data structures that work well. The whole point here was that with STM it's all of
 a sudden a reasonable proposition to split something like a game engine up into hundreds and thousands of threads - something which is very difficult to do without something as general and flexible.<br /><br />Your argument is akin to someone arguing that assembly is better than C because a couple of small programs he's written were faster when written in hand tuned assembly than when compiled with a C compiler. It might be true, but that doesn't mean assembly is
 a better choice in general. For sufficiently large applications you're not going to be able to do any meassuring of the difference in performance, because only one of the version will actually run properly (the one which sacrifices speed for usability).<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000567820000000</link>
		<pubDate>Sat, 25 Nov 2006 13:06:22 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000567820000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>cristom wrote:</div>
<div>&#65279;
<p>C is fine. You can create STM implementation in C/Assembly. </p>
<p>&nbsp;</p>
<p>...<br /></p>
<p>Interested?</p>
</div>
</blockquote>
<br /><br />Actually I'm really not. I've posted twice why I don't think this makes sense in an imperative language. I would recommend you post it and point it in the direction of Simpon Peyton Jones and Tim Harris though. If your implementation really is as good as you
 say, and it does what the Haskell one does, I'm sure they will be willing to do it your way instead.<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000571250000000</link>
		<pubDate>Sat, 25 Nov 2006 13:12:05 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000571250000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>&quot;And you don't have to. Writing a web server probably doesn't require STM at all.&quot;</p>
<p>&nbsp;</p>
<p>I am mostly talking about database servers the make heavy use of shared memory for fast-pathing database queries. I can traverse mutable data-structures with atomic operations and/or memory barriers. Again, this is impossible with STM. Using STM would make
 that fast-path run very slow because of the vast amount of coherency traffic that the TM logic generates.</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000571740000000</link>
		<pubDate>Sat, 25 Nov 2006 13:12:54 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000571740000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>ACK!!!</p>
<p>&nbsp;</p>
<p>&quot;I am mostly talking about database servers the make heavy use of shared memory for fast-pathing database queries. I can traverse mutable data-structures with atomic operations and/or memory barriers. &quot;<br /><br />Is suppose to read as:<br /><br /></p>
<p>I am mostly talking about database servers the make heavy use of shared memory for fast-pathing database queries. I can traverse mutable data-structures&nbsp;&quot;WITHOUT&quot;&nbsp;atomic operations and/or memory barriers.
<br /><br /><br /><br />Sorry for any confusion.</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000573840000000</link>
		<pubDate>Sat, 25 Nov 2006 13:16:24 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000573840000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>&quot;Actually I'm really not. I've posted twice why I don't think this makes sense in an imperative language.&quot;</p>
<p>&nbsp;</p>
<p>I think we have to agree to disagree on this. I have no problems with using C for creating high-end multi-threaded applications.</p>
<p><br />&nbsp;</p>
<p>&quot;I would recommend you post it and point it in the direction of Simpon Peyton Jones and Tim Harris though. If your implementation really is as good as you say, and it does what the Haskell one does, I'm sure they will be willing to do it your way instead.&quot;</p>
<p>&nbsp;</p>
<p>Its definitely as good as I say it is, however, it doesn’t have some of the features that Haskell has. You should think of my STM as a “lean-and-mean” minimalist version. I was trying to go for extreme speed in the STM implementation itself, some of the
 stuff that Haskell uses makes this impossible.</p>
<p>&nbsp;</p>
<p>;^(…</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Anyway… I will think this over. To patent, or not to patent. I wonder how popular a fairly speedy C/C&#43;&#43; STM alternative to Haskell would actually be. I personally would not even want to use my STM in any of my application infrastructures’. But if most of
 the programmers go for STM, I could do well by providing a top-notch minimalist alternative in C/C&#43;&#43;.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>Humm..</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000579280000000</link>
		<pubDate>Sat, 25 Nov 2006 13:25:28 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000579280000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>cristom wrote:</div>
<div>&#65279;
<p>ACK!!!</p>
<p>&nbsp;</p>
<p>&quot;I am mostly talking about database servers the make heavy use of shared memory for fast-pathing database queries. I can traverse mutable data-structures with atomic operations and/or memory barriers. &quot;<br /><br />Is suppose to read as:<br /><br /></p>
<p>I am mostly talking about database servers the make heavy use of shared memory for fast-pathing database queries. I can traverse mutable data-structures&nbsp;&quot;WITHOUT&quot;&nbsp;atomic operations and/or memory barriers.
<br /><br /><br /><br />Sorry for any confusion.</p>
</div>
</blockquote>
<br /><br />Again, what does this prove? Nothing!<br />&quot;I have this prime number generator written in asm which is much faster than the same algorithm produces when compiled with VC, ergo C is useless.&quot;<br /><br />Again, you point out specific cases where existing technology works well, and conclude that STM is useless. The point here though is that there are plenty of applications which are essentially single threaded because splitting them up in multiple threads is
 too difficult to be a feasible proposition.&nbsp; It's for these difficult cases, cases where the traditional methods are too difficult to use, that STM will help.<br /><br />The point is that STM is really nice and elegant for the <em>general</em> case. Your whole argument basically boils down to premature optimization. Use STM, if it's too slow somewhere, and you can find a way to get it faster (most likely by compromising your
 ability to use this abstraction in a composable way in the future - which may be a completely valid tradeoff) then you are free to do so. Just like you can use inline asm in C where it's needed.<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000582410000000</link>
		<pubDate>Sat, 25 Nov 2006 13:30:41 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000582410000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[One other MAJOR *point about TM... STM or HTM, my implmentation or not, both &quot;suffer&quot; from a not so well known phenomena:
<br /><p>Inconsistent data can, and will, be accessed in a transactional atomic block! A users algorithm for a transactional based system is based solely inside of an atomic block, e.g.,
<br /></p>
<p><br />atomic { // start transactional atomic block&nbsp;<br />&nbsp;<br />users_algorithm{ <br />&nbsp; &nbsp;// Access transactional data-structures <br />&nbsp;} <br /></p>
<p></p>
<div id="qhide_714306">} // try to commit transactional atomic block <br /><br /><br /></div>
This means that the users algorithm can actually &quot;operate&quot; on inconsistent data... No kidding, not at all... therefore, a users algorithm behavior is basically undefined, whether the programmer likes it or not... Think about it for a minute... If your algorithm
 is fed with &quot;no-so coherent&quot; data, then your algorithm will be subject to undefined behavior by default...
<br /><p>Wow... The implementations that I have seen have to actually catch any and all fatal exceptions that can, and WILL, arise when a user algorithm is subjected to inconsistent data... Sometimes your algorithm crashes right off the bat and gets intercepted by
 the STM where the transaction will be aborted, and retried... Sometimes your algorithm will be stuck in an infinite loop (most common problem, IMHO) , inside the atomic block... STM has to watch out for this kind of stuff... IMHO, this is a MAJOR drawback
 and a down right dangerous aspect of transactional memory... This behavior is inherent in basically any TM implementation; hardware or software...
<br /></p>
<p>Need to think some more on this troubling subject... Now you know just some of the reasons why I don't like TM...
<br /></p>
<p>Yikes! <br /></p>
<p>:O <br /></p>
<p>* I can't believe I forgot to mention this; totally slipped my mind. Right when I remembered this I went over to Wikipedia to see if anybody bring this fact up; somebody did... IMO, its vital that anybody who thinks about using TM completely understands
 this particular caveat! <br /></p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000590340000000</link>
		<pubDate>Sat, 25 Nov 2006 13:43:54 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000590340000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>cristom wrote:</div>
<div>&#65279;One other MAJOR *point about TM... STM or HTM, my implmentation or not, both &quot;suffer&quot; from a not so well known phenomena:
<br /><p>Inconsistent data can, and will, be accessed in a transactional atomic block! A users algorithm for a transactional based system is based solely inside of an atomic block, e.g.,
<br /></p>
<p><br />atomic { // start transactional atomic block&nbsp;<br />&nbsp;<br />users_algorithm{ <br />&nbsp; &nbsp;// Access transactional data-structures <br />&nbsp;} <br /></p>
<p></p>
<div id="qhide_714306">} // try to commit transactional atomic block <br /><br /><br /></div>
This means that the users algorithm can actually &quot;operate&quot; on inconsistent data... No kidding, not at all... therefore, a users algorithm behavior is basically undefined, whether the programmer likes it or not... Think about it for a minute... If your algorithm
 is fed with &quot;no-so coherent&quot; data, then your algorithm will be subject to undefined behavior by default...
<br /><p>Wow... The implementations that I have seen have to actually catch any and all fatal exceptions that can, and WILL, arise when a user algorithm is subjected to inconsistent data... Sometimes your algorithm crashes right off the bat and gets intercepted by
 the STM where the transaction will be aborted, and retried... Sometimes your algorithm will be stuck in an infinite loop (most common problem, IMHO) , inside the atomic block... STM has to watch out for this kind of stuff... IMHO, this is a MAJOR drawback
 and a down right dangerous aspect of transactional memory... This behavior is inherent in basically any TM implementation; hardware or software...
<br /></p>
<p>Need to think some more on this troubling subject... Now you know just some of the reasons why I don't like TM...
<br /></p>
<p>Yikes! <br /></p>
<p>:O <br /></p>
<p>* I can't believe I forgot to mention this; totally slipped my mind. Right when I remembered this I went over to Wikipedia to see if anybody bring this fact up; somebody did... IMO, its vital that anybody who thinks about using TM completely understands
 this particular caveat! <br /></p>
<p></p>
</div>
</blockquote>
<br /><br />This may be a problem in C, but not in Haskell. <br />Haskell uses lazy evaluation, i.e. it's demand-driven. Nothing will be computed unless it's needed, and before any of writes are performed or data returned and forced by the&nbsp;caller (which is the only two things that can force evaluation) the accessed transactional
 variables are checked for consistency.<br /><br />I.e. if you do something like the following in Haskell:
<p></p>
<p>atomically&nbsp;$ do {&nbsp;<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v1 &lt;- readTVar t1;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;v2 &lt;- readTVar t2;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;writeTVar t3 ( willDivergeIfInconsistent v1 v2 )<br />}<br /><br />t1 and t2 will be validated before t3 is written to, and the writing of t3 is the only thing that will force willDivergeIfInconsistent to be evaluated, and at that point v1 and v2 are guaranteed to be valid, thus nothing will ever be evaluated with inconsistent
 data.<br />This holds for every atomic computation, even with interleaved reads and writes, since all the data used by a function will be validated before it can be retrieved and thus must be at least consistent enough to execute the call properly.
</p>
<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000606650000000</link>
		<pubDate>Sat, 25 Nov 2006 14:11:05 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000606650000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>One problem with implementing software transactional memory is that it's possible for a transaction to read inconsistent state (that is, to read a mixture of old and new values written by another transaction). Such a transaction is doomed to abort if it
 ever tries to commit, but it's possible for inconsistent state to cause a transaction to trigger a fatal exceptional condition such as a segmentation fault or even enter an endless loop, as in the following contrived example from Figure 4 of &quot;Language Support
 for Lightweight Transactions&quot;:</p>
<table>
<tbody>
<tr>
<td>
<pre><b>atomic</b> {
    if (x != y) 
        while (true) { }
}
</pre>
<p>Transaction A</p>
</td>
<td>
<pre><b>atomic</b> {
    x&#43;&#43;;
    y&#43;&#43;;
}
</pre>
<p>Transaction B</p>
</td>
</tr>
</tbody>
</table>
<p>Provided <i>x</i>=<i>y</i> initially, neither transaction above alters this invariant, but it's possible transaction A will read
<i>x</i> after transaction B updates it but read <i>y</i> before transaction B updates it, causing it to enter an infinite loop. The usual strategy for dealing with this is to intercept any fatal exceptions and periodically check if each transaction is valid;
 if not, it can be aborted immediately, since it's doomed to fail in any case.</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000609480000000</link>
		<pubDate>Sat, 25 Nov 2006 14:15:48 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000609480000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>“E.g. let's say you have a game world, and 10000 game objects that interact with it in complex and data dependent ways (i.e. there is no way to partition the world into lockable regions). Each of these objects interact with about half a dozen of the other
 objects, and they do so concurrently, and the interactions must be atomic. How do you solve that with lock free data structures? The game world consists of multiple different data structures nested in complex ways (oct-trees, portal cell graphs, BSP trees,
 etc.). How do you solve it with locks? You really don't, unless you stick a big lock on the entire world, or use some global locking order or something equally detrimental to composability and productivity. STM in this case &quot;Just Works&quot;.”</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>If you don’t know how to write a high-end multi-threaded game engine without using STM, that’s your problem. Game engines HEAVILY benefit from assembly language and other assorted low-level tricks and techniques. Low-overhead lock-free algorithms are a must.
 STM in a game engine? No way. I want my game to be very fast. STM would prevent the game engine from realizing the full potential of today’s high-and architectures…</p>
<p>&nbsp;</p>
<p>BTW, how would STM work on the Cell Processor? I don’t think it’s even possible for STM to even being to make use of the Cells SPU’s. Ha…. You want to program games? Do you know assembly language inside in out? Do you know how to use DMA with the Cells AltiVec
 SPU to shunt from shared memory to local SPU memory? &nbsp;Do you know the PPC instruction set? Do you know distributed/network programming paradigm for the Cell? What about the XBox 360? Why bog down its PowerPC with all of the coherency traffic generated from
 the crappy TM?</p>
<p>&nbsp;</p>
<p>You want to get into game engines? I suggest posting something overing comp.programming.threads and/or comp.arch. BTW, have you ever programmer the IBM Cell Processor or have you done any lock-free synchronization algorithms that use the PPC instruction
 set? Do you know the AltiVec instruction set? I have experience with all of these. I would not want you on the design team if alls you have to say to synchronization issues in the game engine is STM… No way no how!</p>
<p>&nbsp;</p>
<p>How skilled are you wrt high-end game engine synchronization issues? They are basically the same issues that exist in the fast-pathed part of a database server… Anyway, please follow-ups in comp.programming.threads and/or comp.arch. This forum seems to get
 too crowed...</p>
<p>&nbsp;</p>
<p>Humm…</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000616920000000</link>
		<pubDate>Sat, 25 Nov 2006 14:28:12 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000616920000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<blockquote>
<div>cristom wrote:</div>
<div>&#65279;
<p>One problem with implementing software transactional memory is that it's possible for a transaction to read inconsistent state (that is, to read a mixture of old and new values written by another transaction). Such a transaction is doomed to abort if it
 ever tries to commit, but it's possible for inconsistent state to cause a transaction to trigger a fatal exceptional condition such as a segmentation fault or even enter an endless loop, as in the following contrived example from Figure 4 of &quot;Language Support
 for Lightweight Transactions&quot;:</p>
<table>
<tbody>
<tr>
<td>
<pre><b>atomic</b> {
    if (x != y) 
        while (true) { }
}
</pre>
<p>Transaction A</p>
</td>
<td>
<pre><b>atomic</b> {
    x&#43;&#43;;
    y&#43;&#43;;
}
</pre>
<p>Transaction B</p>
</td>
</tr>
</tbody>
</table>
<p>Provided <i>x</i>=<i>y</i> initially, neither transaction above alters this invariant, but it's possible transaction A will read
<i>x</i> after transaction B updates it but read <i>y</i> before transaction B updates it, causing it to enter an infinite loop. The usual strategy for dealing with this is to intercept any fatal exceptions and periodically check if each transaction is valid;
 if not, it can be aborted immediately, since it's doomed to fail in any case.</p>
</div>
</blockquote>
<br /><br />Again, if you validate x and y before computing the if statement in A, it can't go wrong. This is not an unavoidable problem.<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000622620000000</link>
		<pubDate>Sat, 25 Nov 2006 14:37:42 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000622620000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>You use the splendid &quot;you must just be stupid&quot; argument, which is just great. So game engines are not difficult to parallize if you're smart enough, thus using any technology which would make this easier is an admission of stupidity. Well that's just great.
 Have fun with that.<br /><br />You do know that the founder and technical director (Tim Sweeney)of Epic games (recently released Gears of War for the XBox 360) is a heavy advocate for purely functional programming and STM for games, right? If not, check out &quot;The Next Mainstream Programing
 Language, A Game Developer's Perspective&quot;. But I'm sure you know more than both him and me.<br /><br />Also, I'm just going to stop arguing with you right here. I dislike your argumentation style, and you don't seem interested in learning anything new.&nbsp;Though I do think it's funny that you pretend to be an expert on game engines, and then proceed to share your
 wisdom on the subject to educate poor me in case I ever want to work on games (for the record, I actually work on game engine technology for a living, for the XBox 360).<br /></p>
<p>posted by sylvan</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000627590000000</link>
		<pubDate>Sat, 25 Nov 2006 14:45:59 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000627590000000</guid>
		<dc:creator>sylvan</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>Why would you use STM in a game engine? And how would use use STM on the Cell? Perhaps I, or somebody else at comp.programming.theads can help you get a MUCH better design for any engine you may be working on.</p>
<p>&#65279; </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>&quot;You do know that the founder and technical director (Tim Sweeney)of Epic games (recently released Gears of War for the XBox 360) is a heavy advocate for purely functional programming and STM for games, right? If not, check out &quot;The Next Mainstream Programing
 Language, A Game Developer's Perspective&quot;. But I'm sure you know more than both him and me.&quot;</p>
<p>&nbsp;</p>
<p>Yeah. Well, if Tim says so... I happen to completely disagree with him. BTW... Sadly, a lot of game programmers are not talented multi-threaded programmers:</p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.programming.threads/msg/2c477272953fc5e0">http&#58;&#47;&#47;groups.google.com&#47;group&#47;comp.programming.threads&#47;msg&#47;2c477272953fc5e0</a></p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.programming.threads/browse_frm/thread/6fe2dd51631afee5">http&#58;&#47;&#47;groups.google.com&#47;group&#47;comp.programming.threads&#47;browse_frm&#47;thread&#47;6fe2dd51631afee5</a></p>
<p>&nbsp;</p>
<p><a href="http://groups.google.com/group/comp.arch/search?hl=en&amp;group=comp.arch&amp;q=games+multi-core&amp;qt_g=1">http&#58;&#47;&#47;groups.google.com&#47;group&#47;comp.arch&#47;search&#63;hl&#61;en&#38;group&#61;comp.arch&#38;q&#61;games&#43;multi-core&#38;qt_g&#61;1</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>That’s the sad truth. STM is not going to help them learn how to leverage lock-free programming against their very high-end game engines synchronization needs. I bet Tim doesn’t let his programmers use any Assembly Language either? I doubt it. I also doubt
 that he would choose a STM based engine, over a lock-free engine that outperforms it by an order of magnitude. He would have to be crazy to do something like that.</p>
<p>&nbsp;</p>
<p>IMHO, game programming is all about squeezing all of the horsepower you can out of the architecture. STM prevents this because it will be flooding the cache coherency system with boat loads of unneeded traffic. Humm… Assembly language and game engines… Do
 they go together? Yes. Big time. Its going to be interesting to see how the gaming industry programs the Cell with STM… Wow. Its basically impossible. How to address the SPU with STM?</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>As for me not wanting to learn anything new… Well you wrong. I implemented STM. I know all of the issues. I have to make sure that I let everybody know what’s up, and let them get mislead by the marketing for STM.</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000637710000000</link>
		<pubDate>Sat, 25 Nov 2006 15:02:51 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000637710000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>&quot;Again, if you validate x and y before computing the if statement in A, it can't go wrong. This is not an unavoidable problem.&quot;</p>
<p>&nbsp;</p>
<p>Okay, well that makes STM doubly expensive. You have to see if you can commit, before you try to commit? What if your validation contains thousands of read transactions? How to address very large shared linked data-structures in STM without livelock and
 explicit contention management?</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000639880000000</link>
		<pubDate>Sat, 25 Nov 2006 15:06:28 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000639880000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>“As for me not wanting to learn anything new… Well you wrong. I implemented STM. I know all of the issues. I have to make sure that I let everybody know what’s up, and let them get mislead by the marketing for STM.&quot;</p>
<p>&nbsp;</p>
<p>ACK... </p>
<p>&nbsp;</p>
<p>I meant: </p>
<p>&nbsp;</p>
<p>As for me not wanting to learn anything new… Well you wrong. I actually implemented several versions of&nbsp;STM; I know all of the issues. I have to make sure that I let everybody know what’s up, and NOT let them get mislead by the marketing for STM.</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000643180000000</link>
		<pubDate>Sat, 25 Nov 2006 15:11:58 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000643180000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[For the record, I did not call you stupid. I want to know how you would address the Cell SPU with STM, that all...<br /><br />:^)<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000647060000000</link>
		<pubDate>Sat, 25 Nov 2006 15:18:26 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000647060000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[Can you use STM to efficently solve this problem:<br /><br /><a href="http://appcore.home.comcast.net/vzdoc/atomic/static-init/">http://appcore.home.comcast.net/vzdoc/atomic/static-init/</a><br /><br />Any thoughts?<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000743010000000</link>
		<pubDate>Sat, 25 Nov 2006 17:58:21 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000743010000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>I almost forgot that the video mentions that they have to use Garbage Collector. I have STM that does not depend on a GC at all. Funny… I wonder why Simon and Tim depend on a GC? Its clearly not needed… A lightweight PDR scheme can implement STM…</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000762230000000</link>
		<pubDate>Sat, 25 Nov 2006 18:30:23 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000762230000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>Here they are the introductory papers I used for my vZOOM coolthreads project...</p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/vzoom/">http&#58;&#47;&#47;appcore.home.comcast.net&#47;vzoom&#47;</a></p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/vzoom/">http&#58;&#47;&#47;appcore.home.comcast.net&#47;vzoom&#47;</a>round-1.pdf</p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/vzoom/">http&#58;&#47;&#47;appcore.home.comcast.net&#47;vzoom&#47;</a>round-2.pdf</p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/vzdoc/atomic/static-init/">http&#58;&#47;&#47;appcore.home.comcast.net&#47;vzdoc&#47;atomic&#47;static-init&#47;</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>This is a major alternative to STM. It outperforms it by orders of magnitude. The video should have mentioned other ways of doing things.</p>
<p>&nbsp;</p>
<p>Any thoughts? </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>-- P.S. this is in regard to the SUN CoolThreads contest:</p>
<p>&nbsp;</p>
<p><a href="https://coolthreads.dev.java.net/">https&#58;&#47;&#47;coolthreads.dev.java.net&#47;</a></p>
<p>&nbsp;</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000794960000000</link>
		<pubDate>Sat, 25 Nov 2006 19:24:56 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000794960000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p>DAMN! This fourm software mess my post again!!!<br /><br />ArGH! Let be try one more time!<br /><br /></p>
<p>Here they are the introductory papers I used for my vZOOM coolthreads project...</p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/vzoom/">http&#58;&#47;&#47;appcore.home.comcast.net&#47;vzoom&#47;</a></p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/vzoom/">http&#58;&#47;&#47;appcore.home.comcast.net&#47;vzoom&#47;</a>round-1.pdf</p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/vzoom/">http&#58;&#47;&#47;appcore.home.comcast.net&#47;vzoom&#47;</a>round-2.pdf</p>
<p>&nbsp;</p>
<p><a href="http://appcore.home.comcast.net/vzdoc/atomic/static-init/">http&#58;&#47;&#47;appcore.home.comcast.net&#47;vzdoc&#47;atomic&#47;static-init&#47;</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>This is a major alternative to STM. It outperforms it by orders of magnitude. The video should have mentioned other ways of doing things.</p>
<p>&nbsp;</p>
<p>Any thoughts? </p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>-- P.S. this is in regard to the SUN CoolThreads contest:</p>
<p>&nbsp;</p>
<p><a href="https://coolthreads.dev.java.net/">https&#58;&#47;&#47;coolthreads.dev.java.net&#47;</a></p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p>posted by cristom</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000795650000000</link>
		<pubDate>Sat, 25 Nov 2006 19:26:05 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633000795650000000</guid>
		<dc:creator>cristom</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[How is atomicity of transactions defined?&nbsp; Basically you define atomicity with respect to other things.&nbsp; Write transations are obviously atomic w.r.t other write transactions, but what about reads?&nbsp; With single reads obviously you can't tell but what if
 you were traversing a linked list that had concurrent write updates being applied to it for example?&nbsp; On such a traversal, would you see all or none of any write transaction, or would you see parts of write transactions depending on which nodes in the list
 got updated and where you were in the traversal when the updates happened?&nbsp; Or are there read transactions as well?&nbsp; So before you traverse through the list, you start a read transaction so you get a consistent version of the list.&nbsp; And do you have retries
 on read transactions or do you use the memory management scheme to keep things consistent?<br /><br />I had done some investigation is this area myself when I was looking on a couple of occasions at what it would take to make TDB (Trivial DataBase), which is used by Samba, lock-free using RCU for preemptive user threads (or something very much like it).&nbsp; On
 the second occasion I got around to looking at the actual code and realized that TDB had transactions.&nbsp;&nbsp; So I had to figure out how to do read lock-free transactions.&nbsp; Ultimately, too much work was involved for not very well defined benefits.&nbsp; But bascially
 when you do this kind of stuff (lock-free), you become aware of the importance of well defined semantics.<br /><p>posted by jseigh</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633001456750000000</link>
		<pubDate>Sun, 26 Nov 2006 13:47:55 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c633001456750000000</guid>
		<dc:creator>jseigh</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[
<p dir="ltr">When STM detects&nbsp;a long transaction that conflict - it immediately switches to more pessimistic approach (which works a lot like&nbsp;reader/writer locks). &nbsp;</p>
<p dir="ltr">&nbsp;</p>
<p dir="ltr">For such cases STM employ the use of a contention manager (CM) that detect conflicts and decides, according to a pre-defined policy, which read-mode technique to use. By default, when transaction starts, CM attempts to use the optimistic read technique,
 once it detects a conflict, it considers switching to a more pessimistic approach (using reader/writer locks) depending on the transaction size (defined by the reads count) and the re-execution count.</p>
<p dir="ltr">&nbsp;</p>
<p dir="ltr">As you mentioned, a naive optimistic read technique with automatic execution schema can lead to starvation in cases where a large transaction conflict with smaller transactions that execute periodically.
</p>
<p>posted by aviade</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c634005841450000000</link>
		<pubDate>Mon, 01 Feb 2010 01:22:25 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c634005841450000000</guid>
		<dc:creator>aviade</dc:creator>
	</item>
	<item>
		<title>Re: Programming in the Age of Concurrency: Software Transactional Memory</title>
		<description>
			<![CDATA[From operating systems to multimedia, PC & mobile games to anti-virus, from drivers to registry cleaners and internet tools our website    features all the latest soft wares for  safe and  free downloading  enjoy.<p>posted by mike</p>]]>
		</description>
		<link>http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c634258232970000000</link>
		<pubDate>Sat, 20 Nov 2010 04:14:57 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Shows/Going+Deep/Programming-in-the-Age-of-Concurrency-Software-Transactional-Memory#c634258232970000000</guid>
		<dc:creator>mike</dc:creator>
	</item>
</channel>
</rss>