<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Feedback requested: Enumerating Concurrent Collections</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx</link><description>The June 2008 CTP of Parallel Extensions contained a first look at some of the work we're doing to augment the .NET Framework with a set of additional coordination data structures that aid in the development of highly concurrent applications.&amp;#160; This</description><dc:language>en-US</dc:language><generator>Telligent Evolution Platform Developer Build (Build: 5.6.50428.7875)</generator><item><title> Parallel Programming with NET Feedback requested Enumerating | Insomnia Cure</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#9710345</link><pubDate>Tue, 09 Jun 2009 01:27:35 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9710345</guid><dc:creator> Parallel Programming with NET Feedback requested Enumerating | Insomnia Cure</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://insomniacuresite.info/story.php?id=9257"&gt;http://insomniacuresite.info/story.php?id=9257&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9710345" width="1" height="1"&gt;</description></item><item><title> Parallel Programming with NET Feedback requested Enumerating | Weak Bladder</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#9705860</link><pubDate>Mon, 08 Jun 2009 04:44:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9705860</guid><dc:creator> Parallel Programming with NET Feedback requested Enumerating | Weak Bladder</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://weakbladder.info/story.php?id=2525"&gt;http://weakbladder.info/story.php?id=2525&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9705860" width="1" height="1"&gt;</description></item><item><title>re: Feedback requested: Enumerating Concurrent Collections</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#9545931</link><pubDate>Sun, 12 Apr 2009 02:12:28 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9545931</guid><dc:creator>Jerome Paradis</dc:creator><description>&lt;p&gt;Here's a scenario I'm looking at presently:&lt;/p&gt;
&lt;p&gt;An highly scalable distributed in-memory architecture, for millions of users. On a single server, you want all operations done in memory. Instead of using a disk based database with caching, the primary source of data is in memory. However, you want to synchronize changes to some data on disk (in a database) as live backup.&lt;/p&gt;
&lt;p&gt;On solution I'm looking at (that I'll have to benchmark) is to use queue(s) to flag updated data objects. Then, background process(es) could navigate the queue to make changes to disk while emptying objects from the queue while going through the queue.&lt;/p&gt;
&lt;p&gt;During the queue navigation, objects can be added to the queue from other in-memory updates.&lt;/p&gt;
&lt;p&gt;In that scenario, it does not really matter if added objects to the queue are visible while navigating the queue. If we reach the end, we can check if new objects where added to the queue. If not, we can sleep a bit and go back to check the queue.&lt;/p&gt;
&lt;p&gt;Of course, the example is simplified, but you get the idea. Such system would need to be benchmarked and probably need some multitheading balance to make sure the queues don't grow faster than they can eventually be emptied.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9545931" width="1" height="1"&gt;</description></item><item><title>re: Feedback requested: Enumerating Concurrent Collections</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#9523065</link><pubDate>Tue, 31 Mar 2009 18:50:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9523065</guid><dc:creator>supercat</dc:creator><description>&lt;p&gt;The ability to support a &amp;quot;delete what doesn't belong&amp;quot; pattern is very useful, and I see no reason an iEnumerable should not be allowed to support such a thing (even though some styles of collection might have trouble with implementing it, I see no reason for the contract to require an exception in cases where an enumeration would otherwise be able to handle things sensibly).&lt;/p&gt;
&lt;p&gt;If one is implementing a new design, I would suggest a &amp;quot;set options&amp;quot; method, along with an &amp;quot;available options&amp;quot; property, which would specify the acceptable/available behaviors for an enumerator in case of insertion and deletion (the bitmap passed to the method would offer a choice of acceptable options. &amp;nbsp;If none of the acceptable behaviors were available, an exception would be thrown when attempting to set the option. &amp;nbsp;Even if there were no settable options, the method could do nothing if the calling program's acceptable choices would work, and throw an exception if they would not.&lt;/p&gt;
&lt;p&gt;For most scenarios, I would suggest that the preferred handling would be to specify that (1) an object which is inserted during an enumeration may or may not appear in that enumeration, with or without a reset; (2) an object which is deleted during an enumeration may or may not appear even with a reset, but if the object has already been enumerated it will not reappear until a reset; (3) all objects which existed prior to the start of enumeration and which are not deleted will be enumerated once each; (4) if an ordering is specified for the enumerator, items will be output consistent with that order (e.g. if a items are to be enumerated in alphabetical order and &amp;quot;aardvark&amp;quot; is added after &amp;quot;elephant&amp;quot; has been enumerated, &amp;quot;aardvark&amp;quot; should not be included in that enumeration); (5) ordering of items following a reset is arbitrary unless specified otherwise.&lt;/p&gt;
&lt;p&gt;If one is designing a new interface for an enumerable type, it may be helpful to add a 64-bit 'ChangeSeed' value which, if sampled before the start of an enumeration and after its completion, will indicate whether anything in the collection may have changed during the enumeration. &amp;nbsp;There are many times when throwing an exception because something changed would be very nasty behavior, but knowing that something changed would nonetheless be very useful.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9523065" width="1" height="1"&gt;</description></item><item><title>re: Feedback requested: Enumerating Concurrent Collections</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#9519144</link><pubDate>Mon, 30 Mar 2009 17:56:19 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9519144</guid><dc:creator>Yurik</dc:creator><description>&lt;p&gt;I second all the requests for the concurrent priority queue implementation. It is badly needed in the framework, and being concurrent is paramount. Thanks!&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9519144" width="1" height="1"&gt;</description></item><item><title>re: Feedback requested: Enumerating Concurrent Collections</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#9470762</link><pubDate>Wed, 11 Mar 2009 20:04:07 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9470762</guid><dc:creator>BK</dc:creator><description>&lt;p&gt;This (below link) article describes a Concurrent collection in C# - MultiMap (similar to Dictionary)&lt;/p&gt;
&lt;p&gt;&lt;a rel="nofollow" target="_new" href="http://www.codeproject.com/KB/cs/MultiMap_P_2.aspx"&gt;http://www.codeproject.com/KB/cs/MultiMap_P_2.aspx&lt;/a&gt;&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9470762" width="1" height="1"&gt;</description></item><item><title>Websites tagged "concurrent" on Postsaver</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#9334552</link><pubDate>Sat, 17 Jan 2009 08:32:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9334552</guid><dc:creator>Websites tagged "concurrent" on Postsaver</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://www.postsaver.org/tags/concurrent"&gt;http://www.postsaver.org/tags/concurrent&lt;/a&gt;&lt;/p&gt;
&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9334552" width="1" height="1"&gt;</description></item><item><title>re: Feedback requested: Enumerating Concurrent Collections</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#8966450</link><pubDate>Fri, 26 Sep 2008 16:30:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8966450</guid><dc:creator>Stephen Toub - MSFT</dc:creator><description>&lt;p&gt;Frank, thanks for the suggestion. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thomas, thanks for the feedback. &amp;nbsp;There are a multitude of cases where seeing the latest and greatest version of a collection isn't all that important, and for those cases we've now heard quite a bit of feedback that support for concurrent enumeration is crucial. &amp;nbsp;As Softlion points out, this is very similar in nature to isolation levels in databases, and they have been used successfully for a long time. &amp;nbsp;Still, I definitely understand your concerns, as such capabilities do make it possible for developers to more easily make mistakes, assuming that the data they're looking at is both a snapshot and consistent with the current state of the collection.&lt;/p&gt;
&lt;p&gt;Softlion, thanks for the comparison. &amp;nbsp;You're not off subject at all.&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8966450" width="1" height="1"&gt;</description></item><item><title>re: Feedback requested: Enumerating Concurrent Collections</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#8962666</link><pubDate>Tue, 23 Sep 2008 22:59:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8962666</guid><dc:creator>Softlion</dc:creator><description>&lt;p&gt;Your problem can be compared to the problem resolved (or not) by database builders. In SQL Server this is called ISOLATION LEVEL.&lt;/p&gt;
&lt;p&gt;SQL Select statements (for reading a collection) have hints (options), among them &amp;quot;nolock&amp;quot; (reader may see new entries inserted by another thread) and &amp;quot;readpast&amp;quot; (reader will never see new entries) which can fully work as parallelized.&lt;/p&gt;
&lt;p&gt;So it may be a good idea to provide either one enumerator with an isolation level option, or at least two enumerators which behave differently: one for a nolock like reading, the other for a readpast like reading.&lt;/p&gt;
&lt;p&gt;I hope I'm not off subject !&lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8962666" width="1" height="1"&gt;</description></item><item><title>re: Feedback requested: Enumerating Concurrent Collections</title><link>http://blogs.msdn.com/b/pfxteam/archive/2008/08/12/8852005.aspx#8926988</link><pubDate>Sat, 06 Sep 2008 01:06:42 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8926988</guid><dc:creator>Thomas van der Ploeg</dc:creator><description>&lt;p&gt;I have a hard time imagining a scenario where an iterator pattern as such would be truly valuable on a concurrently updated collection. The set of values acquired and processed during the iteration will at best be somewhat similar as the set of values ‘contained’ in the collection. A snapshot variety doesn’t help much. &amp;nbsp;Since the ‘contents’ of the collection will be blurry at the moment the snapshot is taken the snapshot itself will be blurry as well.&lt;/p&gt;
&lt;p&gt;Using an iterator you would want to do one of two things. Either calculate a result or modify some state. &amp;nbsp;In the first case I would imagine some transformation methods taking a continuation like the ones defined in LINQ. A concurrent ‘Select’ method, for example, would transform the values of the source and its result would be a concurrently updated collection itself. It would effectively shield the developer of the nastiness of concurrency. &lt;/p&gt;
&lt;p&gt;When updating state some form of transaction would be required (STM?). A context wherein value sources can be queried and state updated in a safe manner. Such a context could be a required parameter for a new ‘GetEnumerator’ method.&lt;/p&gt;
&lt;p&gt;It could be an option to have collection change notifications sent to a client of a snapshot iterator. The code to handle these will be complex and I don’t think this will lead to any convenient form of programming. Possibly such a mechanism could be used to construct higher level functions like the coined concurrent ‘Select’ method.&lt;/p&gt;
&lt;p&gt;I think iterators in a truly concurrent environment without some form of transaction mechanism may have some niche uses but would in fact be a bad idea. They inherently have a very poor compatibility with multithreading and are an open invitation to software disasters. &lt;/p&gt;
&lt;div style="clear:both;"&gt;&lt;/div&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=8926988" width="1" height="1"&gt;</description></item></channel></rss>