<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" media="screen" href="/styles/xslt/rss.xslt"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:c9="http://channel9.msdn.com">
<channel>
	<title>Comment Feed for Channel 9 - Parallel Programming with .NET Parallel Extensions</title>
	<atom:link rel="self" type="application/rss+xml" href="http://channel9.msdn.com/Blogs/philpenn/Parallel-Programming-with-NET-Parallel-Extensions/RSS"></atom:link>
	<image>
		<url>http://ecn.channel9.msdn.com/o9/previewImages/100/468084_100x75.jpg</url>
		<title>Channel 9 - Parallel Programming with .NET Parallel Extensions</title>
		<link></link>
	</image>
	<description>
This video demonstrates the use of Parallel Extensions to the .NET Framework.&amp;nbsp;&amp;nbsp; Parallel Extensions&amp;nbsp;requires .NET 3.5 and the final version will be part of the .NET 4.0 Framework when released.&amp;nbsp; These extensions introduce new classes and&amp;nbsp;functionality into
 the System.Threading namespace.&amp;nbsp; It&#39;s now considerably easier to parallelize a code block without creating explicit threads.

Windows Server 2008 R2 and Windows 7 introduce new system-level features (e.g. User-Mode-Scheduling) that both the C&amp;#43;&amp;#43; Concurrency Runtime and the .NET Parallel Extensions extend.&amp;nbsp;&amp;nbsp; Developers may easily target&amp;nbsp;current and legacy platforms using the&amp;nbsp;new runtime
 and extensions.&amp;nbsp; 
First, a project is shown that counts the number of primes up to a given upper bound.&amp;nbsp; Each number is checked by seeing if it’s divisible by any number between 2 and its square root.&amp;nbsp; Each prime number found increases the count.&amp;nbsp; The main control is a standard
for loop. 
Next, the same code is converted to work with the new Parallel.For()
method.&amp;nbsp; This takes the lower and upper bound, and a delegate for the action to take.&amp;nbsp; Using a Lamda expression, the original loop body is made to work using
i =&amp;gt; {} syntax.&amp;nbsp; When this code is run, it is clear that a bug has surfaced in the form of a bad prime count.&amp;nbsp; This is actually a common multithreading bug, stemming from the use of the increment operator,
&amp;#43;&amp;#43;.&amp;nbsp; Using the Interlocked.Increment() method fixes the problem. 
The next demo starts with a LINQ query and converts to a Parallel LINQ, or PLINQ, query.&amp;nbsp; After demonstrating the original loop which uses
Enumerable.Range() to generate a range of numbers, it is shown that ParallelEnumerable.Range() creates an enumerator that is automatically multi-threaded. 
Finally, to demonstrate a more general-usage solution, any IEnumerable 
collection can easily be parallelized using the expression method AsParallel().&amp;nbsp; Thus, a collection
students of type List&amp;lt;Student&amp;gt; could be used in a LINQ as a parallel query by simply using it as
students.AsParallel().

Learn more about Parallel Computing on Windows at the 
MSDN Concurrency Dev Center. 
</description>
	<link></link>
	<language>en</language>
	<pubDate>Sat, 18 May 2013 16:57:07 GMT</pubDate>
	<lastBuildDate>Sat, 18 May 2013 16:57:07 GMT</lastBuildDate>
	<generator>Rev9</generator>
	<item>
		<title>Re: Parallel Programming with .NET Parallel Extensions</title>
		<description>
			<![CDATA[Wonderfull presentation, very helpful, covers the basics of parallel extension with detailed examples.<p>posted by Modi Gendelman</p>]]>
		</description>
		<link>http://channel9.msdn.com/Blogs/philpenn/Parallel-Programming-with-NET-Parallel-Extensions#c634212964260000000</link>
		<pubDate>Tue, 28 Sep 2010 18:47:06 GMT</pubDate>
		<guid isPermaLink="true">http://channel9.msdn.com/Blogs/philpenn/Parallel-Programming-with-NET-Parallel-Extensions#c634212964260000000</guid>
		<dc:creator>Modi Gendelman</dc:creator>
	</item>
</channel>
</rss>