<?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: Software is sucks? Probably it really is!</title>
	<atom:link href="http://khason.net/blog/software-is-sucks-probably-it-really-is/feed/" rel="self" type="application/rss+xml" />
	<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/</link>
	<description>Take care of the sense, and the sounds will take care of themselves.</description>
	<lastBuildDate>Tue, 07 Feb 2012 22:44:08 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: ekampf</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-1002</link>
		<dc:creator>ekampf</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:26 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-1002</guid>
		<description>&lt;p&gt;According to the docs I read on MSDN:&lt;/p&gt;
&lt;p&gt;The Parallel.Do method is a static method that takes two or more delegates as arguments and potentially executes them in parallel. &lt;/p&gt;
&lt;p&gt;So running Parallel.Do(MessMe); should be pretty much like running MessMe();&lt;/p&gt;
&lt;p&gt;Parallel.For() actually runs the interations in multiple threads so it works faster but requires you to make sure the iterations are independent of each other.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>According to the docs I read on MSDN:</p>
<p>The Parallel.Do method is a static method that takes two or more delegates as arguments and potentially executes them in parallel. </p>
<p>So running Parallel.Do(MessMe); should be pretty much like running MessMe();</p>
<p>Parallel.For() actually runs the interations in multiple threads so it works faster but requires you to make sure the iterations are independent of each other.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tamir Khason</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-1001</link>
		<dc:creator>Tamir Khason</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:25 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-1001</guid>
		<description>&lt;p&gt;Eran, try to run MessMe twice - you&#039;ll get the same result :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Eran, try to run MessMe twice &#8211; you&#8217;ll get the same result <img src='http://khason.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: עומר ון קלוטן</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-1000</link>
		<dc:creator>עומר ון קלוטן</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:24 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-1000</guid>
		<description>&lt;p&gt;When you ran Do, you told the framework to run your code as is, as an atomic unit. Running it twice just tells the framework that it can run the atomic units of code on two processors (or threads) at the same time, but it will still not have the freedom to divide the work itself.&lt;/p&gt;
&lt;p&gt;When you ran For, you told the framework to do the work division for you, which means that you gave it more freedom to parallelize your code.&lt;/p&gt;
&lt;p&gt;More here: &lt;a rel=&quot;nofollow&quot; target=&quot;_new&quot; href=&quot;http://msdn.microsoft.com/msdnmag/issues/07/10/Futures/default.aspx&quot; rel=&quot;nofollow&quot;&gt;msdn.microsoft.com/.../default.aspx&lt;/a&gt;&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>When you ran Do, you told the framework to run your code as is, as an atomic unit. Running it twice just tells the framework that it can run the atomic units of code on two processors (or threads) at the same time, but it will still not have the freedom to divide the work itself.</p>
<p>When you ran For, you told the framework to do the work division for you, which means that you gave it more freedom to parallelize your code.</p>
<p>More here: <a rel="nofollow" target="_new" href="http://msdn.microsoft.com/msdnmag/issues/07/10/Futures/default.aspx" rel="nofollow">msdn.microsoft.com/&#8230;/default.aspx</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ekampf</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-999</link>
		<dc:creator>ekampf</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:23 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-999</guid>
		<description>&lt;p&gt;Hey, my machine has .NET 3.5 beta2 and highly unstable O14 bits that I just got working...&lt;/p&gt;
&lt;p&gt;I&#039;m not risking any other CTP\WIP bits installations now :)&lt;/p&gt;
&lt;p&gt;Anyway, there&#039;s a difference between running parallization on MessMe which contains a for loop inside than running Parallel.For whith a delegate that represent one loop iteration.&lt;/p&gt;
&lt;p&gt;I don&#039;t think Parallel.Do(MessMe); can go inside MessMe() and parallelize the fir loop inside it (it can&#039;t know or assume that the iterations are not dependent and MessMe should be an atomic operation for it)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Hey, my machine has .NET 3.5 beta2 and highly unstable O14 bits that I just got working&#8230;</p>
<p>I&#8217;m not risking any other CTP\WIP bits installations now <img src='http://khason.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Anyway, there&#8217;s a difference between running parallization on MessMe which contains a for loop inside than running Parallel.For whith a delegate that represent one loop iteration.</p>
<p>I don&#8217;t think Parallel.Do(MessMe); can go inside MessMe() and parallelize the fir loop inside it (it can&#8217;t know or assume that the iterations are not dependent and MessMe should be an atomic operation for it)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: ekampf</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-998</link>
		<dc:creator>ekampf</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:22 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-998</guid>
		<description>&lt;p&gt;What&#039;s that spanish site that keeps syndicating you?&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>What&#8217;s that spanish site that keeps syndicating you?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tamir Khason</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-997</link>
		<dc:creator>Tamir Khason</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:20 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-997</guid>
		<description>&lt;p&gt;Eran, just another spammer&lt;/p&gt;
&lt;p&gt;Eran, Omer - the question is not how to use it, but in current 3.5 RTM a lot of this concept already implemented&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Eran, just another spammer</p>
<p>Eran, Omer &#8211; the question is not how to use it, but in current 3.5 RTM a lot of this concept already implemented</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tamir Khason</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-995</link>
		<dc:creator>Tamir Khason</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:19 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-995</guid>
		<description>&lt;p&gt;It was rather statement, then question :) Something like: &quot;I know for sure, that i&#039;m doing wrong, but why should you (as CLR team) make me able to do things wrong.&lt;/p&gt;
&lt;p&gt;Back to connection of context. &lt;/p&gt;
&lt;p&gt;Assembler - if you&#039;re doing something wrong, you&#039;re get very bad results&lt;/p&gt;
&lt;p&gt;C++ - if you&#039;re doing something wrong, you&#039;re get blue screen or nothing works&lt;/p&gt;
&lt;p&gt;C# 1.1-2.0 - you, probably, can do things wrong, but you&#039;re going pay for it&lt;/p&gt;
&lt;p&gt;C# 3.0-3.5+ - you, probably, do something wrong, &#039;cos we have too much things to do wrong&lt;/p&gt;
&lt;p&gt;C# 4.0 and up - I do not want to be developer, due to fact, that if I&#039;ll do something ok, I&#039;ll get very bad results&lt;/p&gt;
&lt;p&gt;That&#039;s my point:)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>It was rather statement, then question <img src='http://khason.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Something like: &quot;I know for sure, that i&#8217;m doing wrong, but why should you (as CLR team) make me able to do things wrong.</p>
<p>Back to connection of context. </p>
<p>Assembler &#8211; if you&#8217;re doing something wrong, you&#8217;re get very bad results</p>
<p>C++ &#8211; if you&#8217;re doing something wrong, you&#8217;re get blue screen or nothing works</p>
<p>C# 1.1-2.0 &#8211; you, probably, can do things wrong, but you&#8217;re going pay for it</p>
<p>C# 3.0-3.5+ &#8211; you, probably, do something wrong, &#8216;cos we have too much things to do wrong</p>
<p>C# 4.0 and up &#8211; I do not want to be developer, due to fact, that if I&#8217;ll do something ok, I&#8217;ll get very bad results</p>
<p>That&#8217;s my point:)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: עומר ון קלוטן</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-996</link>
		<dc:creator>עומר ון קלוטן</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:19 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-996</guid>
		<description>&lt;p&gt;I thought the question was:&lt;/p&gt;
&lt;p&gt;&quot;please someone can explain me what exactly wrong I&#039;m doing?&quot;&lt;/p&gt;
&lt;p&gt;Which to me read:&lt;/p&gt;
&lt;p&gt;&quot;how should I use this?&quot;&lt;/p&gt;
&lt;p&gt;But maybe I&#039;m off here. What is the question being posed by this post? :)&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>I thought the question was:</p>
<p>&quot;please someone can explain me what exactly wrong I&#8217;m doing?&quot;</p>
<p>Which to me read:</p>
<p>&quot;how should I use this?&quot;</p>
<p>But maybe I&#8217;m off here. What is the question being posed by this post? <img src='http://khason.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Bill</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-994</link>
		<dc:creator>Bill</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:18 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-994</guid>
		<description>&lt;p&gt;Parallel.Do is not intended to run a single function/delegate over multiple processers, it will simply run as many functions as it can from its param list at the same time.&lt;/p&gt;
&lt;p&gt;Parallel.For will run the parallel delegate as many times as it can at the same time with the different inputs.&lt;/p&gt;
&lt;p&gt;Your test is probably not very good in that you are writing to a static object. There could be locking issues there.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>Parallel.Do is not intended to run a single function/delegate over multiple processers, it will simply run as many functions as it can from its param list at the same time.</p>
<p>Parallel.For will run the parallel delegate as many times as it can at the same time with the different inputs.</p>
<p>Your test is probably not very good in that you are writing to a static object. There could be locking issues there.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Sasha Goldshtein</title>
		<link>http://khason.net/blog/software-is-sucks-probably-it-really-is/comment-page-1/#comment-993</link>
		<dc:creator>Sasha Goldshtein</dc:creator>
		<pubDate>Thu, 01 Jan 2009 08:31:17 +0000</pubDate>
		<guid isPermaLink="false">http://khason.net/blog/software-is-sucks-probably-it-really-is/#comment-993</guid>
		<description>&lt;p&gt;You didn&#039;t post the entire test harness, and I found it quite difficult to follow exactly what you were measuring. &#160;As other commenters noted, Parallel.Do(MessMe) and a direct call to MessMe() are essentially the same, sans little initial overhead from using the parallel version, which should be amortized with time.&lt;/p&gt;
&lt;p&gt;However, what you should bear in mind that your code spends most of its time in kernel mode, executing Console.KeyAvailable (which boils down to kernel32!PeekConsoleInput). &#160;So this is really a bad example of parallelizing anything, since the majority of work here is polling the console input handle.&lt;/p&gt;
&lt;p&gt;The following is a slightly better scenario which shows the added value of parallel extensions, because the work is CPU-bound:&lt;/p&gt;
&lt;p&gt; &#160; &#160; &#160; &#160;static int primeSum;&lt;/p&gt;
&lt;p&gt; &#160; &#160; &#160; &#160;static void Compute(int i)&lt;/p&gt;
&lt;p&gt; &#160; &#160; &#160; &#160;{&lt;/p&gt;
&lt;p&gt; &#160; &#160; &#160; &#160; &#160; &#160;for (int j = 1; j &lt;= Math.Sqrt(i); ++j)&lt;/p&gt;
&lt;p&gt; &#160; &#160; &#160; &#160; &#160; &#160;{&lt;/p&gt;
&lt;p&gt; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;if (i % j == 0)&lt;/p&gt;
&lt;p&gt; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160; &#160;primeSum += j;&lt;/p&gt;
&lt;p&gt; &#160; &#160; &#160; &#160; &#160; &#160;}&lt;/p&gt;
&lt;p&gt; &#160; &#160; &#160; &#160;}&lt;/p&gt;
&lt;p&gt;Take this method and call it 500,000 times and here&#039;s what you get on my PC (a modest Core 2 Duo 1.86 GHz)...&lt;/p&gt;
&lt;p&gt;Using a simple loop (from 0 to 500,000) it performs 40,900 operations per second with 50% CPU utilization.&lt;/p&gt;
&lt;p&gt;Using Parallel.For (from 0 to 500,000) it performs 77,000 operations per second (which is really good, considering that the first few thousand invocations of Compute are really really cheap and therefore the overhead of the delegate call dominates), with 100% CPU utilization.&lt;/p&gt;
&lt;p&gt;Using Parallel.Do it performs 40,400 operations per second (which is the amortized cost of the initial Parallel.Do overhead), with 50% CPU utilization.&lt;/p&gt;
&lt;p&gt;All these results are perfectly on par with the way the parallel extensions are supposed to work. &#160;In fact, it&#039;s hardly magic - you could easily implement this kind of framework yourself. &#160;What I find valuable here is that Microsoft finally released a parallelization framework which might actually be accessible for those 80% of developers who do not read blogs, read books or attend conferences. &#160;And that&#039;s what makes me happy.&lt;/p&gt;
</description>
		<content:encoded><![CDATA[<p>You didn&#8217;t post the entire test harness, and I found it quite difficult to follow exactly what you were measuring. &nbsp;As other commenters noted, Parallel.Do(MessMe) and a direct call to MessMe() are essentially the same, sans little initial overhead from using the parallel version, which should be amortized with time.</p>
<p>However, what you should bear in mind that your code spends most of its time in kernel mode, executing Console.KeyAvailable (which boils down to kernel32!PeekConsoleInput). &nbsp;So this is really a bad example of parallelizing anything, since the majority of work here is polling the console input handle.</p>
<p>The following is a slightly better scenario which shows the added value of parallel extensions, because the work is CPU-bound:</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp;static int primeSum;</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp;static void Compute(int i)</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp;{</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;for (int j = 1; j &lt;= Math.Sqrt(i); ++j)</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;{</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;if (i % j == 0)</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;primeSum += j;</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;}</p>
<p> &nbsp; &nbsp; &nbsp; &nbsp;}</p>
<p>Take this method and call it 500,000 times and here&#8217;s what you get on my PC (a modest Core 2 Duo 1.86 GHz)&#8230;</p>
<p>Using a simple loop (from 0 to 500,000) it performs 40,900 operations per second with 50% CPU utilization.</p>
<p>Using Parallel.For (from 0 to 500,000) it performs 77,000 operations per second (which is really good, considering that the first few thousand invocations of Compute are really really cheap and therefore the overhead of the delegate call dominates), with 100% CPU utilization.</p>
<p>Using Parallel.Do it performs 40,400 operations per second (which is the amortized cost of the initial Parallel.Do overhead), with 50% CPU utilization.</p>
<p>All these results are perfectly on par with the way the parallel extensions are supposed to work. &nbsp;In fact, it&#8217;s hardly magic &#8211; you could easily implement this kind of framework yourself. &nbsp;What I find valuable here is that Microsoft finally released a parallelization framework which might actually be accessible for those 80% of developers who do not read blogs, read books or attend conferences. &nbsp;And that&#8217;s what makes me happy.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

