<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
		>
<channel>
	<title>Comments on: Actor Myths</title>
	<atom:link href="http://codemonkeyism.com/actor-myths/feed/" rel="self" type="application/rss+xml" />
	<link>http://codemonkeyism.com/actor-myths/</link>
	<description></description>
	<lastBuildDate>Tue, 03 Jan 2012 15:08:49 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
		<item>
		<title>By: Ashish Hanwadikar</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-2/#comment-514477</link>
		<dc:creator>Ashish Hanwadikar</dc:creator>
		<pubDate>Fri, 13 May 2011 15:43:58 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-514477</guid>
		<description>Actor Model is essentially based on the following:
1) Actors communicate with each other through asynchronous message passing only
2) In reaction to an message, they can only do any of the following:
   a) Send messages to other actors
   b) Change their internal state
   c) Create other actors

That&#039;s all. Please refer to the Agha paper for further details. If the above conditions are met, there can&#039;t be any deadlocks.</description>
		<content:encoded><![CDATA[<p>Actor Model is essentially based on the following:<br />
1) Actors communicate with each other through asynchronous message passing only<br />
2) In reaction to an message, they can only do any of the following:<br />
   a) Send messages to other actors<br />
   b) Change their internal state<br />
   c) Create other actors</p>
<p>That&#8217;s all. Please refer to the Agha paper for further details. If the above conditions are met, there can&#8217;t be any deadlocks.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ScottHK</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-2/#comment-310580</link>
		<dc:creator>ScottHK</dc:creator>
		<pubDate>Fri, 30 Jul 2010 06:49:07 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-310580</guid>
		<description>Actors work best to push data to a single worker thread, essentially creating a single-threaded program.  I have found this is the best solution for 99% of my business apps.

Yes, Actors do not solve the synchronization problems for a true multi-threaded program.  If you think about having multiple Actors communicating in an internet book store app the locking issues have not changed at all from other solutions.

In my tests BlockingQueue in Java creates a massive amount of context switching.  Does it make sense to do a thread switch for every tiny message that comes in, and is there any easy way around this?</description>
		<content:encoded><![CDATA[<p>Actors work best to push data to a single worker thread, essentially creating a single-threaded program.  I have found this is the best solution for 99% of my business apps.</p>
<p>Yes, Actors do not solve the synchronization problems for a true multi-threaded program.  If you think about having multiple Actors communicating in an internet book store app the locking issues have not changed at all from other solutions.</p>
<p>In my tests BlockingQueue in Java creates a massive amount of context switching.  Does it make sense to do a thread switch for every tiny message that comes in, and is there any easy way around this?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nexos</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-2/#comment-309563</link>
		<dc:creator>Nexos</dc:creator>
		<pubDate>Mon, 26 Jul 2010 12:48:52 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-309563</guid>
		<description>@see http://doc.akkasource.org/transactors</description>
		<content:encoded><![CDATA[<p>@see <a href="http://doc.akkasource.org/transactors" rel="nofollow">http://doc.akkasource.org/transactors</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-2/#comment-309001</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Fri, 23 Jul 2010 21:08:35 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-309001</guid>
		<description>@Marc: Not sure you would like to buy tickets asynchronously. But as I&#039;ve said - perhaps it might be a good idea to read the post again ;-) async helps.

I know the actor community does not want to discuss usecases where you need to share state.

And Tim has no clue I assume what James wanted to illustrate - that if you have a usecase that needs to share state you can get race conditions and actors will not help you - no technology will help you if your use case needs state sharing. Obviously James example is not about sock dispensers.</description>
		<content:encoded><![CDATA[<p>@Marc: Not sure you would like to buy tickets asynchronously. But as I&#8217;ve said &#8211; perhaps it might be a good idea to read the post again ;-) async helps.</p>
<p>I know the actor community does not want to discuss usecases where you need to share state.</p>
<p>And Tim has no clue I assume what James wanted to illustrate &#8211; that if you have a usecase that needs to share state you can get race conditions and actors will not help you &#8211; no technology will help you if your use case needs state sharing. Obviously James example is not about sock dispensers.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marc</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-2/#comment-308985</link>
		<dc:creator>Marc</dc:creator>
		<pubDate>Fri, 23 Jul 2010 19:19:27 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308985</guid>
		<description>Stephan, are you sure that your ticketmanager is a good use-case/example for actors - or that at least your synchronous access to the # of tickets would&#039;nt totally contradict the whole point of actors? With actors you would send a message to the ticketmanager to request a ticket and he would either return you a ticket (asynchronously!) or an error that none are available anymore and you&#039;d have to watch it on youtube or look on ebay ;)

Shared state: Are actors part of the application state as a whole: hell yes. Do single actors share their local state: no - not if you and your application architecture comply to the whole idea of actors.

And with all due respect to James Iry and his vending machine: that example in context of actors is total b/s and Tim has said it quite well in 
his comment: http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html?showComment=1253812155361#c3904292961745027682</description>
		<content:encoded><![CDATA[<p>Stephan, are you sure that your ticketmanager is a good use-case/example for actors &#8211; or that at least your synchronous access to the # of tickets would&#8217;nt totally contradict the whole point of actors? With actors you would send a message to the ticketmanager to request a ticket and he would either return you a ticket (asynchronously!) or an error that none are available anymore and you&#8217;d have to watch it on youtube or look on ebay ;)</p>
<p>Shared state: Are actors part of the application state as a whole: hell yes. Do single actors share their local state: no &#8211; not if you and your application architecture comply to the whole idea of actors.</p>
<p>And with all due respect to James Iry and his vending machine: that example in context of actors is total b/s and Tim has said it quite well in<br />
his comment: <a href="http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html?showComment=1253812155361#c3904292961745027682" rel="nofollow">http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html?showComment=1253812155361#c3904292961745027682</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-2/#comment-308887</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Fri, 23 Jul 2010 08:21:31 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308887</guid>
		<description>@Sergio: On the Orwellian: This is from James and I agree, but

Orwellian, for those who use the &quot;share nothing&quot; term outwards to convince others of actors.

It&#039;s more like cats and dogs. They speak different languages.

From the discussion above,what Erlang calls &quot;share nothing&quot; others would call &quot;encapsulation&quot; (see encapsulated Java examples etc.)

So using share-nothing inside Erlang is fine as it describes the fact in Erlang terms, using it outside knowing that others use the term differently (system as you call it), is Orwellian, I stand with that.</description>
		<content:encoded><![CDATA[<p>@Sergio: On the Orwellian: This is from James and I agree, but</p>
<p>Orwellian, for those who use the &#8220;share nothing&#8221; term outwards to convince others of actors.</p>
<p>It&#8217;s more like cats and dogs. They speak different languages.</p>
<p>From the discussion above,what Erlang calls &#8220;share nothing&#8221; others would call &#8220;encapsulation&#8221; (see encapsulated Java examples etc.)</p>
<p>So using share-nothing inside Erlang is fine as it describes the fact in Erlang terms, using it outside knowing that others use the term differently (system as you call it), is Orwellian, I stand with that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Bossa</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-2/#comment-308880</link>
		<dc:creator>Sergio Bossa</dc:creator>
		<pubDate>Fri, 23 Jul 2010 07:44:10 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308880</guid>
		<description>@Ernesto

I have countless examples in books and academic papers regarding concurrent and distributed systems, defining state in terms of internal object/system state.
I esteem and respect Stephan very much, he&#039;s a very nice person, but I have no interest in convincing someone who defines others&#039; point of view as &quot;Orwellian&quot;, so I&#039;ll stop my discussion here.</description>
		<content:encoded><![CDATA[<p>@Ernesto</p>
<p>I have countless examples in books and academic papers regarding concurrent and distributed systems, defining state in terms of internal object/system state.<br />
I esteem and respect Stephan very much, he&#8217;s a very nice person, but I have no interest in convincing someone who defines others&#8217; point of view as &#8220;Orwellian&#8221;, so I&#8217;ll stop my discussion here.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ernesto</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-2/#comment-308767</link>
		<dc:creator>Ernesto</dc:creator>
		<pubDate>Thu, 22 Jul 2010 21:19:18 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308767</guid>
		<description>@Sergio

&quot;That said, when talking about “shared nothing architecture” in concurrency models (actors) or distributed systems (take Cassandra as an example), we don’t refer to global application state: we refer to the state, maybe memory is a more appropriate term, of a single actor/system.&quot;

Right.

@Stephan

&quot;a.) This is Orwellian b/c noone else uses this term in that way&quot;

I disagree, in Java Concurrency in Practice, which is by no means a standard, but we all can agree that is a relevant book in the subject, state is defined as the data inside an object &quot;stored in state variables such as instance or static fields&quot;, and the term shared state refers to state variables (read object&#039;s variables) &quot;that could be accessed by multiple threads&quot;. So an Actor which only consumes/produces messages doesn&#039;t share state according to these definition, which I think is the norm when talking about concurrency, at least in Java.

All quotes taken from Chapter 2, first page, in case anybody might want to check :)</description>
		<content:encoded><![CDATA[<p>@Sergio</p>
<p>&#8220;That said, when talking about “shared nothing architecture” in concurrency models (actors) or distributed systems (take Cassandra as an example), we don’t refer to global application state: we refer to the state, maybe memory is a more appropriate term, of a single actor/system.&#8221;</p>
<p>Right.</p>
<p>@Stephan</p>
<p>&#8220;a.) This is Orwellian b/c noone else uses this term in that way&#8221;</p>
<p>I disagree, in Java Concurrency in Practice, which is by no means a standard, but we all can agree that is a relevant book in the subject, state is defined as the data inside an object &#8220;stored in state variables such as instance or static fields&#8221;, and the term shared state refers to state variables (read object&#8217;s variables) &#8220;that could be accessed by multiple threads&#8221;. So an Actor which only consumes/produces messages doesn&#8217;t share state according to these definition, which I think is the norm when talking about concurrency, at least in Java.</p>
<p>All quotes taken from Chapter 2, first page, in case anybody might want to check :)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James Iry</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-2/#comment-308701</link>
		<dc:creator>James Iry</dc:creator>
		<pubDate>Thu, 22 Jul 2010 14:56:14 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308701</guid>
		<description>The article Stephan links to is the middle one in a series of 3

http://james-iry.blogspot.com/2009/04/state-of-sock-tubes.html

http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html

 http://james-iry.blogspot.com/2009/04/but-butyou-didnt-mutate-any-variables.html

And there was another one about locking and Erlang

http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about_16.html</description>
		<content:encoded><![CDATA[<p>The article Stephan links to is the middle one in a series of 3</p>
<p><a href="http://james-iry.blogspot.com/2009/04/state-of-sock-tubes.html" rel="nofollow">http://james-iry.blogspot.com/2009/04/state-of-sock-tubes.html</a></p>
<p><a href="http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html" rel="nofollow">http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html</a></p>
<p> <a href="http://james-iry.blogspot.com/2009/04/but-butyou-didnt-mutate-any-variables.html" rel="nofollow">http://james-iry.blogspot.com/2009/04/but-butyou-didnt-mutate-any-variables.html</a></p>
<p>And there was another one about locking and Erlang</p>
<p><a href="http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about_16.html" rel="nofollow">http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about_16.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308699</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 22 Jul 2010 14:51:18 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308699</guid>
		<description>@RogerV: &quot;I wouldn’t argue that it’s an end-all solution for concurrent programming needs, but it’s a useful approach to add to the arsenal and can enable a developer to be more productive.&quot;

Noone in this thread has argued that.</description>
		<content:encoded><![CDATA[<p>@RogerV: &#8220;I wouldn’t argue that it’s an end-all solution for concurrent programming needs, but it’s a useful approach to add to the arsenal and can enable a developer to be more productive.&#8221;</p>
<p>Noone in this thread has argued that.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: RogerV</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308695</link>
		<dc:creator>RogerV</dc:creator>
		<pubDate>Thu, 22 Jul 2010 14:31:59 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308695</guid>
		<description>So followed all the discussion and thought might be learning something, but in the end it all seems to boil down to one of those debates about what the meaning of &#039;is&#039; is, so far as shared state, et al.

The bottom line is that the Actor async messaging approach with queued access to actor state is a different way to program concurrent systems than others.

When I program in Google&#039;s Go language with goroutines, my concurrent applications are entirely different in their structure than how I coded applications in the past with Java&#039;s synchronized, util.concurrency library, etc.

Because I&#039;ve been a heavy JMS developer for years building distributed systems, a messaging approach to concurrency via language innate features like goroutines was a very easy uptake. It&#039;s faster for me to develop concurrent applications with this approach and not get bogged down trying to get things right as was the case with the previous approaches.

I wouldn&#039;t argue that it&#039;s an end-all solution for concurrent programming needs, but it&#039;s a useful approach to add to the arsenal and can enable a developer to be more productive. More productive in the sense of how I became significantly more productive back in the day when I switched away from C++ to Java and C#.</description>
		<content:encoded><![CDATA[<p>So followed all the discussion and thought might be learning something, but in the end it all seems to boil down to one of those debates about what the meaning of &#8216;is&#8217; is, so far as shared state, et al.</p>
<p>The bottom line is that the Actor async messaging approach with queued access to actor state is a different way to program concurrent systems than others.</p>
<p>When I program in Google&#8217;s Go language with goroutines, my concurrent applications are entirely different in their structure than how I coded applications in the past with Java&#8217;s synchronized, util.concurrency library, etc.</p>
<p>Because I&#8217;ve been a heavy JMS developer for years building distributed systems, a messaging approach to concurrency via language innate features like goroutines was a very easy uptake. It&#8217;s faster for me to develop concurrent applications with this approach and not get bogged down trying to get things right as was the case with the previous approaches.</p>
<p>I wouldn&#8217;t argue that it&#8217;s an end-all solution for concurrent programming needs, but it&#8217;s a useful approach to add to the arsenal and can enable a developer to be more productive. More productive in the sense of how I became significantly more productive back in the day when I switched away from C++ to Java and C#.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308668</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 22 Jul 2010 11:52:12 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308668</guid>
		<description>@Hiram: The usual claim is not: 
&quot;Share not internal state architecture&quot; 

but 

&quot;Share nothing architecture&quot;

Noone would argue with the internal state claim.</description>
		<content:encoded><![CDATA[<p>@Hiram: The usual claim is not:<br />
&#8220;Share not internal state architecture&#8221; </p>
<p>but </p>
<p>&#8220;Share nothing architecture&#8221;</p>
<p>Noone would argue with the internal state claim.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Hiram Chirino</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308667</link>
		<dc:creator>Hiram Chirino</dc:creator>
		<pubDate>Thu, 22 Jul 2010 11:45:29 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308667</guid>
		<description>Hi Stephan,

I half agree with you.  From the point of view concurrent memory access, actors don&#039;t share their internal state.  This property is easy to implement in standard class with proper encapsulation and immutable method parameters/return values.  If your looking at the state of all the actors and the dependencies between each other, I&#039;d call that distributed state, not shared state. On the other hand, I agree with your assessment of the locking situation.</description>
		<content:encoded><![CDATA[<p>Hi Stephan,</p>
<p>I half agree with you.  From the point of view concurrent memory access, actors don&#8217;t share their internal state.  This property is easy to implement in standard class with proper encapsulation and immutable method parameters/return values.  If your looking at the state of all the actors and the dependencies between each other, I&#8217;d call that distributed state, not shared state. On the other hand, I agree with your assessment of the locking situation.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308664</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 22 Jul 2010 11:12:02 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308664</guid>
		<description>@Sergio: &quot;That said, when talking about &quot;shared nothing architecture&quot; in concurrency models (actors) or distributed systems (take Cassandra as an example), we don&#039;t refer to global application state: we refer to the state, maybe memory is a more appropriate term, [...]&quot;

As James said, and I agree with him, 
a.) This is Orwellian b/c noone else uses this term in that way
b.) Memory is irrelevant

See above then every Java object with sync methods and getters/setters also is a shared nothing architecture. 

I don&#039;t think we add anything new to the discussion. It boils down to:

Me,James,others: If two actors depend on the internal state of a third actor, they are sharing state.

You,Erlang community: If two actors depend on the internal state of a third actor, they are not sharing state.</description>
		<content:encoded><![CDATA[<p>@Sergio: &#8220;That said, when talking about &#8220;shared nothing architecture&#8221; in concurrency models (actors) or distributed systems (take Cassandra as an example), we don&#8217;t refer to global application state: we refer to the state, maybe memory is a more appropriate term, [...]&#8221;</p>
<p>As James said, and I agree with him,<br />
a.) This is Orwellian b/c noone else uses this term in that way<br />
b.) Memory is irrelevant</p>
<p>See above then every Java object with sync methods and getters/setters also is a shared nothing architecture. </p>
<p>I don&#8217;t think we add anything new to the discussion. It boils down to:</p>
<p>Me,James,others: If two actors depend on the internal state of a third actor, they are sharing state.</p>
<p>You,Erlang community: If two actors depend on the internal state of a third actor, they are not sharing state.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Bossa</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308659</link>
		<dc:creator>Sergio Bossa</dc:creator>
		<pubDate>Thu, 22 Jul 2010 10:42:30 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308659</guid>
		<description>James identifies &quot;state&quot; with &quot;application state&quot;: obviously, any kind of useful application has state, and you have to manipulate such a state in order to accomplish something useful, regardless of your actual concurrency model. As a side note, the race condition outlined in his post is due to its oversimplified/poor interaction protocol, not the the actor model. 

That said, when talking about &quot;shared nothing architecture&quot; in concurrency models (actors) or distributed systems (take Cassandra as an example), we don&#039;t refer to global application state: we refer to the state, maybe memory is a more appropriate term, of a single actor/system. In such a case, and with such a state definition which isn&#039;t Orwellian either, actors clearly don&#039;t share state.</description>
		<content:encoded><![CDATA[<p>James identifies &#8220;state&#8221; with &#8220;application state&#8221;: obviously, any kind of useful application has state, and you have to manipulate such a state in order to accomplish something useful, regardless of your actual concurrency model. As a side note, the race condition outlined in his post is due to its oversimplified/poor interaction protocol, not the the actor model. </p>
<p>That said, when talking about &#8220;shared nothing architecture&#8221; in concurrency models (actors) or distributed systems (take Cassandra as an example), we don&#8217;t refer to global application state: we refer to the state, maybe memory is a more appropriate term, of a single actor/system. In such a case, and with such a state definition which isn&#8217;t Orwellian either, actors clearly don&#8217;t share state.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308656</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 22 Jul 2010 10:22:20 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308656</guid>
		<description>@Sergio: Again, 1) No, see James. If two actors share access to another actor which is holding state, then they are sharing state for any Non-Orwellian definition of &quot;sharing state&quot;.

(with the very senseful definition of state by James).</description>
		<content:encoded><![CDATA[<p>@Sergio: Again, 1) No, see James. If two actors share access to another actor which is holding state, then they are sharing state for any Non-Orwellian definition of &#8220;sharing state&#8221;.</p>
<p>(with the very senseful definition of state by James).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Bossa</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308651</link>
		<dc:creator>Sergio Bossa</dc:creator>
		<pubDate>Thu, 22 Jul 2010 09:54:28 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308651</guid>
		<description>Wow, lots of answers here since yesterday when I gave the first one :)

Anyways, discussion seems to have been somewhat drifted toward implementation details and the &quot;are actors the concurrency silver bullet&quot; question, which wasn&#039;t the original one and isn&#039;t interesting either because of the obvious answer.

Going back to the discussed myths ...
1) Are actors a shared nothing system? Yes, because actors don&#039;t share state, but send messages instead: it&#039;s true those messages may *depend* on internal state, but this doesn&#039;t mean to *share* state.
2) Are they easier to get right because of that? It depends on your mindset and what you&#039;re trying to accomplish. Once you shift your mind toward asynchronous message passing, actors will let you think in terms of message flows without caring about what to share and what to lock and how to do to avoid liveness problems, which is an advantage. But still, many prefer locks and explicit concurrency.

Obviously, you can implement actors in several ways, and you can also implement asynchronous systems that work similar to the actor one.
And obviously, you can misimplement and screw up everything even when using the actor model, no system will ever save us from our own mistakes.
But that&#039;s another story ;)

Cheers!

Sergio B.</description>
		<content:encoded><![CDATA[<p>Wow, lots of answers here since yesterday when I gave the first one :)</p>
<p>Anyways, discussion seems to have been somewhat drifted toward implementation details and the &#8220;are actors the concurrency silver bullet&#8221; question, which wasn&#8217;t the original one and isn&#8217;t interesting either because of the obvious answer.</p>
<p>Going back to the discussed myths &#8230;<br />
1) Are actors a shared nothing system? Yes, because actors don&#8217;t share state, but send messages instead: it&#8217;s true those messages may *depend* on internal state, but this doesn&#8217;t mean to *share* state.<br />
2) Are they easier to get right because of that? It depends on your mindset and what you&#8217;re trying to accomplish. Once you shift your mind toward asynchronous message passing, actors will let you think in terms of message flows without caring about what to share and what to lock and how to do to avoid liveness problems, which is an advantage. But still, many prefer locks and explicit concurrency.</p>
<p>Obviously, you can implement actors in several ways, and you can also implement asynchronous systems that work similar to the actor one.<br />
And obviously, you can misimplement and screw up everything even when using the actor model, no system will ever save us from our own mistakes.<br />
But that&#8217;s another story ;)</p>
<p>Cheers!</p>
<p>Sergio B.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308604</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 22 Jul 2010 04:31:58 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308604</guid>
		<description>@Mue: Thanks a lot for your take on this and some insights for me.</description>
		<content:encoded><![CDATA[<p>@Mue: Thanks a lot for your take on this and some insights for me.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308603</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 22 Jul 2010 04:30:23 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308603</guid>
		<description>@Logan: I did not talk about two actors but many actors. Assume N actors depend on one actor (TicketActor) for the context of the post.</description>
		<content:encoded><![CDATA[<p>@Logan: I did not talk about two actors but many actors. Assume N actors depend on one actor (TicketActor) for the context of the post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308602</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Thu, 22 Jul 2010 04:28:54 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308602</guid>
		<description>@lakemalcom: James is clever, nice link. Although he tends towards pesonal attacks and doesn&#039;t like me very much ;-)</description>
		<content:encoded><![CDATA[<p>@lakemalcom: James is clever, nice link. Although he tends towards pesonal attacks and doesn&#8217;t like me very much ;-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Logan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308556</link>
		<dc:creator>Logan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 22:52:38 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308556</guid>
		<description>I&#039;m just going to say some things like they&#039;re facts, and we&#039;ll see whether I know what I&#039;m talking about or I&#039;m going to get some extra learning today.

Discussing whether or not a two-actor system constitutes a shared-nothing architecture is a misapplication of the concept.  Of course if you have one actor depending upon another, the first actor depends transitively on the second actor&#039;s state-- but that&#039;s not the kind of sharing to which the phrase &quot;shared nothing architecture&quot; refers.   That&#039;s why nobody ever argues over whether a system with a single app server and a single database node is &quot;shared nothing&quot;; there&#039;s only one app server, so with whom would it be sharing the database?

Whether or not an architecture is shared-nothing doesn&#039;t really become a question until you have at least three actors.

Helpful diagram:  http://imgur.com/6LJe5.png</description>
		<content:encoded><![CDATA[<p>I&#8217;m just going to say some things like they&#8217;re facts, and we&#8217;ll see whether I know what I&#8217;m talking about or I&#8217;m going to get some extra learning today.</p>
<p>Discussing whether or not a two-actor system constitutes a shared-nothing architecture is a misapplication of the concept.  Of course if you have one actor depending upon another, the first actor depends transitively on the second actor&#8217;s state&#8211; but that&#8217;s not the kind of sharing to which the phrase &#8220;shared nothing architecture&#8221; refers.   That&#8217;s why nobody ever argues over whether a system with a single app server and a single database node is &#8220;shared nothing&#8221;; there&#8217;s only one app server, so with whom would it be sharing the database?</p>
<p>Whether or not an architecture is shared-nothing doesn&#8217;t really become a question until you have at least three actors.</p>
<p>Helpful diagram:  <a href="http://imgur.com/6LJe5.png" rel="nofollow">http://imgur.com/6LJe5.png</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Runar</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308544</link>
		<dc:creator>Runar</dc:creator>
		<pubDate>Wed, 21 Jul 2010 22:17:52 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308544</guid>
		<description>@Dimitris, I think that Actors are really just a stepping stone towards implementing a fork/join/map monad. See here for an implementation:

http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/concurrent/Promise.scala.html</description>
		<content:encoded><![CDATA[<p>@Dimitris, I think that Actors are really just a stepping stone towards implementing a fork/join/map monad. See here for an implementation:</p>
<p><a href="http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/concurrent/Promise.scala.html" rel="nofollow">http://scalaz.googlecode.com/svn/continuous/latest/browse.sxr/scalaz/concurrent/Promise.scala.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: mue</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308476</link>
		<dc:creator>mue</dc:creator>
		<pubDate>Wed, 21 Jul 2010 20:35:17 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308476</guid>
		<description>Hi funzel,

as promised my little comment.

Somehow I dislike the term actor. Communicating Sequential Processes (CSP) by Tony Hoare describes the idea better. Software based on this idiom consists out of a large number of light weighted processes processing messages sent to them sequentially. In Erlang/OTP each processes only has one inbox but a very flexible pattern matching, in Go  goroutines can listen to multiple channels parallely while those channels can also be listened by multiple goroutines.

After a short time this way becomes a very natural kind of thinking. It is a very good base for concurrent software, but it&#039;s not the panacea without any problems. Synchronous request with answers need a kind of request/response messaging which without timeouts can easily lead to deadlocks (A calls B calls C calls A). This can be dismantled by timeouts, like in Erlang/OTP, but here this means a new level of error handling complexity (is it a deadlock or just a real timeout, because one process has a high load).

So back to the myths:

(1) Actors encapsulate their internal states, yes, and they don&#039;t share it directly. But state changes depend on the messages the actors receive. So I won&#039;t call it &quot;share nothing arch&quot; but &quot;share actors arch&quot;.

(2) From my experiences it&#039;s definitely a very simple idiom for the creation of massive concurrent applications. It removes many pitfalls and makes it easier to not forget semaphores or synchronized blocks. But a brings some new problems - single processing loop - and definitely doesn&#039;t solve every problem (deadlocks, partitioning of problems). So one has to learn how to use actors/CSP/MPI the right way.</description>
		<content:encoded><![CDATA[<p>Hi funzel,</p>
<p>as promised my little comment.</p>
<p>Somehow I dislike the term actor. Communicating Sequential Processes (CSP) by Tony Hoare describes the idea better. Software based on this idiom consists out of a large number of light weighted processes processing messages sent to them sequentially. In Erlang/OTP each processes only has one inbox but a very flexible pattern matching, in Go  goroutines can listen to multiple channels parallely while those channels can also be listened by multiple goroutines.</p>
<p>After a short time this way becomes a very natural kind of thinking. It is a very good base for concurrent software, but it&#8217;s not the panacea without any problems. Synchronous request with answers need a kind of request/response messaging which without timeouts can easily lead to deadlocks (A calls B calls C calls A). This can be dismantled by timeouts, like in Erlang/OTP, but here this means a new level of error handling complexity (is it a deadlock or just a real timeout, because one process has a high load).</p>
<p>So back to the myths:</p>
<p>(1) Actors encapsulate their internal states, yes, and they don&#8217;t share it directly. But state changes depend on the messages the actors receive. So I won&#8217;t call it &#8220;share nothing arch&#8221; but &#8220;share actors arch&#8221;.</p>
<p>(2) From my experiences it&#8217;s definitely a very simple idiom for the creation of massive concurrent applications. It removes many pitfalls and makes it easier to not forget semaphores or synchronized blocks. But a brings some new problems &#8211; single processing loop &#8211; and definitely doesn&#8217;t solve every problem (deadlocks, partitioning of problems). So one has to learn how to use actors/CSP/MPI the right way.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dimitris Andreou</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308463</link>
		<dc:creator>Dimitris Andreou</dc:creator>
		<pubDate>Wed, 21 Jul 2010 19:43:22 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308463</guid>
		<description>@Cedric, @stephan, regarding the single synchronization point, well, one is free to spawn many actors, in effect striping that single lock.</description>
		<content:encoded><![CDATA[<p>@Cedric, @stephan, regarding the single synchronization point, well, one is free to spawn many actors, in effect striping that single lock.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dimitris Andreou</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308462</link>
		<dc:creator>Dimitris Andreou</dc:creator>
		<pubDate>Wed, 21 Jul 2010 19:35:35 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308462</guid>
		<description>@Rick van der Arend, I agree that sticking to one-way messaging, no waiting, would remove concurrency hazards. But how would I simulate fork/join parallelism with actors in such a programming model? Particularly, how would I join actions? I would have to receive or to react, i.e. in either case resorting two-way messaging. So I would have to make really sure that actors down the line _always_ send back the response (be it normal or something to signify an error). 

One could of course respond &quot;if you need fork/join parallelism, use the fork/join framework&quot;, sure enough. Which is part of the point, actors do not seem the universal be-all, end-all programming model for concurrency, and we (well, at least I) have yet to figure the precise cases where it is the best-fitting solution. If anyone has such a characterization, of when actors is the best choice over other programming models, I would be very interested in it.</description>
		<content:encoded><![CDATA[<p>@Rick van der Arend, I agree that sticking to one-way messaging, no waiting, would remove concurrency hazards. But how would I simulate fork/join parallelism with actors in such a programming model? Particularly, how would I join actions? I would have to receive or to react, i.e. in either case resorting two-way messaging. So I would have to make really sure that actors down the line _always_ send back the response (be it normal or something to signify an error). </p>
<p>One could of course respond &#8220;if you need fork/join parallelism, use the fork/join framework&#8221;, sure enough. Which is part of the point, actors do not seem the universal be-all, end-all programming model for concurrency, and we (well, at least I) have yet to figure the precise cases where it is the best-fitting solution. If anyone has such a characterization, of when actors is the best choice over other programming models, I would be very interested in it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: lakemalcom</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308459</link>
		<dc:creator>lakemalcom</dc:creator>
		<pubDate>Wed, 21 Jul 2010 19:30:29 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308459</guid>
		<description>James Iry&#039;s similar take:
http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html</description>
		<content:encoded><![CDATA[<p>James Iry&#8217;s similar take:<br />
<a href="http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html" rel="nofollow">http://james-iry.blogspot.com/2009/04/erlang-style-actors-are-all-about.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308443</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 18:26:06 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308443</guid>
		<description>@Cedric: Instead of my blog post I could have put up your comment. I agree with the in-between (and the post was not intended as against-actors, just against myths). I agree with the single synchronization point instead of spread across methods. And I wonder too.</description>
		<content:encoded><![CDATA[<p>@Cedric: Instead of my blog post I could have put up your comment. I agree with the in-between (and the post was not intended as against-actors, just against myths). I agree with the single synchronization point instead of spread across methods. And I wonder too.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Cedric</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308442</link>
		<dc:creator>Cedric</dc:creator>
		<pubDate>Wed, 21 Jul 2010 18:21:38 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308442</guid>
		<description>I&#039;m probably in-between about actors. I agree with your skepticism, though, and I think the value and simplicity of the actor model have been exaggerated.

Something that has always puzzled me is that actors do share a single synchronization point: their message inbox. Instead of having these locks spread over several synchronized methods (the Java way), you are now funneling all your methods in this single inbox. The claims are that locking in the inbox can be made very fast and is never a bottleneck, but I wonder.</description>
		<content:encoded><![CDATA[<p>I&#8217;m probably in-between about actors. I agree with your skepticism, though, and I think the value and simplicity of the actor model have been exaggerated.</p>
<p>Something that has always puzzled me is that actors do share a single synchronization point: their message inbox. Instead of having these locks spread over several synchronized methods (the Java way), you are now funneling all your methods in this single inbox. The claims are that locking in the inbox can be made very fast and is never a bottleneck, but I wonder.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308424</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 17:14:31 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308424</guid>
		<description>@Runar: I&#039;m not used to you agreeing with me - somehow :-) Thanks for sharing the idea about messages and dependency.</description>
		<content:encoded><![CDATA[<p>@Runar: I&#8217;m not used to you agreeing with me &#8211; somehow :-) Thanks for sharing the idea about messages and dependency.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Runar</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308404</link>
		<dc:creator>Runar</dc:creator>
		<pubDate>Wed, 21 Jul 2010 16:11:48 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308404</guid>
		<description>Actors are absolutely all about shared mutable state.

You&#039;re right, actors do share their state because there exists a dependency between an actor&#039;s state and the messages that it sends.

Of course, the exact representation of the state cannot (properly) be observed from the outside, but if an actor has state, it&#039;s implicitly shared if the messages that it sends to other actors depend on its state.</description>
		<content:encoded><![CDATA[<p>Actors are absolutely all about shared mutable state.</p>
<p>You&#8217;re right, actors do share their state because there exists a dependency between an actor&#8217;s state and the messages that it sends.</p>
<p>Of course, the exact representation of the state cannot (properly) be observed from the outside, but if an actor has state, it&#8217;s implicitly shared if the messages that it sends to other actors depend on its state.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick van der Arend</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308368</link>
		<dc:creator>Rick van der Arend</dc:creator>
		<pubDate>Wed, 21 Jul 2010 11:52:44 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308368</guid>
		<description>@stephan - maybe I misunderstood, could be. Your use of the words &#039;a queue&#039; led me to believe you thought there&#039;s only one queue in an actor model.

Sharing is still possible, of course.

Writing should be done asynchronously, through the actor and will be performed synchronously by that same actor. 

You can think of multiple solutions for reading. I would use event sourcing and local caching in the consuming actors. Also used in cqrs (&amp; its circular architecture).</description>
		<content:encoded><![CDATA[<p>@stephan &#8211; maybe I misunderstood, could be. Your use of the words &#8216;a queue&#8217; led me to believe you thought there&#8217;s only one queue in an actor model.</p>
<p>Sharing is still possible, of course.</p>
<p>Writing should be done asynchronously, through the actor and will be performed synchronously by that same actor. </p>
<p>You can think of multiple solutions for reading. I would use event sourcing and local caching in the consuming actors. Also used in cqrs (&amp; its circular architecture).</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308364</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 11:25:10 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308364</guid>
		<description>@rick: &quot; well, that would be the description of only one actor.&quot; 

How so?

The model obviously works for many queues with each consumer working as a producer and vice versa.

@Sushrut: No, please argue with the post. If your usecase describes shared data (tickets), then you cannot partition the solution in any way to not share data (at least that I know of).

More actors do not solve the problem.

And if your usecase does not involve sharing data, then well, why should you share data with any concurrency model?</description>
		<content:encoded><![CDATA[<p>@rick: &#8221; well, that would be the description of only one actor.&#8221; </p>
<p>How so?</p>
<p>The model obviously works for many queues with each consumer working as a producer and vice versa.</p>
<p>@Sushrut: No, please argue with the post. If your usecase describes shared data (tickets), then you cannot partition the solution in any way to not share data (at least that I know of).</p>
<p>More actors do not solve the problem.</p>
<p>And if your usecase does not involve sharing data, then well, why should you share data with any concurrency model?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sushrut</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308363</link>
		<dc:creator>Sushrut</dc:creator>
		<pubDate>Wed, 21 Jul 2010 11:15:14 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308363</guid>
		<description>I agree with Rick (above comment). Challenge (or rather use of Actors) is based on how you partition your model. In a system with 100s of producers and 100s of consumers use of actor model is useful based on how you partition it. And once you partition it, it becomes shared-nothing as per my understanding.</description>
		<content:encoded><![CDATA[<p>I agree with Rick (above comment). Challenge (or rather use of Actors) is based on how you partition your model. In a system with 100s of producers and 100s of consumers use of actor model is useful based on how you partition it. And once you partition it, it becomes shared-nothing as per my understanding.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick van der Arend</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308357</link>
		<dc:creator>Rick van der Arend</dc:creator>
		<pubDate>Wed, 21 Jul 2010 10:42:33 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308357</guid>
		<description>@stephan well, that would be the description of only one actor. 

The real work is not in the implementation of one actor, but in partitioning your model in such a way that these actors really represent asynchronous parts/components/aggregates in your domain model.</description>
		<content:encoded><![CDATA[<p>@stephan well, that would be the description of only one actor. </p>
<p>The real work is not in the implementation of one actor, but in partitioning your model in such a way that these actors really represent asynchronous parts/components/aggregates in your domain model.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308356</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 10:29:12 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308356</guid>
		<description>@Rick: I think it&#039;s better to say: using the actor model is the same as: Use a queue with multiple producers and a single worker.</description>
		<content:encoded><![CDATA[<p>@Rick: I think it&#8217;s better to say: using the actor model is the same as: Use a queue with multiple producers and a single worker.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick van der Arend</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308354</link>
		<dc:creator>Rick van der Arend</dc:creator>
		<pubDate>Wed, 21 Jul 2010 10:21:05 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308354</guid>
		<description>@Stephan if you say that using the &#039;Actor Model&#039; is basically the same as: &#039;Don&#039;t use multiple threads on the same data&#039; - on a technical level, I would agree with you.

Conceptually, it&#039;s going back to the roots of OO, where Objects are fully encapsulated and can only message to each other (the way Alan Kay meant it to be).

Concluding, (and @Dimitris) so the hype is a bit undeserved, it&#039;s mostly doing away with threads. Of course one should embrace it fully and only use one-way, asynchronous messaging (preferably eventing). So no request-response look-a-likes. This way, locking, race conditions and the like will not be a problem any more. Does this pose a formidable design challenge? Yes it does.</description>
		<content:encoded><![CDATA[<p>@Stephan if you say that using the &#8216;Actor Model&#8217; is basically the same as: &#8216;Don&#8217;t use multiple threads on the same data&#8217; &#8211; on a technical level, I would agree with you.</p>
<p>Conceptually, it&#8217;s going back to the roots of OO, where Objects are fully encapsulated and can only message to each other (the way Alan Kay meant it to be).</p>
<p>Concluding, (and @Dimitris) so the hype is a bit undeserved, it&#8217;s mostly doing away with threads. Of course one should embrace it fully and only use one-way, asynchronous messaging (preferably eventing). So no request-response look-a-likes. This way, locking, race conditions and the like will not be a problem any more. Does this pose a formidable design challenge? Yes it does.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308352</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 10:10:27 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308352</guid>
		<description>@Dimitris: Thanks for the link. 

&quot; I was quite annoyed with the sheer audaciousness of it.&quot; 

I often feel the same.</description>
		<content:encoded><![CDATA[<p>@Dimitris: Thanks for the link. </p>
<p>&#8221; I was quite annoyed with the sheer audaciousness of it.&#8221; </p>
<p>I often feel the same.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Dimitris Andreou</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308350</link>
		<dc:creator>Dimitris Andreou</dc:creator>
		<pubDate>Wed, 21 Jul 2010 10:03:42 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308350</guid>
		<description>You are certainly not alone. E.g. here is a (somewhat) related piece I wrote in January: http://code-o-matic.blogspot.com/2010/01/thoughts-on-actors.html

It&#039;s not the new concurrency. It&#039;s a slightly higher level programming interface, a bit cleaner than MPI, and it&#039;s important to note that all the usual concurrency problems are *still here with us* (deadlocks, races, etc, all can be easily simulated). Seeing some slides of a JavaOne conference, titled, &quot;Concurrency - You are doing it wrong&quot; (basically claiming that using java.util.concurrent is wrong, we should be using actors instead, that&#039;s the &quot;true way&quot; now!), I was quite annoyed with the sheer audaciousness of it. 

I currently prefer lower level tools, more control, more easy to reason about performance, and so on. Actors are also good, I might use them more when the hype has died down.</description>
		<content:encoded><![CDATA[<p>You are certainly not alone. E.g. here is a (somewhat) related piece I wrote in January: <a href="http://code-o-matic.blogspot.com/2010/01/thoughts-on-actors.html" rel="nofollow">http://code-o-matic.blogspot.com/2010/01/thoughts-on-actors.html</a></p>
<p>It&#8217;s not the new concurrency. It&#8217;s a slightly higher level programming interface, a bit cleaner than MPI, and it&#8217;s important to note that all the usual concurrency problems are *still here with us* (deadlocks, races, etc, all can be easily simulated). Seeing some slides of a JavaOne conference, titled, &#8220;Concurrency &#8211; You are doing it wrong&#8221; (basically claiming that using java.util.concurrent is wrong, we should be using actors instead, that&#8217;s the &#8220;true way&#8221; now!), I was quite annoyed with the sheer audaciousness of it. </p>
<p>I currently prefer lower level tools, more control, more easy to reason about performance, and so on. Actors are also good, I might use them more when the hype has died down.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308348</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 10:01:41 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308348</guid>
		<description>@Rick: And with blocking sync send it essentially does not matter if the other actor is running in another thread.

And the problem goes away when using async send, which I wrote in the post.</description>
		<content:encoded><![CDATA[<p>@Rick: And with blocking sync send it essentially does not matter if the other actor is running in another thread.</p>
<p>And the problem goes away when using async send, which I wrote in the post.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308347</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 10:00:39 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308347</guid>
		<description>@Rick: &quot;The important difference is, however, that they cannot cause two threads to run through the same actor, at the same time.&quot;

Yes, because the actor acts as a semaphore (wlock). 

Waiting for your post :-)</description>
		<content:encoded><![CDATA[<p>@Rick: &#8220;The important difference is, however, that they cannot cause two threads to run through the same actor, at the same time.&#8221;</p>
<p>Yes, because the actor acts as a semaphore (wlock). </p>
<p>Waiting for your post :-)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rick van der Arend</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308346</link>
		<dc:creator>Rick van der Arend</dc:creator>
		<pubDate>Wed, 21 Jul 2010 09:57:32 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308346</guid>
		<description>I can remember us sort of having the same discussion on twitter (@rvdarend is the handle). :)

You are talking about sharing state. If your definition of sharing is: &quot;they have a way of viewing and changing the same data&quot; - I agree. 

The key point here is that it&#039;s the actor that contains the state that is synchronizing these reads and writes.

So, yes, you can simulate actors bij having threads and locks and different actors can &#039;share state&#039; by messaging to the same third actor. The important difference is, however, that they cannot cause two threads to run through the same actor, at the same time.

All of this means that actors could be in completely different processes, on different hardware even. Now that&#039;s a difference with threads running through the same, synchronous model.

And actually, all of this doesn&#039;t mean actors have unique possibilities, far from it. It actually means you do not use a certain possiblity: multiple threads (on the same state/objects). 

For this to work, one needs another way of having concurrency, that is where partitioning your model in smaller components comes in. I therefore think &#039;Actors&#039; should contain &#039;Aggregates&#039;. I&#039;ll be blogging/presenting about this soon.</description>
		<content:encoded><![CDATA[<p>I can remember us sort of having the same discussion on twitter (@rvdarend is the handle). :)</p>
<p>You are talking about sharing state. If your definition of sharing is: &#8220;they have a way of viewing and changing the same data&#8221; &#8211; I agree. </p>
<p>The key point here is that it&#8217;s the actor that contains the state that is synchronizing these reads and writes.</p>
<p>So, yes, you can simulate actors bij having threads and locks and different actors can &#8217;share state&#8217; by messaging to the same third actor. The important difference is, however, that they cannot cause two threads to run through the same actor, at the same time.</p>
<p>All of this means that actors could be in completely different processes, on different hardware even. Now that&#8217;s a difference with threads running through the same, synchronous model.</p>
<p>And actually, all of this doesn&#8217;t mean actors have unique possibilities, far from it. It actually means you do not use a certain possiblity: multiple threads (on the same state/objects). </p>
<p>For this to work, one needs another way of having concurrency, that is where partitioning your model in smaller components comes in. I therefore think &#8216;Actors&#8217; should contain &#8216;Aggregates&#8217;. I&#8217;ll be blogging/presenting about this soon.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308343</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 09:41:54 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308343</guid>
		<description>Considering

&quot;Second, actors don’t need locks on their own state, because it’s accessed by one and only one thread: [...]&quot;

Sometimes people say an actor has a thread (lightweight), but I think it&#039;s better to think of the mailbox being a queue with one worker thread, the actor.</description>
		<content:encoded><![CDATA[<p>Considering</p>
<p>&#8220;Second, actors don’t need locks on their own state, because it’s accessed by one and only one thread: [...]&#8221;</p>
<p>Sometimes people say an actor has a thread (lightweight), but I think it&#8217;s better to think of the mailbox being a queue with one worker thread, the actor.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308341</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 09:34:50 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308341</guid>
		<description>@Sergio: It does not matter if they see the state or not.

Pseudo Syntax:
&lt;code&gt;
class C1 {
    TicketManager m = ...
}

class C2 {
    TicketManager m = ...
}

class TicketManager {
   private int tickets = 10;
   
   def synchronized dec() {
     if (tickets &gt; 0) tickets--;
   }
}
&lt;/code&gt;

Neither C1 or C2 see the &quot;state&quot; in TicketManager. But obviously they share indirectly the &lt;code&gt;tickets&lt;/code&gt; state.

Second: Well this was my explaination why actors do not have liveness and deadlock problems, but it&#039;s not because they have no semaphores an not because they do not share state.</description>
		<content:encoded><![CDATA[<p>@Sergio: It does not matter if they see the state or not.</p>
<p>Pseudo Syntax:<br />
<code><br />
class C1 {<br />
    TicketManager m = ...<br />
}</p>
<p>class C2 {<br />
    TicketManager m = ...<br />
}</p>
<p>class TicketManager {<br />
   private int tickets = 10;</p>
<p>   def synchronized dec() {<br />
     if (tickets > 0) tickets--;<br />
   }<br />
}<br />
</code></p>
<p>Neither C1 or C2 see the &#8220;state&#8221; in TicketManager. But obviously they share indirectly the <code>tickets</code> state.</p>
<p>Second: Well this was my explaination why actors do not have liveness and deadlock problems, but it&#8217;s not because they have no semaphores an not because they do not share state.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Bossa</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308333</link>
		<dc:creator>Sergio Bossa</dc:creator>
		<pubDate>Wed, 21 Jul 2010 08:44:54 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308333</guid>
		<description>First, why do you say several actors share the state of the TicketActor? 
They may hold a reference to its address/pid/whatever, but they don&#039;t see its state: the reference is used only for sending messages.

Second, I&#039;ve got your point but again, you have to switch your point of view from &quot;no locks/semaphores&quot; to &quot;no liveness problems&quot;: does it clarify?</description>
		<content:encoded><![CDATA[<p>First, why do you say several actors share the state of the TicketActor?<br />
They may hold a reference to its address/pid/whatever, but they don&#8217;t see its state: the reference is used only for sending messages.</p>
<p>Second, I&#8217;ve got your point but again, you have to switch your point of view from &#8220;no locks/semaphores&#8221; to &#8220;no liveness problems&#8221;: does it clarify?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308328</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 08:23:52 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308328</guid>
		<description>@Sergio: My &lt;code&gt;synchronized&lt;/code&gt; TicketManager does use the number of tickets has inc() and dec() methods and a R/W lock. It does not leak state either.

Several actors share the state of the TicketActor by holding references to the TicketActor and synchronizing via the mailbox of the TicketActor.

Second: The accessing by only one thread and a sequential mailbox is essentially a lock - you do not need to have a lock class to have a lock. Perhaps I should have better used the word semaphore.</description>
		<content:encoded><![CDATA[<p>@Sergio: My <code>synchronized</code> TicketManager does use the number of tickets has inc() and dec() methods and a R/W lock. It does not leak state either.</p>
<p>Several actors share the state of the TicketActor by holding references to the TicketActor and synchronizing via the mailbox of the TicketActor.</p>
<p>Second: The accessing by only one thread and a sequential mailbox is essentially a lock &#8211; you do not need to have a lock class to have a lock. Perhaps I should have better used the word semaphore.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sergio Bossa</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308326</link>
		<dc:creator>Sergio Bossa</dc:creator>
		<pubDate>Wed, 21 Jul 2010 08:19:36 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308326</guid>
		<description>Hey Stephan,

I think you have two bugs in your reasoning.

First, even if actors actually have state, they don&#039;t make it leak to the outside: they just sit there waiting for messages, I don&#039;t see how you see this as a sharing mechanism.

Second, actors don&#039;t need locks on their own state, because it&#039;s accessed by one and only one thread: don&#039;t take the JVM as a reference, where locks are needed for ensuring memory visibility. Also, the correct way to interpret the statement &quot;actors have no locks&quot; is: actors have no contended or composed locks, that is, they don&#039;t have liveness problems.

Let me know if I misunderstood your reasoning ;)

Cheers!

Sergio B.</description>
		<content:encoded><![CDATA[<p>Hey Stephan,</p>
<p>I think you have two bugs in your reasoning.</p>
<p>First, even if actors actually have state, they don&#8217;t make it leak to the outside: they just sit there waiting for messages, I don&#8217;t see how you see this as a sharing mechanism.</p>
<p>Second, actors don&#8217;t need locks on their own state, because it&#8217;s accessed by one and only one thread: don&#8217;t take the JVM as a reference, where locks are needed for ensuring memory visibility. Also, the correct way to interpret the statement &#8220;actors have no locks&#8221; is: actors have no contended or composed locks, that is, they don&#8217;t have liveness problems.</p>
<p>Let me know if I misunderstood your reasoning ;)</p>
<p>Cheers!</p>
<p>Sergio B.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stephan</title>
		<link>http://codemonkeyism.com/actor-myths/comment-page-1/#comment-308324</link>
		<dc:creator>stephan</dc:creator>
		<pubDate>Wed, 21 Jul 2010 08:11:37 +0000</pubDate>
		<guid isPermaLink="false">http://codemonkeyism.com/?p=1849#comment-308324</guid>
		<description>Put differently: Actors are sharing other actors (with their state guarded by a lock which is defined by the sequential processing of the inbox).</description>
		<content:encoded><![CDATA[<p>Put differently: Actors are sharing other actors (with their state guarded by a lock which is defined by the sequential processing of the inbox).</p>
]]></content:encoded>
	</item>
</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk (user agent is rejected)
Database Caching 7/57 queries in 0.108 seconds using disk

Served from: codemonkeyism.com @ 2012-02-09 02:18:11 -->
