<?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>Parallel Programming in Native Code : UMS</title><link>http://blogs.msdn.com/nativeconcurrency/archive/tags/UMS/default.aspx</link><description>Tags: UMS</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>What's new in the Concurrency Runtime and the Parallel Patterns and Asynchronous Agents Libraries</title><link>http://blogs.msdn.com/nativeconcurrency/archive/2009/05/21/what-s-new-in-the-concurrency-runtime-and-the-parallel-patterns-and-asynchronous-agents-libraries.aspx</link><pubDate>Thu, 21 May 2009 23:23:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9634271</guid><dc:creator>rickmolloy</dc:creator><slash:comments>2</slash:comments><comments>http://blogs.msdn.com/nativeconcurrency/comments/9634271.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nativeconcurrency/commentrss.aspx?PostID=9634271</wfw:commentRss><wfw:comment>http://blogs.msdn.com/nativeconcurrency/rsscomments.aspx?PostID=9634271</wfw:comment><description>&lt;P&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt"&gt;Visual Studio 2010 Beta1 has been released, and it is a &lt;A href="http://www.microsoft.com/downloads/details.aspx?FamilyID=85520793-68fc-4361-a8b6-dc2cff49c8d2&amp;amp;displaylang=en"&gt;full install version&lt;/A&gt;.&amp;nbsp; The team has been busy, busy busy since the CTP release last fall to deliver most of the APIs and objects we’ve blogged about here&amp;nbsp;into Beta1.&amp;nbsp; So I wanted to take a moment to summarize what’s new in the Beta for the Parallel Pattern Library, the Asynchronous Agents Library and the Concurrency Runtime.&amp;nbsp; &lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt"&gt;You can find the official reference documentation and walkthroughs in the MSDN Library &lt;A href="http://msdn.microsoft.com/en-us/library/dd504870(VS.100).aspx"&gt;here&lt;/A&gt;. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;H3 style="MARGIN: auto 0in"&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; mso-fareast-font-family: 'Times New Roman'"&gt;What’s new in the Parallel Patterns Library&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt;The &lt;A href="http://msdn.microsoft.com/en-us/library/dd492418(VS.100).aspx"&gt;Parallel Patterns Library&lt;/A&gt; (PPL) provides an imperative programming model that promotes scalability and ease-of-use for developing concurrent applications. &amp;nbsp;In general the library’s surface area remains largely unchanged, with a few high impact additions.&amp;nbsp; You will also find it more stable, more robust, faster, and more scalable – lots of goodness!&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL type=disc&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Added support for&lt;B&gt; exception handling in &lt;A href="http://msdn.microsoft.com/en-us/library/dd470722(VS.100).aspx"&gt;task_group&lt;/A&gt;&lt;/B&gt;.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;The new &lt;B&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd505033(VS.100).aspx"&gt;is_current_task_group_canceling&lt;/A&gt;&lt;/B&gt; API helps query cancellation status.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;The &lt;B&gt;&lt;A href="http://blogs.msdn.com/nativeconcurrency/archive/2008/09/25/avoiding-contention-using-combinable-objects.aspx"&gt;&lt;FONT color=#0000ff&gt;combinable&amp;lt;T&amp;gt;&lt;/FONT&gt;&lt;/A&gt;&lt;/B&gt; object has been added for helping avoid races on reductions and accumulations.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;We’ve made &lt;B&gt;significant performance improvements&lt;/B&gt; to our &lt;A href="http://msdn.microsoft.com/en-us/library/dd470426(VS.100).aspx"&gt;parallel loops&lt;/A&gt;: parallel_for, parallel_for_each and parallel_invoke &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;A href="http://blogs.msdn.com/nativeconcurrency/archive/2009/04/22/synchronization-with-the-concurrency-runtime.aspx"&gt;&lt;FONT color=#0000ff&gt;critical_section&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt; and &lt;B&gt;&lt;A href="http://blogs.msdn.com/nativeconcurrency/archive/2009/05/14/synchronization-with-the-concurrency-runtime-part-2.aspx"&gt;&lt;FONT color=#0000ff&gt;reader_writer&lt;/FONT&gt;&lt;/A&gt;, &lt;/B&gt;the &lt;A href="http://msdn.microsoft.com/en-us/library/dd759350(VS.100).aspx"&gt;cooperative synchronization primitives&lt;/A&gt; that we blogged about recently, are now in. &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l0 level1 lfo1; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;We’ve also included a manual reset event called &lt;B&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd492846(VS.100).aspx"&gt;Concurrency::event&lt;/A&gt;&lt;/B&gt;. &amp;nbsp;&amp;nbsp;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;H3 style="MARGIN: auto 0in"&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; mso-fareast-font-family: 'Times New Roman'"&gt;What’s new in the Asynchronous Agents Library&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt;The &lt;A href="http://msdn.microsoft.com/en-us/library/dd492627(VS.100).aspx"&gt;Asynchronous Agents Library&lt;/A&gt; (or just &lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt"&gt;Agents Library&lt;SPAN style="COLOR: black"&gt;) provides a programming model that enables you to increase the robustness of concurrency-enabled application development. The Agents Library is a C++ template library that promotes an actor-based programming model and in-process message passing for fine-grained dataflow and pipelining tasks. The Agents Library builds upon the scheduling and resource management components of the Concurrency Runtime.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt;Here’s a summary of what’s we’ve added and revised in the Agents library:&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL type=disc&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l1 level1 lfo2; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Added the &lt;B&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd504833(VS.100).aspx#choice"&gt;&lt;FONT color=#0000ff&gt;choice&lt;/FONT&gt;&lt;/A&gt;&lt;/B&gt;, &lt;B&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd504833(VS.100).aspx#join"&gt;&lt;FONT color=#0000ff&gt;join &lt;SPAN style="FONT-WEIGHT: normal"&gt;and&lt;/SPAN&gt; multitype_join&lt;/FONT&gt;&lt;/A&gt;&lt;/B&gt; message blocks to allow users to wait on a set of messages; choice waits for any message, join waits for all messages of a single type, and multitype_join waits for all messages and allows for multiple different types.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l1 level1 lfo2; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Renamed the transform message block to &lt;B&gt;&lt;A href="http://msdn.microsoft.com/en-us/library/dd504833(VS.100).aspx#transformer"&gt;&lt;FONT color=#0000ff&gt;transformer&lt;/FONT&gt;&lt;/A&gt;&lt;/B&gt; (we didn’t want Concurrency::transformer to conflict with std::transform) &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l1 level1 lfo2; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Added functor support&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt; to the pipeline message blocks &lt;B&gt;call&lt;/B&gt; and &lt;B&gt;transformer&lt;/B&gt; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l1 level1 lfo2; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Building custom message blocks is now easier&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt; due to some refactoring.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;H3 style="MARGIN: auto 0in"&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; mso-fareast-font-family: 'Times New Roman'"&gt;What’s new and improved in the Concurrency Runtime itself&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt;The underlying Concurrency Runtime has undergone significant feature improvements and performance enhancements, many of which we have been discussing already on this blog.&amp;nbsp; These changes will have improvements to everything built on top of the runtime, including the Parallel Patterns Library and the Agents Library.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;UL type=disc&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l2 level1 lfo3; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Added support for User Mode Scheduled Threads&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt; on Windows 7 RC (see our blog posts on the &lt;A href="http://blogs.msdn.com/nativeconcurrency/archive/2009/02/04/concurrency-runtime-and-windows-7.aspx"&gt;Concurrency Runtime’s support&lt;/A&gt; and &lt;A href="http://blogs.msdn.com/nativeconcurrency/archive/2009/02/02/dave-probert-goes-deep-on-win7-user-mode-scheduled-threads.aspx"&gt;&lt;FONT color=#0000ff&gt;go deep on Win7 UMS&lt;/FONT&gt;&lt;/A&gt;)&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l2 level1 lfo3; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Revised and simplified &lt;A href="http://msdn.microsoft.com/en-us/library/dd470841(VS.100).aspx"&gt;scheduler policies&lt;/A&gt; and APIs&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt; for &lt;A href="http://msdn.microsoft.com/en-us/library/dd492385(VS.100).aspx"&gt;constructing schedulers&lt;/A&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l2 level1 lfo3; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Added &lt;B&gt;dynamic resource management&lt;/B&gt; for load balancing between multiple scheduler instances.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l2 level1 lfo3; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Further improved load balancing by applying the &lt;B&gt;hill climbing&lt;/B&gt; technique to thread injection.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;
&lt;LI style="MARGIN: 0in 0in 0pt; COLOR: black; mso-list: l2 level1 lfo3; tab-stops: list .5in; mso-margin-top-alt: auto; mso-margin-bottom-alt: auto" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; FONT-SIZE: 10pt; mso-fareast-font-family: 'Times New Roman'"&gt;Added the &lt;B&gt;concurrent sub-allocator&lt;/B&gt; for &lt;A href="http://msdn.microsoft.com/en-us/library/dd492420(VS.100).aspx"&gt;high performance allocations&lt;/A&gt; and &lt;A href="http://msdn.microsoft.com/en-us/library/dd470885(VS.100).aspx"&gt;frees&lt;/A&gt; on multiple threads&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/LI&gt;&lt;/UL&gt;
&lt;H3 style="MARGIN: auto 0in"&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; mso-fareast-font-family: 'Times New Roman'"&gt;Call to Action&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-WEIGHT: normal; mso-fareast-font-family: 'Times New Roman'"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/H3&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt;&lt;A href="http://www.microsoft.com/visualstudio/en-gb/products/2010/default.mspx"&gt;&lt;FONT color=#0000ff&gt;Download and install Microsoft Visual Studio 2010 Beta 1&lt;/FONT&gt;&lt;/A&gt;&lt;/SPAN&gt;&lt;/B&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt; today.&amp;nbsp; Impress your friends and coworkers by being among the first to learn and use our libraries.&amp;nbsp; Provide early and critical feedback &lt;A href="http://social.msdn.microsoft.com/Forums/en-US/parallelcppnative/threads/"&gt;on our forum&lt;/A&gt; that will shape the way that these libraries are ultimately released.&amp;nbsp; &lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt;See this blog post on the value of your feedback:&amp;nbsp; &lt;A href="http://blogs.msdn.com/pfxteam/archive/2008/06/02/8567825.aspx"&gt;&lt;FONT color=#0000ff&gt;On Achieving Perfection –or– Why We Love Your Feedback (and Why You Can Love Giving It)&lt;/FONT&gt;&lt;/A&gt;.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt;&lt;o:p&gt;&amp;nbsp;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;SPAN style="FONT-FAMILY: 'Tahoma','sans-serif'; COLOR: black; FONT-SIZE: 10pt"&gt;Happy coding!&lt;/SPAN&gt;&lt;SPAN style="FONT-FAMILY: 'Calibri','sans-serif'; FONT-SIZE: 11pt"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P style="MARGIN: 0in 0in 0pt" class=MsoNormal&gt;&lt;o:p&gt;&lt;FONT size=3 face="Times New Roman"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/o:p&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9634271" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/C_2B002B00_/default.aspx">C++</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/concurrency/default.aspx">concurrency</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/Concurrency+Runtime/default.aspx">Concurrency Runtime</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/Parallel+Pattern+Library/default.aspx">Parallel Pattern Library</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/Asynchronous+Agents/default.aspx">Asynchronous Agents</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/C_2B002B00_0x/default.aspx">C++0x</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/Win7/default.aspx">Win7</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/UMS/default.aspx">UMS</category></item><item><title>Concurrency Runtime and Windows 7</title><link>http://blogs.msdn.com/nativeconcurrency/archive/2009/02/04/concurrency-runtime-and-windows-7.aspx</link><pubDate>Thu, 05 Feb 2009 05:30:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9397325</guid><dc:creator>dmccrady</dc:creator><slash:comments>24</slash:comments><comments>http://blogs.msdn.com/nativeconcurrency/comments/9397325.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nativeconcurrency/commentrss.aspx?PostID=9397325</wfw:commentRss><wfw:comment>http://blogs.msdn.com/nativeconcurrency/rsscomments.aspx?PostID=9397325</wfw:comment><description>&lt;p&gt;Microsoft has recently released a beta for Windows 7, and a look at the official web site (&lt;a href="http://www.microsoft.com/windows/windows-7/default.aspx"&gt;http://www.microsoft.com/windows/windows-7/default.aspx&lt;/a&gt;) will show you a pretty impressive list of new features and usability enhancements. I encourage you to go look them over for yourself, but in this article I&amp;#8217;m going to focus on a couple of Win7 features that are of particular importance to achieving the most performance of your parallel programs.&lt;/p&gt;  &lt;p&gt;1. Support for more than 64 processors&lt;/p&gt;  &lt;p&gt;2. User-Mode Scheduled Threads&lt;/p&gt;  &lt;p&gt;Both of the new features I&amp;#8217;m going to talk about will be supported in the Microsoft Concurrency Runtime, which will be delivered as part of Visual Studio 10.&lt;/p&gt;  &lt;p&gt;An important note about each of these features is that they&amp;#8217;re only supported on the &lt;i&gt;64-bit&lt;/i&gt; Windows 7 platform.&lt;/p&gt;  &lt;h3&gt;More Than 64 Processors&lt;/h3&gt;  &lt;p&gt;The most straightforward of these new features is Windows 7&amp;#8217;s support for more than 64 processors. With earlier Windows OS&amp;#8217;s, even high end servers could only schedule threads among a maximum of 64 processors. Windows 7 will allow threads to run on more than 64 processors by allowing threads to be affinitized to both a processor &lt;i&gt;group&lt;/i&gt;, and a processor &lt;i&gt;index&lt;/i&gt; within that group. Each group can have up to 64 processors, and Windows 7 supports a maximum of 4 processor groups. The mechanics of this new OS support are detailed in a white paper which is available at &lt;a href="http://www.microsoft.com/whdc/system/Sysinternals/MoreThan64proc.mspx"&gt;http://www.microsoft.com/whdc/system/Sysinternals/MoreThan64proc.mspx&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;However, unless you actively modify your application to affinitize work amongst other processor groups, you&amp;#8217;ll still be stuck with a maximum of 64 processors. The good news is that if you use the Microsoft Concurrency Runtime on Windows 7, you don&amp;#8217;t need to be concerned at all with these gory details. As always, the runtime takes care of everything for you, and will automatically determine the total amount of available concurrency (e.g., total number of cores), and utilize as many as it can during any parallel computation. This is an example of what we call a &amp;#8220;light-up&amp;#8221; scenario. Compile your Concurrency Runtime-enabled application once, and you can run it on everything, from your Core2-Duo up to your monster Win7 256-core server.&lt;/p&gt;  &lt;h3&gt;User Mode Scheduling&lt;/h3&gt;  &lt;p&gt;User Mode Scheduled Threads (UMS Threads) is another Windows 7 feature that &amp;#8220;lights up&amp;#8221; in the Concurrency Runtime.&lt;/p&gt;  &lt;p&gt;As the name implies, UMS Threads are threads that are scheduled by a user-mode scheduler (like Concurrency Runtime&amp;#8217;s scheduler), instead of by the kernel. Scheduling threads in user mode has a couple of advantages:&lt;/p&gt;  &lt;p&gt;1. A UMS Thread can be scheduled without a kernel transition, which can provide a performance boost.&lt;/p&gt;  &lt;p&gt;2. Full use of the OS&amp;#8217;s quantum can be achieved if a UMS Thread blocks for any reason.&lt;/p&gt;  &lt;p&gt;To illustrate the 2&lt;sup&gt;nd&lt;/sup&gt; point, let&amp;#8217;s assume a very simple scheduler with a single work queue. In this example, I&amp;#8217;ll also assume that we have 100 tasks that can be run in parallel on 2 CPU&amp;#8217;s.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://blogs.msdn.com/blogfiles/nativeconcurrency/WindowsLiveWriter/ConcurrencyRuntimeandWindows7_10409/ConcRT%20and%20Win7%20UMS_2.jpg"&gt;&lt;img style="border-right-width: 0px; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" border="0" alt="ConcRT and Win7 UMS" src="http://blogs.msdn.com/blogfiles/nativeconcurrency/WindowsLiveWriter/ConcurrencyRuntimeandWindows7_10409/ConcRT%20and%20Win7%20UMS_thumb.jpg" width="427" height="251" /&gt;&lt;/a&gt; &lt;/p&gt;  &lt;p&gt;Here we&amp;#8217;ve started with 100 items in our task queue, and two threads have picked up Task 1 and Task 2 and are running them in parallel. Unfortunately, Task 2 is going to block on a critical section. Obviously, we would like the scheduler (i.e. the Concurrency Runtime) to use CPU 2 to run the other queued tasks while Task 2 is blocked. Alas, with ordinary Win32 threads, the scheduler cannot tell the difference between a task that is performing a very long computation and a task that is simply blocked in the kernel. The end result is that until Task 2 unblocks, the Concurrency Runtime will not schedule any more tasks on CPU 2. Our 2-core machine just became a 1-core machine, and in the worst case, all 99 remaining tasks will be executed serially on CPU 1.&lt;/p&gt;  &lt;p&gt;This situation can be improved somewhat by using the Concurrency Runtime&amp;#8217;s &lt;i&gt;cooperative&lt;/i&gt; synchronization primitives (critical_section, reader_writer_lock, event) instead of Win32&amp;#8217;s kernel primitives. These runtime-aware primitives will cooperatively block a thread, informing the Concurrency Runtime that other work can be run on the CPU. In the above example, Task 2 will cooperatively block, but Task 3 can be run on another thread on CPU 2. All this involves several trips through the kernel to block one thread and unblock another, but it&amp;#8217;s certainly better than wasting the CPU.&lt;/p&gt;  &lt;p&gt;The situation is improved even further on Windows 7 with UMS threads. When Task 2 blocks, the OS &lt;i&gt;gives control back&lt;/i&gt; to Concurrency Runtime. It can now make a scheduling decision and create a new thread to run Task 3 from the task queue. The new thread is scheduled in user-mode by the Concurrency Runtime, not by the OS, so the switch is very fast. Now both CPU 1 and CPU 2 can now be kept busy with the remaining 99 non-blocking tasks in the queue. When Task 2 gets unblocked, Win7 places its host thread back on a runnable list so that the Concurrency Runtime can schedule it &amp;#8211; again, from user-mode &amp;#8211; and Task 2 can be continued on any available CPU. &lt;/p&gt;  &lt;p&gt;You might say, &amp;#8220;hey my task doesn&amp;#8217;t do any kernel blocking, so does this still help me?&amp;#8221; The answer is yes. First, it&amp;#8217;s really difficult to know whether your task will block at all. If you call &amp;#8220;new&amp;#8221; or &amp;#8220;malloc&amp;#8221; you may block on a heap lock. Even if you didn&amp;#8217;t block, the operation might &lt;i&gt;page-fault&lt;/i&gt;. An I/O operation will also cause a kernel transition. All these occurrences can take significant time and can stall forward progress on the core upon which they occur. These are opportunities for the scheduler to execute additional work on the now-idle CPU. Windows 7 UMS Threads enables these opportunities, and the result is greater throughput of tasks and more efficient CPU utilization. &lt;/p&gt;  &lt;p&gt;(Some readers may have noticed a superficial similarity between UMS Threads and Win32 Fibers. The key difference is that unlike a Fiber, a UMS Thread is a real bona-fide thread, with a backing kernel thread, its own thread-local state, and the ability to run code that can call arbitrary Win32 API&amp;#8217;s. Fibers have severe restrictions on the kinds of Win32 API&amp;#8217;s they can call.)&lt;/p&gt;  &lt;p&gt;Obviously the above example is highly simplified. A UMS Thread scheduler is an extremely complex piece of software to write, and managing state when an arbitrary page fault can swap you out is challenging to say the least. However, once again users of the Concurrency Runtime don&amp;#8217;t have to be concerned with any of these gory details. Write your programs once using PPL or Agents, and your code will run using Win32 threads or UMS Threads.&lt;/p&gt;  &lt;p&gt;For more details about UMS Threads, check out &lt;a href="http://channel9.msdn.com/shows/Going+Deep/Dave-Probert-Inside-Windows-7-User-Mode-Scheduler-UMS/"&gt;Inside Windows 7 - User Mode Scheduler (UMS)&lt;/a&gt; with Windows Kernel architect Dave Probert on Channel9.&lt;/p&gt;  &lt;h3&gt;Better Together&lt;/h3&gt;  &lt;p&gt;Windows 7 by itself is a great enabler of fine grain parallelism, because of the above two specific features, as well as some other performance improvements made at the kernel level. The Concurrency Runtime helps bring the fullest potential of Windows 7 into the hands of programmers in a very simple and powerful way.&lt;/p&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9397325" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/concurrency/default.aspx">concurrency</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/Concurrency+Runtime/default.aspx">Concurrency Runtime</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/Win7/default.aspx">Win7</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/UMS/default.aspx">UMS</category></item><item><title>Dave Probert ‘goes deep’ on Win7 User Mode Scheduled Threads</title><link>http://blogs.msdn.com/nativeconcurrency/archive/2009/02/02/dave-probert-goes-deep-on-win7-user-mode-scheduled-threads.aspx</link><pubDate>Mon, 02 Feb 2009 23:32:00 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9391673</guid><dc:creator>rickmolloy</dc:creator><slash:comments>0</slash:comments><comments>http://blogs.msdn.com/nativeconcurrency/comments/9391673.aspx</comments><wfw:commentRss>http://blogs.msdn.com/nativeconcurrency/commentrss.aspx?PostID=9391673</wfw:commentRss><wfw:comment>http://blogs.msdn.com/nativeconcurrency/rsscomments.aspx?PostID=9391673</wfw:comment><description>&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;Charles Torre just posted a great Channel9 session with Windows kernel architect Dave Probert on functionality&amp;nbsp;new to&amp;nbsp;Windows7: User Mode Scheduled (UMS) Threads.&amp;nbsp; Much like fibers, UMS threads enable a user mode scheduler (like the Concurrency Runtime) to have control over scheduling of threads in user mode; however unlike fibers, UMS threads keep the TEB and thread local information intact and provides notification of kernel blocking which enables more general use. &lt;?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;In the near future we'll be blogging here about how the Concurrency Runtime is taking advantage of UMS threads on Win7, but if you have some time to spare, check out what Dave has to say on this it's a wonderful session.&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;&lt;A href="http://channel9.msdn.com/shows/Going+Deep/Dave-Probert-Inside-Windows-7-User-Mode-Scheduler-UMS/" mce_href="http://channel9.msdn.com/shows/Going+Deep/Dave-Probert-Inside-Windows-7-User-Mode-Scheduler-UMS/"&gt;http://channel9.msdn.com/shows/Going+Deep/Dave-Probert-Inside-Windows-7-User-Mode-Scheduler-UMS/&lt;/A&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN style="FONT-SIZE: 10pt; FONT-FAMILY: 'Arial','sans-serif'"&gt;-Rick&lt;/SPAN&gt;&lt;/P&gt;&lt;img src="http://blogs.msdn.com/aggbug.aspx?PostID=9391673" width="1" height="1"&gt;</description><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/concurrency/default.aspx">concurrency</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/Concurrency+Runtime/default.aspx">Concurrency Runtime</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/Win7/default.aspx">Win7</category><category domain="http://blogs.msdn.com/nativeconcurrency/archive/tags/UMS/default.aspx">UMS</category></item></channel></rss>