<?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>&#62;kloctalk&#187; Software Complexity</title>
	<atom:link href="http://www.klocwork.com/blog/category/software-complexity/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.klocwork.com/blog</link>
	<description>&#62;kloctalk is a blog and a community for software development professionals who create and maintain mission-critical software and the challenges they face on a daily basis.</description>
	<lastBuildDate>Wed, 08 Feb 2012 13:45:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>Multicore exposes more frog versus snake (deadlock) bugs</title>
		<link>http://www.klocwork.com/blog/2010/09/multicore-exposes-more-snake-versus-frog-bugs/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=multicore-exposes-more-snake-versus-frog-bugs</link>
		<comments>http://www.klocwork.com/blog/2010/09/multicore-exposes-more-snake-versus-frog-bugs/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 15:55:39 +0000</pubDate>
		<dc:creator>Eric Hollebone</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Nasty Bugs]]></category>
		<category><![CDATA[Software Complexity]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[deadlock]]></category>
		<category><![CDATA[embedded development]]></category>
		<category><![CDATA[multicore]]></category>
		<category><![CDATA[multithreading]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1099</guid>
		<description><![CDATA[Continuing the discussion about the embedded community moving to muticore/hetrogeneous hardware from watch out here comes multicore, embedded software development teams have historically been shielded from mulitcore issues. This is due to the specialized functionality of many embedded application classes and the inherent serialized nature of the C language.[1] Muticore is an ambiguous term for software developers and one they [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignright" style="width: 310px"><img title="Deadlock: frog vs. snake" src="http://www.klocwork.com/blog/wp-content/uploads/2010/09/Deadlock-frog-versus-snake.jpg" alt="" width="300" /><p class="wp-caption-text">Deadlock: frog vs. snake<br/>Photo: David Maitland / National Geographic</p></div>
<p>Continuing the discussion about the embedded community moving to muticore/hetrogeneous hardware from <a href="http://www.klocwork.com/blog/2010/09/embedded-developers-watch-out-here-comes-multicore/">watch out here comes multicore</a>, embedded software development teams have historically been shielded from mulitcore issues. This is due to the specialized functionality of many embedded application classes and the inherent serialized nature of the C language.<sup><a href="#vdc">[1]</a></sup></p>
<p>Muticore is an ambiguous term for software developers and one they don&#8217;t really use; software developers think in terms of threads/processes and concurrency, not how many cores or processors are available on the target. Concurrency is not a new topic either as Mark Smotherman captured in a <a href="http://www.cs.clemson.edu/~mark/multithreading.html">history of multithreading</a>, it has been a subject in computer science since its early beginnings in the 1950s.</p>
<p>What has changed is the rapidly increasing use of multicore technologies for embedded devices. One of the prominent software challenges that moving to multicore execution exposes is latent deadlocking bugs as true parallel execution comes into play, instead of a single core&#8217;s task scheduling/context switching techniques.</p>
<p>As an example, consider the following code snippet, which has been paraphrased from a deadlock discovered in a real-world open source multithreaded project.</p>
<p>Can you spot the deadlock?</p>
<pre><code>lock_t lock1, lock2;
int refCount = 0;

void enter() {
   reserve_lock(lock1);
      if( refCount == 0 )
         reserve_lock(lock2);
       release_lock(lock1);
   refCount++;
}

void leave() {
   reserve_lock(lock1);
   refCount--;
   if( refCount == 0 )
      release_lock(lock2);
   release_lock(lock1);
}</code></pre>
<p>To see the answer and understand the conditions that lead to the deadlock, download Klocwork&#8217;s whitepaper on <strong><a href="http://www.klocwork.com/resources/endian-deadlock-multicore-challenges/">Developing software for multicore</a></strong>.</p>
<p>A little about the picture in this post.  I found it when searching for pictures of deadlocks.  The photographer, David Maitland, titled his image &#8220;<a title="Deadlock: frog vs. snake" href="http://news.nationalgeographic.com/news/2008/10/photogalleries/best-animal-wildlife-photos/photo4.html" target="_blank">Deadlock</a>&#8221; and describes it as a continuing struggle between a Morelet&#8217;s tree frog and cat-eyed snake. After three hours in the high-stakes cage match, Maitland said there was no clear winner.</p>
<p><br class="spacer_" /></p>
<hr size="1" />
<p><a name="vdc">VDC Research</a>, “<a href="http://www.klocwork.com/resources/research/klocwork-research-vdc-multicore-software-challenges">Next Generation Embedded Hardware Architectures: Driving Onset of Project Delays, Costs Overruns, and Software Development Challenges</a>”, September 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2010/09/multicore-exposes-more-snake-versus-frog-bugs/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Embedded developers: Watch out here comes multicore</title>
		<link>http://www.klocwork.com/blog/2010/09/embedded-developers-watch-out-here-comes-multicore/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=embedded-developers-watch-out-here-comes-multicore</link>
		<comments>http://www.klocwork.com/blog/2010/09/embedded-developers-watch-out-here-comes-multicore/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 15:00:43 +0000</pubDate>
		<dc:creator>Eric Hollebone</dc:creator>
				<category><![CDATA[Embedded]]></category>
		<category><![CDATA[Software Complexity]]></category>
		<category><![CDATA[Static Analysis]]></category>
		<category><![CDATA[concurrency]]></category>
		<category><![CDATA[deadlocks]]></category>
		<category><![CDATA[endian]]></category>
		<category><![CDATA[multicore]]></category>
		<category><![CDATA[multithreading]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=1083</guid>
		<description><![CDATA[Although multicore and multiprocessor technologies have started to proliferate in the embedded market, smartphone manufacturers are in the midst of a rapid shift to multicores due the market transistion from business users to consumers. It&#8217;s becoming evident that in order for handset manufactures to differentiated their products, a feature war has commenced: wireless connectivity, video/flash/audio playback and even video creation/editing/conferencing [...]]]></description>
			<content:encoded><![CDATA[<div id="attachment_1084" class="wp-caption alignright" style="width: 310px"><a href="http://www.klocwork.com/blog/wp-content/uploads/2010/09/Multicore-projected-2-year-growth.png"><img class="size-medium wp-image-1084      " style="margin-left: 10px;" title="Projected Multicore processor use in current projects and in two years time" src="http://public-cfd2.klocwork.biz/www/_img/resources/advanced-platform-analysis/apa-piechart.png" alt="" width="300" /></a><p class="wp-caption-text">Processing Architecture for embedded devices in the current projects and expected in next two years</p></div>
<p>Although multicore and multiprocessor technologies have started to proliferate in the embedded market, smartphone manufacturers are in the midst of a rapid shift to multicores due the market transistion from business users to consumers. It&#8217;s becoming evident that in order for handset manufactures to differentiated their products, a feature war has commenced: wireless connectivity, video/flash/audio playback and even video creation/editing/conferencing have become are market drivers.</p>
<p>CPU designers have already responded to this need, just last week ARM announced its next generation of <a href="http://www.arm.com/products/processors/cortex-a/cortex-a15.php">Cortex<sup>&trade;</sup>-A15 MPCore<sup>&trade;</sup></a> design and Intel entered the smartphone cpu market earlier this year with the new <a href="http://news.cnet.com/8301-13924_3-20004099-64.html">Atom Z6</a> core.</p>
<p>For perspective, in a short few years mobile handset industry has had to move from relatively simple devices supporting cellular communication and user-interface tasks to multicore/multi-chip designs in order to grow features and thus market share. Until the arrival of power-aware multicore and heterogeneous chipsets, cellular devices have been limited by computational horsepower, power envelopes and time-to-market issues.</p>
<p>In any market with tremendous competition, time-to-market is crucial and one of the fastest methods to add features within the tight power budget is to add additional task-specialized silicon either as heterogeneous cores or chips from third-party suppliers that can be put to sleep or turned off entirely when not required.</p>
<p>Feature growth has in turn placed new burdens on mobile software development teams. Leaving the comfortable environment of a single core means addressing potential <a href="http://www.klocwork.com/resources/endian-deadlock-multicore-challenges/">threading/concurrency problems and endian ordering issues</a> when integer data is transmitted off-core.</p>
<p>Klocwork commissioned VDC Research to quantify the <a href="http://www.klocwork.com/resources/research/klocwork-research-vdc-multicore-software-challenges">business impact of moving to multicore/multiprocessor environments</a> and the results of this growing complexity is stark: multicore and multiprocessor software projects are</p>
<ul style="padding: 0 0 0 50px;">
<li style="line-height: 18px;">4.5X more expensive, </li>
<li style="line-height: 18px;">have 25% longer schedules, </li>
<li>and require almost 3x as many software engineers.<a href="http://www.klocwork.com/resources/research/klocwork-research-vdc-multi-core-software-challenges"><sup>[1]</sup></a></li>
</ul>
<p>Embedded and especially smartphone development teams need to be gearing up for the feature arms race to come and should be looking at methods to mitigate theses impacts by implementing productivity tools like <a href="http://www.klocwork.com/products/insight">static analysis</a> and <a href="http://www.klocwork.com/products/insight-pro/inspect-code-review/">automated code reviews</a> sooner than later.</p>
<p><br class="spacer_" /></p>
<hr size="1" />
<p>[1] VDC Research, “<a href="http://www.klocwork.com/resources/research/klocwork-research-vdc-multicore-software-challenges">Next Generation Embedded Hardware Architectures: Driving Onset of Project Delays, Costs Overruns, and Software Development Challenges</a>”, September 2010.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2010/09/embedded-developers-watch-out-here-comes-multicore/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Code metrics</title>
		<link>http://www.klocwork.com/blog/2010/02/code-metrics/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=code-metrics</link>
		<comments>http://www.klocwork.com/blog/2010/02/code-metrics/#comments</comments>
		<pubDate>Tue, 23 Feb 2010 19:24:23 +0000</pubDate>
		<dc:creator>Alen Zukich</dc:creator>
				<category><![CDATA[Compliance]]></category>
		<category><![CDATA[Software Complexity]]></category>
		<category><![CDATA[Software Quality]]></category>
		<category><![CDATA[agile]]></category>
		<category><![CDATA[complexity]]></category>
		<category><![CDATA[coverage]]></category>
		<category><![CDATA[metric]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=885</guid>
		<description><![CDATA[Just came across this post about the 5 code metrics you need to watch.  I thought it was worth mentioning as I just blogged about this below (including something similar a while back).  These are interesting metrics and more high level, but certainly important.  I like labeling duplicated code as something important.  I think we [...]]]></description>
			<content:encoded><![CDATA[<p>Just came across this <a href="http://maxheapsize.com/2010/02/23/5-code-metrics-you-need-to-watch/" target="_blank">post </a>about the 5 code metrics you need to watch.  I thought it was worth mentioning as I just blogged about this <a title="Software metrics for the developer" href="http://www.klocwork.com/blog/2010/02/software-metrics-for-the-developer/" target="_blank">below </a>(including something similar a while <a title="Software metrics for measuring quality" href="http://www.klocwork.com/blog/2010/01/software-metrics-for-measuring-quality/" target="_blank">back</a>).  These are interesting metrics and more high level, but certainly important.  I like labeling duplicated code as something important.  I think we often forget how much we reuse code and have the same mistakes in many places.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2010/02/code-metrics/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Refactoring vs. Refuctoring</title>
		<link>http://www.klocwork.com/blog/2010/02/refactoring-vs-refuctoring/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=refactoring-vs-refuctoring</link>
		<comments>http://www.klocwork.com/blog/2010/02/refactoring-vs-refuctoring/#comments</comments>
		<pubDate>Tue, 02 Feb 2010 16:33:48 +0000</pubDate>
		<dc:creator>Alen Zukich</dc:creator>
				<category><![CDATA[General Coding]]></category>
		<category><![CDATA[Refactoring]]></category>
		<category><![CDATA[Software Complexity]]></category>
		<category><![CDATA[refuctoring]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=716</guid>
		<description><![CDATA[Refactoring is a vital component for software developers, helping to prevent their projects from becoming unusable, and unmaintainable spaghetti code. Equally important to some developers, is the notion of refuctoring&#8230;check out this tongue in cheek look at Refactoring vs. Refuctoring. Be sure to check out the slide deck at the end. Refuctoring describes the process [...]]]></description>
			<content:encoded><![CDATA[<p>Refactoring is a vital component for software developers, helping to prevent their projects from becoming unusable, and unmaintainable spaghetti code. Equally important to some developers, is the notion of refuctoring&#8230;check out this tongue in cheek <a title="Waterfall 2006" href="http://www.waterfall2006.com/gorman.html" target="_blank">look </a>at Refactoring vs. Refuctoring. Be sure to check out the slide deck at the end.</p>
<p>Refuctoring describes the process of making your code unmaintainable by anybody but yourself.  I love some of the examples of Refuctoring such as “Pig Latin”, “Treasure Hunt” and my personal favorite “Stating the Bleeding Obvious”:</p>
<p>For example:</p>
<pre><code>//initialize a to 1
int a=1;</code></pre>
<p>Not that I’d ever do that (pause while I go clean up some code). Ahem, right anyways I thought I’d throw out some other refuctorings:</p>
<p>1.    “Catch me if you can” &#8211; Use so many goto statements that it will make anyone’s head spin.  Especially when you start adding backward goto’s.  Take a look at the CVS source code,  they have some nice (nasty) examples.</p>
<p>2.    “Giant tar pit of hell” &#8211; This is hard to blame one single developer as it really encompasses many developers getting together to create one big cohesive piece of crap.  You know you have a problem when you run out of printer toner trying to print these.</p>
<div id="attachment_717" class="wp-caption alignnone" style="width: 310px"><a href="http://www.klocwork.com/blog/wp-content/uploads/2010/02/arch.jpg"><img class="size-medium wp-image-717 " title="&quot;Giant tar pit of hell&quot;" src="http://www.klocwork.com/blog/wp-content/uploads/2010/02/arch-300x202.jpg" alt="" width="300" height="202" /></a><p class="wp-caption-text">&quot;Giant tar pit of hell&quot;</p></div>
<p>3.    “WTF” &#8211; Using names that no one will know&#8230;ever.  If you create a bankaccount object, instead of calling it ‘x’, here’s a wild idea, why not call it ‘bankaccount’.  Let’s face it we are all guilty of this.</p>
<p>Now if you really want to be special (I don’t mean in a good way), try combining #1 and #3:</p>
<pre><code>int afunction()
{

there:
   ...
   if(something)
   {
      goto here;
   }
   if(somethingelse)
   {
      goto there;
   }
here:
   ...
   if(somethingelseagain)
   {
   goto end;
   }
end:
...
return;
}</code></pre>
<p>I have to admit, I’m not winning any awards either. It is certainly time to get on the refactoring bandwagon.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2010/02/refactoring-vs-refuctoring/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Software Complexity, Lines of Code and Digital Derby</title>
		<link>http://www.klocwork.com/blog/2009/01/software-complexity-lines-of-code-and-digital-derby/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=software-complexity-lines-of-code-and-digital-derby</link>
		<comments>http://www.klocwork.com/blog/2009/01/software-complexity-lines-of-code-and-digital-derby/#comments</comments>
		<pubDate>Tue, 27 Jan 2009 19:36:10 +0000</pubDate>
		<dc:creator>Brendan Harrison</dc:creator>
				<category><![CDATA[General Industry]]></category>
		<category><![CDATA[Software Complexity]]></category>
		<category><![CDATA[lines of code]]></category>
		<category><![CDATA[loc]]></category>
		<category><![CDATA[mloc]]></category>
		<category><![CDATA[SDLC]]></category>

		<guid isPermaLink="false">http://www.klocwork.com/blog/?p=34</guid>
		<description><![CDATA[Many of us have seen the # of lines of code (LOC) stats that get thrown around as a metric for illustrating how complex software development has become: The U.S. Army’s Future Combat System is estimated at 60 million lines of code (MLOC) The software that runs the Boeing 787 is almost 7 MLOC, triple [...]]]></description>
			<content:encoded><![CDATA[<p>Many of us have seen the # of lines of code (LOC) stats that get thrown around as a metric for illustrating how complex software development has become:</p>
<ul>
<li>The U.S. Army’s Future Combat System is estimated at <a href="http://blog.wired.com/defense/2008/01/army-futures-so.html">60 million lines of code</a> (MLOC)</li>
<li>The software that runs the Boeing 787 is almost <a href="http://www.aviationnow.com/aw/generic/story_generic.jsp?channel=awst&amp;id=news/aw091007p2.xml&amp;headline=Boeing%20Faces%20%27%27Pretty%20Tight%27%27%20787%20Delivery%20Schedule">7 MLOC</a>, triple that of the 777</li>
<li>GM says future cars will have <a href="http://www.computerweekly.com/Articles/2004/10/21/206119/gm-cto-predicts-cars-will-run-on-100-million-lines-of.htm">&gt;100 MLOC</a> (that sounds high, but hey, &lt;insert GM joke here&gt;)</li>
</ul>
<p>So, yes there’s a lot of code out there, it’s growing, and it’s getting more complex. It’s tough to put these numbers into perspective… Jack Ganssle has a <a href="http://embedded.com/design/205604461">clever column</a> that does just that:</p>
<ul>
<li>A million lines of code printed out would be 18,000 pages</li>
<li>A million lines of code will typically have 100,000 bugs pre-test</li>
<li>A million lines of code costs $20m to $40m</li>
</ul>
<p>I won’t try to compete with Jack on the stats front since that column speaks for itself, and it’s not just the mission/safety critical systems that are trying to deal with the challenges of more code, more complexity, and less time (as in time-to-market). The consumer market is no different. Guess how much code is in the Xbox HD DVD Player? Not the whole system, just the player? <a href="http://blogs.msdn.com/xboxteam/archive/2006/11/03/emergence-day.aspx">4.7 MLOC</a>. Heck, you could fly an airplane with all that code (hopefully most of it can also be re-used on a non-obsolete disc format). Just as a point of comparison to today&#8217;s gaming systems, ask yourself how many software engineers worked on this &#8220;game system&#8221;:</p>
<div class="youtube-video"><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="355" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="wmode" value="transparent" /><param name="src" value="http://www.youtube.com/v/fpPtMBScVII" /><embed type="application/x-shockwave-flash" width="425" height="355" src="http://www.youtube.com/v/fpPtMBScVII" wmode="transparent"></embed></object></div>
<p>Yes, I had to throw Digital Derby under the bus didn’t I? Not because I don’t have fond memories of playing this game that was about the size of carry-on luggage. In fact, I played it until the poor little conveyor belt just stopped working and I put up with the, ahem, limitations in the technology. I was actually quite patient (more patient than I am now with technology) and gave my little Digital Derby second and third chances to work properly.</p>
<p>More code, more complexity, impatient customers, and very little margin for error &#8211; these are the trends that are driving tool and process automation across the board in the SDLC.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.klocwork.com/blog/2009/01/software-complexity-lines-of-code-and-digital-derby/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

