<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	>
<channel>
	<title>Comments on: Smalltalk Concurrency, Playing With Futures</title>
	<atom:link href="http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/feed/" rel="self" type="application/rss+xml" />
	<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/</link>
	<description>thoughts on Smalltalk and programming in general...</description>
	<pubDate>Wed, 23 Jul 2008 20:22:46 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
		<item>
		<title>By: My Software Development Blog &#187; Blog Archive &#187; Getting philosophical about futures</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-11847</link>
		<dc:creator>My Software Development Blog &#187; Blog Archive &#187; Getting philosophical about futures</dc:creator>
		<pubDate>Wed, 12 Mar 2008 22:00:22 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-11847</guid>
		<description>[...] into how cool futures can be when the technology uses a sufficient amount of introspection.  The Smalltalk way is even more amazing (look at the very bottom of that article to see how easy it is to use). Very [...]</description>
		<content:encoded><![CDATA[<p>[...] into how cool futures can be when the technology uses a sufficient amount of introspection.  The Smalltalk way is even more amazing (look at the very bottom of that article to see how easy it is to use). Very [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-7045</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Thu, 01 Nov 2007 03:15:19 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-7045</guid>
		<description>If you're not watching, you should check out the &lt;a href="http://www.nabble.com/Concurrent-Futures-t4704094.html" rel="nofollow"&gt;thread this post started in squeak-dev&lt;/a&gt; where they're discussing *all* of these potential options and weighing the actual implementation options.  It's turned into a discussion on how to make the SqueakVM work with multiple core and cpu machines.  It's way over my head, so I'm just watching and learning, but it's been a great discussion so far.</description>
		<content:encoded><![CDATA[<p>If you&#8217;re not watching, you should check out the <a href="http://www.nabble.com/Concurrent-Futures-t4704094.html" rel="nofollow">thread this post started in squeak-dev</a> where they&#8217;re discussing *all* of these potential options and weighing the actual implementation options.  It&#8217;s turned into a discussion on how to make the SqueakVM work with multiple core and cpu machines.  It&#8217;s way over my head, so I&#8217;m just watching and learning, but it&#8217;s been a great discussion so far.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Miller</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-7039</link>
		<dc:creator>Mark Miller</dc:creator>
		<pubDate>Thu, 01 Nov 2007 00:02:10 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-7039</guid>
		<description>Re: concurrent OOP

The way I talked about it on the other forum was that all message sends could be concurrent, but a #continuation: message could be added to Object to allow sequential execution.

On second thought, there are other approaches that would probably be easier for people to deal with. Some other ideas knocking around my head are:

1) message receipt is concurrent, but message sending is blocking. We'd still need to keep the BlockClosure&#62;&#62;fork, and the futures/promise mechanism for concurrent execution of a block of code.

One of the points made by another participant in the discussion on the other forum was that in any program or system there's a need for &lt;i&gt;some&lt;/i&gt; execution to be sequential (or blocking). Not everything can run in parallel.

2) Maybe lazy evaluation behavior would fix that. Just assume concurrent execution until there's a dependency, and then block on that dependency unless otherwise specified. This is like futures, but it would be an inherent part of how the system works.</description>
		<content:encoded><![CDATA[<p>Re: concurrent OOP</p>
<p>The way I talked about it on the other forum was that all message sends could be concurrent, but a #continuation: message could be added to Object to allow sequential execution.</p>
<p>On second thought, there are other approaches that would probably be easier for people to deal with. Some other ideas knocking around my head are:</p>
<p>1) message receipt is concurrent, but message sending is blocking. We&#8217;d still need to keep the BlockClosure&gt;&gt;fork, and the futures/promise mechanism for concurrent execution of a block of code.</p>
<p>One of the points made by another participant in the discussion on the other forum was that in any program or system there&#8217;s a need for <i>some</i> execution to be sequential (or blocking). Not everything can run in parallel.</p>
<p>2) Maybe lazy evaluation behavior would fix that. Just assume concurrent execution until there&#8217;s a dependency, and then block on that dependency unless otherwise specified. This is like futures, but it would be an inherent part of how the system works.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Miller</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-7037</link>
		<dc:creator>Mark Miller</dc:creator>
		<pubDate>Wed, 31 Oct 2007 23:22:28 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-7037</guid>
		<description>&lt;i&gt;If I needed it, I’d subclass OrderedCollection and override and wrap all state changing methods with a critical block creating a thread safe OrderedCollection rather than doing critical sections outside like you did above. They all need to share the same semaphore.&lt;/i&gt;

I agree. This sounds like a better approach. The thing is, what about the state changing methods in its base classes as well? Not everything that's useful about an OrderedCollection is in that class.

Something I've been exploring conceptually with &lt;a href="http://techrepublic.com.com/5208-12845-0.html?forumID=102&#38;threadID=242182&#38;messageID=2347643" rel="nofollow"&gt;another blogger just recently&lt;/a&gt; is the idea of a concurrent OOP, redefining the semantics of it so the whole system is concurrent by design, with an allowance for sequential execution. The link points to my comments about this. The comment I was responding to is instructive as well, though I'm sure you're familiar with the metaphor being discussed.

I don't have the first clue about how to actually implement it yet, but I was just throwing about some ideas. When I look at OOP as defined by Kay, it seems natural that just as there is concurrency on the internet, there can be concurrency between objects. It seems like this is going to be needed fairly soon, don't you think?</description>
		<content:encoded><![CDATA[<p><i>If I needed it, I’d subclass OrderedCollection and override and wrap all state changing methods with a critical block creating a thread safe OrderedCollection rather than doing critical sections outside like you did above. They all need to share the same semaphore.</i></p>
<p>I agree. This sounds like a better approach. The thing is, what about the state changing methods in its base classes as well? Not everything that&#8217;s useful about an OrderedCollection is in that class.</p>
<p>Something I&#8217;ve been exploring conceptually with <a href="http://techrepublic.com.com/5208-12845-0.html?forumID=102&amp;threadID=242182&amp;messageID=2347643" rel="nofollow">another blogger just recently</a> is the idea of a concurrent OOP, redefining the semantics of it so the whole system is concurrent by design, with an allowance for sequential execution. The link points to my comments about this. The comment I was responding to is instructive as well, though I&#8217;m sure you&#8217;re familiar with the metaphor being discussed.</p>
<p>I don&#8217;t have the first clue about how to actually implement it yet, but I was just throwing about some ideas. When I look at OOP as defined by Kay, it seems natural that just as there is concurrency on the internet, there can be concurrency between objects. It seems like this is going to be needed fairly soon, don&#8217;t you think?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6990</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Wed, 31 Oct 2007 00:38:38 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6990</guid>
		<description>Yea, I don't know a way around the use of #critical: sections, and that's all a SharedQueue does.  If I needed it, I'd subclass OrderedCollection and override and wrap all state changing methods with a critical block creating a thread safe OrderedCollection rather than doing critical sections outside like you did above.  They all need to share the same semaphore.

Don't know anything about video, sorry.</description>
		<content:encoded><![CDATA[<p>Yea, I don&#8217;t know a way around the use of #critical: sections, and that&#8217;s all a SharedQueue does.  If I needed it, I&#8217;d subclass OrderedCollection and override and wrap all state changing methods with a critical block creating a thread safe OrderedCollection rather than doing critical sections outside like you did above.  They all need to share the same semaphore.</p>
<p>Don&#8217;t know anything about video, sorry.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Miller</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6981</link>
		<dc:creator>Mark Miller</dc:creator>
		<pubDate>Tue, 30 Oct 2007 20:43:53 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6981</guid>
		<description>@Ramon:

We could use the blog example you had earlier in Seaside, where you store blog posts and comments to them in OrderedCollections. You eventually went to a database, but I remember you said you wanted to use it only as a backup, that you would keep data in memory along with the database.

What I remember is you had the "component thread" (in Seaside), I guess, add to the OrderedCollection, but this creates a problem of multiple threads potentially adding to the collection at the same time. I'm talking about a shared resource.

You could use a critical section for this, inside an #add method in the class where you kept the OrderedCollection, I guess:

Blog&#62;&#62;add: comment
   &#124; sema &#124;
   sema := Semaphore forMutualExclusion.
   sema critical: [comments add: comment]

There's also the issue of sharing data between threads. I've heard others say SharedQueue is the best way to handle that. I've tried it and it works. I was trying out some code to see if I could do screen recording in Squeak. I got a little something working. In one thread I captured forms (frames) of the whole screen and put them into a SharedQueue. Another thread on a lower priority listened on the SharedQueue, grabbed frames out, and saved them to individual files. Later I could play them back, using a different routine, to see how it worked out.

BTW, perhaps this is out of your area of expertise, but maybe somebody else knows. Where could I find specs on video file formats? I tried looking up MPEG-1. The results I got indicated that somebody owns the rights to it, and you have to pay to get the spec. Is that correct?</description>
		<content:encoded><![CDATA[<p>@Ramon:</p>
<p>We could use the blog example you had earlier in Seaside, where you store blog posts and comments to them in OrderedCollections. You eventually went to a database, but I remember you said you wanted to use it only as a backup, that you would keep data in memory along with the database.</p>
<p>What I remember is you had the &#8220;component thread&#8221; (in Seaside), I guess, add to the OrderedCollection, but this creates a problem of multiple threads potentially adding to the collection at the same time. I&#8217;m talking about a shared resource.</p>
<p>You could use a critical section for this, inside an #add method in the class where you kept the OrderedCollection, I guess:</p>
<p>Blog&gt;&gt;add: comment<br />
   | sema |<br />
   sema := Semaphore forMutualExclusion.<br />
   sema critical: [comments add: comment]</p>
<p>There&#8217;s also the issue of sharing data between threads. I&#8217;ve heard others say SharedQueue is the best way to handle that. I&#8217;ve tried it and it works. I was trying out some code to see if I could do screen recording in Squeak. I got a little something working. In one thread I captured forms (frames) of the whole screen and put them into a SharedQueue. Another thread on a lower priority listened on the SharedQueue, grabbed frames out, and saved them to individual files. Later I could play them back, using a different routine, to see how it worked out.</p>
<p>BTW, perhaps this is out of your area of expertise, but maybe somebody else knows. Where could I find specs on video file formats? I tried looking up MPEG-1. The results I got indicated that somebody owns the rights to it, and you have to pay to get the spec. Is that correct?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6945</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Tue, 30 Oct 2007 07:37:12 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6945</guid>
		<description>I'm not sure I follow, this example was collecting data from multiple threads.  Can you give me a more concrete example?  

I was planning on doing another example of a Promise next which is like a future anyone can fulfill.</description>
		<content:encoded><![CDATA[<p>I&#8217;m not sure I follow, this example was collecting data from multiple threads.  Can you give me a more concrete example?  </p>
<p>I was planning on doing another example of a Promise next which is like a future anyone can fulfill.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Mark Miller</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6940</link>
		<dc:creator>Mark Miller</dc:creator>
		<pubDate>Tue, 30 Oct 2007 05:52:47 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6940</guid>
		<description>Hi Ramon. This is very nice. I'm wondering about going the other way as well: an unthreaded object receiving messages from multiple threads. It sounds like there are various ways of dealing with this scenario: semaphores, streams, monitors, and SharedQueue. Is there a simple construct like futures that helps with this scenario? A lot of the examples I see endorse the idea of using semaphores and critical sections for this.</description>
		<content:encoded><![CDATA[<p>Hi Ramon. This is very nice. I&#8217;m wondering about going the other way as well: an unthreaded object receiving messages from multiple threads. It sounds like there are various ways of dealing with this scenario: semaphores, streams, monitors, and SharedQueue. Is there a simple construct like futures that helps with this scenario? A lot of the examples I see endorse the idea of using semaphores and critical sections for this.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6928</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Mon, 29 Oct 2007 23:04:12 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6928</guid>
		<description>True, I'll add it.</description>
		<content:encoded><![CDATA[<p>True, I&#8217;ll add it.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marcin Tustin</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6926</link>
		<dc:creator>Marcin Tustin</dc:creator>
		<pubDate>Mon, 29 Oct 2007 21:16:00 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6926</guid>
		<description>Question: why not have a method to test to see if the value is ready? That should make reducing a collection of futures faster if the reduction operation is commutative, because you can reduce the available futures first.</description>
		<content:encoded><![CDATA[<p>Question: why not have a method to test to see if the value is ready? That should make reducing a collection of futures faster if the reduction operation is commutative, because you can reduce the available futures first.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ramon Leon</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6861</link>
		<dc:creator>Ramon Leon</dc:creator>
		<pubDate>Sun, 28 Oct 2007 17:02:45 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6861</guid>
		<description>Well, I'm sure you know this but Promises aren't quite the same thing as futures, though they're often mixed up, nor are they always implemented as proxies.  Squeak also doesn't have them built in, which is why I wanted to hack one up and try it out.

However, having a look at the VisualWorks implementation, I can see why they implemented Promise instead of Future since Futures can be implemented via a promise from a forked block.  Interesting indeed.</description>
		<content:encoded><![CDATA[<p>Well, I&#8217;m sure you know this but Promises aren&#8217;t quite the same thing as futures, though they&#8217;re often mixed up, nor are they always implemented as proxies.  Squeak also doesn&#8217;t have them built in, which is why I wanted to hack one up and try it out.</p>
<p>However, having a look at the VisualWorks implementation, I can see why they implemented Promise instead of Future since Futures can be implemented via a promise from a forked block.  Interesting indeed.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isaac Gouy</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6859</link>
		<dc:creator>Isaac Gouy</dc:creator>
		<pubDate>Sun, 28 Oct 2007 16:28:23 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6859</guid>
		<description>Also GNU Smalltalk

http://www.gnu.org/software/smalltalk/manual-base/html_node/Promise.html</description>
		<content:encoded><![CDATA[<p>Also GNU Smalltalk</p>
<p><a href="http://www.gnu.org/software/smalltalk/manual-base/html_node/Promise.html" rel="nofollow">http://www.gnu.org/software/smalltalk/manual-base/html_node/Promise.html</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Isaac Gouy</title>
		<link>http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6835</link>
		<dc:creator>Isaac Gouy</dc:creator>
		<pubDate>Sun, 28 Oct 2007 04:09:53 +0000</pubDate>
		<guid isPermaLink="false">http://onsmalltalk.com/programming/smalltalk/smalltalk-concurrency-playing-with-futures/#comment-6835</guid>
		<description>In Cincom Smalltalk (aka VisualWorks) you'll find the functionality and supporting methods named 

Promise</description>
		<content:encoded><![CDATA[<p>In Cincom Smalltalk (aka VisualWorks) you&#8217;ll find the functionality and supporting methods named </p>
<p>Promise</p>
]]></content:encoded>
	</item>
</channel>
</rss>
