<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	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/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Clay Lenhart's Blog &#187; Languages</title>
	<atom:link href="http://clay.lenharts.net/blog/tag/languages/feed/" rel="self" type="application/rss+xml" />
	<link>http://clay.lenharts.net/blog</link>
	<description>A blog on .Net and SQL Server</description>
	<lastBuildDate>Tue, 31 Oct 2017 10:34:08 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=4.2.2</generator>
	<item>
		<title>The &#8220;Many Core&#8221; Problem</title>
		<link>http://clay.lenharts.net/blog/2008/10/25/the-many-core-problem/</link>
		<comments>http://clay.lenharts.net/blog/2008/10/25/the-many-core-problem/#comments</comments>
		<pubDate>Sat, 25 Oct 2008 23:03:31 +0000</pubDate>
		<dc:creator><![CDATA[Clay Lenhart]]></dc:creator>
				<category><![CDATA[Architecture]]></category>
		<category><![CDATA[Languages]]></category>
		<category><![CDATA[F#]]></category>
		<category><![CDATA[Multithread]]></category>

		<guid isPermaLink="false">http://clay.lenharts.net/blog/?p=43</guid>
		<description><![CDATA[We, as developers, have a problem.  CPUs will continue to have more cores, and each core is not going to be any faster.  The only way to write faster applications is to write multithreaded code, which has two challenges: 1) Multithreaded code is complex to write and think about. 2)Multithreaded code is difficult to test.  From what I've seen, people are pursuing 4 approaches. 
 <a href="http://clay.lenharts.net/blog/2008/10/25/the-many-core-problem/">Continue reading <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>We, as developers, have a problem.  CPUs will continue to have more cores, and each core is not going to be any faster.  The only way to write faster applications is to write multithreaded code, which has two challenges:</p>
<ul>
<li>Multithreaded code is complex to write and think about.</li>
<li>Multithreaded code is difficult to test.</li>
</ul>
<p>From what I&#8217;ve seen, people are pursuing 4 approaches. <span id="more-43"></span></p>
<p><strong>Better Languages</strong></p>
<p>If languages are the whole answer, the language has to make it impossible to write multithreaded bugs, otherwise you only address the first problem (the complexity).</p>
<p>Erlang is one such language that removes whole class of multithreaded bugs. Erlang&#8217;s approach is to isolate the threads, and give them a way to pass messages to each other.  However programming in Erlang is awkward and arguably it makes the code more complex.</p>
<p>Other languages, like Clojure and F#, take a different approach and make it easier to write and deal with multithreaded issues, however they don&#8217;t prevent you from writing multithreaded bugs.  These languages do not address the whole problem as you still need a way to test the code.</p>
<p><strong>Better Libraries</strong></p>
<p>Microsoft has a library for .Net called <a href="http://msdn.microsoft.com/en-us/magazine/cc163340.aspx">Parallel Task Library </a>to make it easier to write multithreaded code.  Need to operate on each element in an array?  Use the Parallel.For() method.  This library makes it easier to think and write multithreaded code, but it doesn&#8217;t make it any easier to test.</p>
<p><strong>Static Code Analyzer</strong></p>
<p>Java has a static code analyzer that is able to find multithreading bugs called <a href="http://findbugs.sourceforge.net/">FindBugs</a>.  It looks at your code and reports any code that will cause multithreaded bugs.  This would address the second issue, because it, in theory, reports all threading bugs.  It doesn&#8217;t however address the first issue, making the code easier to write.</p>
<p><strong>Testing with Deterministic Threads</strong><strong><br />
</strong></p>
<p>Microsoft is going in a different direction.  They are working on something called <a href="http://research.microsoft.com/~madanm/papers/osdi2008-CHESS.pdf">CHESS</a> that makes your unit tests find multithreaded bugs.  It does this by taking over the scheduler and sysmatically repeating each test, weaving the threads differently each time to exercise every possible way the scheduler could run the code.  However it requires us to to write a set of tests that finds *all* the threading bugs.  Since it is common to write unit tests with less than 100% coverage, a code coverage tool should be used to write more tests.</p>
<p><strong>Conclusion</strong></p>
<p>The good news is that there appears to be a variety of approaches to the problem and the whole answer will likely involve a combination of language or library enhancements and analyser or testing enhancements that are already in the works.</p>
]]></content:encoded>
			<wfw:commentRss>http://clay.lenharts.net/blog/2008/10/25/the-many-core-problem/feed/</wfw:commentRss>
		<slash:comments>21</slash:comments>
		</item>
	</channel>
</rss>
