<?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>Observations from Uppsala</title>
	<atom:link href="http://jakob.engbloms.se/feed" rel="self" type="application/rss+xml" />
	<link>http://jakob.engbloms.se</link>
	<description>Computer Technology: Simulation, Virtualization, Virtual Platforms, Embedded, Multicore and Multiprocessing (by Jakob Engblom)</description>
	<lastBuildDate>Tue, 09 Mar 2010 16:40:25 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<image>
    <title>Observations from Uppsala</title>
    <url>http://jakob.engbloms.se/favicon.png</url>
    <link>http://jakob.engbloms.se</link>
    <width>32</width>
    <height>32</height>
    <description>Observations from Uppsala - http://jakob.engbloms.se</description>
    </image>		<item>
		<title>Kindergarten Robot 3: Programming is Kid&#8217;s Play</title>
		<link>http://jakob.engbloms.se/archives/1103?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1103#comments</comments>
		<pubDate>Tue, 09 Mar 2010 16:40:25 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[embedded systeme]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[Kindergarten]]></category>
		<category><![CDATA[lego]]></category>
		<category><![CDATA[MEPROM]]></category>
		<category><![CDATA[Mindstorms]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1103</guid>
		<description><![CDATA[Today I finally got to try my MEPROM-equipped Lego Mindstorms robot with a larger group of kids. As expected, this did not go quite as expected.

It turned out that trying to show a group of ten impatient kids that the robot read instruction codes and moved accordingly failed. Using a chaser program, where the robot [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2010/01/lego-mindstorms-nxt2.png"><img class="alignleft size-full wp-image-1057" style="margin: 5px 10px;" title="lego mindstorms nxt2" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/lego-mindstorms-nxt2.png" alt="" width="146" height="126" /></a>Today I finally got to try my <a href="http://jakob.engbloms.se/archives/1086">MEPROM-equipped Lego Mindstorms robot </a>with a larger group of kids. As expected, this did not go quite as expected.</p>
<p><span id="more-1103"></span></p>
<p>It turned out that trying to show a group of ten impatient kids that the robot read instruction codes and moved accordingly failed. Using a chaser program, where the robot drove around waiting for something to show up close in front of it and then drove full speed forward to try to hit it, was much easier to appreciate.  Classics like driving around avoiding to hit walls was also just as much fun as ever. Like my previous attempts, the kids piled up on the robot and tried to make it turn the way they wanted.</p>
<p>Clearly, physical exercise is easier to sell than cerebral exercise.</p>
<p>That said, I did manage to get some more thoughtful kids interested in getting the robot to go particular places. The setup I used was to put the robot on a starting square marked on the floor, and then putting a red bucket out on the floor some distance away. The kids were asked to help me program the robot to either hit the bucket or drive around it. I explained what the robot did as taking steps forward and turning, and actually the approximately 50 cm long runs it did for each blue programming tile was fairly similar to a serious step by a five-year-old (some kids instead started tip-toeing forward, which did not quite provide the correct stride).</p>
<p>As a safety device and to retain a semblance on intelligence on the part of the robot, I equipped it with a bumper in front. As soon as the bumper is hit, the robot is supposed to say “stop” and stop all activities.</p>
<p>The problems we tried were:</p>
<ul>
<li>Put the bucket down in front and try to hit it, needing three forward to get there</li>
<li>Drive around said bucket, which required a program like blue, green, blue, yellow, blue, blue, yellow, blue, green (forward, right, forward, left, forward, forward, left, forward, right).</li>
<li>Leave the base and drive to the back instead of front.</li>
</ul>
<p>I sat down with a group of three kids who really got into this part (even with ten other kids running around playing cops and robbers at a very high level of intensity). They did get the idea and did propose steps towards the solution. However, it is clear that at least initially; one cannot expect them to plan out an entire program in their heads.</p>
<p>Rather, we ended up in a style quite familiar to anyone learning a new programming language or taking their first programming course. Try one step, see where it takes us, add another step or two to the program, and try again. Very much how I myself solve programming and scripting problems where I interact with a complex and possibly unpredictable environment. In this way, we did manage to solve some problems, and I do think the kids understood what was going on.</p>
<p>To me, I feel the idea of the Lego-programmable robot as a preschool-level programming course is at least partially proven. As in most other educational ventures, what is needed is a good overall teaching environment. Next time, I will have to try this with a small group of kids, just after they have had a snack so that they are alert and fresh. I will also make sure to break up the hard work with some simple play, since that is needed to keep the kids from being bored.</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1103/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Graphical Programming in (Mis)use</title>
		<link>http://jakob.engbloms.se/archives/1096?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1096#comments</comments>
		<pubDate>Tue, 02 Mar 2010 21:12:57 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[Fortran]]></category>
		<category><![CDATA[Graphical programming]]></category>
		<category><![CDATA[LabView]]></category>
		<category><![CDATA[lego]]></category>
		<category><![CDATA[Matlab]]></category>
		<category><![CDATA[Mindstorms]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1096</guid>
		<description><![CDATA[When I got the Lego Mindstorms robotics kit that I have been blogging about before (1,2,3), one of my goals was to try my hands on some graphical &#8220;model-driven&#8221; programming. Thanks for the various tips for other more traditional programming environments that I have received over comments, Facebook, and personal email. But my main goal [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2010/03/j0434881.png"><img class="alignleft size-full wp-image-1099" title="j0434881" src="http://jakob.engbloms.se/wp-content/uploads/2010/03/j0434881.png" alt="" width="90" height="90" /></a>When I got the Lego Mindstorms robotics kit that I have been blogging about before (<a href="http://jakob.engbloms.se/archives/1058">1</a>,<a href="http://jakob.engbloms.se/archives/1079">2</a>,<a href="http://jakob.engbloms.se/archives/1086">3</a>), one of my goals was to try my hands on some graphical &#8220;model-driven&#8221; programming. Thanks for the various tips for other more traditional programming environments that I have received over comments, Facebook, and personal email. But my main goal was really to try to use the NXT environment as a graphical, domain-specific, rapid programming environment. Having played around with some simple projects for a couple of months now, it is clear that somethings are easier to do than others.</p>
<p><span id="more-1096"></span>Back in the late 1980s, in what seems to have been a golden era of software innovation, there were a number of companies trying to sell graphical programming environments for the graphics-oriented Macintosh computer. Makes sense, right? I remember that I did not think so at the time, and the reason was that things tended to look more complex in a visual system than when expressed as plain text. I think one of the examples I saw was <a href="http://en.wikipedia.org/wiki/Prograph">Prograph</a>, where unwieldy flow charts replaced nice and dense if-then statements.</p>
<p>Today, twenty years later, it is hard to dispute the success of model-driven and graphical environments like MatLab, LabView, and others. Dataflow is very good paradigm for many things in signal processing, and it fits very nicely with graphical representations. UML statecharts do express state machines in a pretty readable manner which is far superior to any particular code encoding of the same information.</p>
<p>However, I think the key here is that the languages are domain-specific to a large extent. General-purpose programming is still not really feasible in a graphical way, and I doubt it will ever be. You also need to &#8220;go with the flow&#8221; in these systems to get full benefit from them. If you start to think in imperative coding terms, you tend to quickly get lost&#8230; Here is a personal example that a friend (who will remain anonymous to protect the guilty) and I cooked up in NXT, trying to code an algorithm to guide a robot along a line. The picture both contains the graphical representation and the approximately equivalent imperative-style code.</p>
<p><a href="http://jakob.engbloms.se/wp-content/uploads/2010/03/graphical-computation-in-mindstorms.png"><img class="aligncenter size-medium wp-image-1097" title="graphical computation in mindstorms" src="http://jakob.engbloms.se/wp-content/uploads/2010/03/graphical-computation-in-mindstorms-300x131.png" alt="" width="300" height="131" /></a>All the little red boxes are value reads, writes, and manipulations. It is kind of elegant that you can pass values on from one block to the next, but overall the graphical representation must be said to be totally unreadable. The logic was pretty good, actually, but it did not do things like you are supposed to do in Mindstorms. Rather than a reactive &#8220;act wait act&#8221; cycle, we tried to code complex loops.</p>
<p>I guess this is an example of the old saying that a good (or determined) programmer can <a href="http://queue.acm.org/detail.cfm?id=1039535">write FORTRAN in any programming language</a>. As an aside, I recall a Russian-schooled professor I had as an undergraduate who managed to abuse Prolog to create a deterministic loop from its backtracking system. Ugly indeed, but also quite an impressive feat of semantic wrestling.</p>
<p>The Mindstorm-style solution to following a line was found by a bit of Googling, and for the robot that I built a fairly (not entirely, though) robust program looked like this. Credit to <a href="http://www.nxtprograms.com/line_follower/steps.html">http://www.nxtprograms.com/line_follower/steps.html </a>for the original program that I had to modify just a bit to work with Mindstorms NXT 2.0.</p>
<p><a href="http://jakob.engbloms.se/wp-content/uploads/2010/03/line-follower.png"><img class="aligncenter size-full wp-image-1098" title="line follower" src="http://jakob.engbloms.se/wp-content/uploads/2010/03/line-follower.png" alt="" width="623" height="450" /></a></p>
<p>In a sense, this program is bad since it obviously relies on non-functional properties of the NXT environment which are not semantically specified (i.e., the speed of sensing and how to drive the motors the fastest). However, the sense-act loop with no state saving is the right way.</p>
<p>Obviously, other graphical environments will have other strengths and weaknesses, but I think that this is a nice illustration that the typical constructs of general-purpose programming languages are poor fits for graphical visualization. Variables are simply not very visual in their nature&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1096/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Kindergarten Robot 2: Going Programmable</title>
		<link>http://jakob.engbloms.se/archives/1086?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1086#comments</comments>
		<pubDate>Sun, 21 Feb 2010 20:32:03 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[embedded systeme]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[lego]]></category>
		<category><![CDATA[MEPROM]]></category>
		<category><![CDATA[Mindstorms]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1086</guid>
		<description><![CDATA[
As discussed in my previous blog post about Kindergarten robots, I wanted to see if I can teach kids the core idea of programming. This project has now progressed to the point that I have a working prototype of a programmable robot.
Essentially,  the robot is programmed by putting colored Lego bricks in a sequence [...]]]></description>
			<content:encoded><![CDATA[<h2><img class="alignleft size-full wp-image-1057" style="margin: 5px;" title="lego mindstorms nxt2" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/lego-mindstorms-nxt2.png" alt="lego mindstorms nxt2" width="146" height="126" /></h2>
<p>As discussed in my <a href="http://jakob.engbloms.se/archives/1079">previous blog post </a>about Kindergarten robots, I wanted to see if I can teach kids the core idea of programming. This project has now progressed to the point that I have a working prototype of a programmable robot.</p>
<p>Essentially,  the robot is programmed by putting colored Lego bricks in a sequence on  top of the robot. This should be accessible and direct enough to work  with kids &#8212; and with no computer needed, just direct physical interaction with  the system. For some reason, I think the extra level of abstraction from a screen to a robot is just an unnecessary obstacle at this level.</p>
<p><span id="more-1086"></span><br />
For an example run, see the <a href="http://www.youtube.com/watch?v=U-18jmUnGqU">Youtube video </a>linked below:</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="425" height="344" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/U-18jmUnGqU&amp;hl=sv_SE&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="425" height="344" src="http://www.youtube.com/v/U-18jmUnGqU&amp;hl=sv_SE&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object></p>
<p>The robot is shown in the picture below. Since I use the same base as a fast chaser robot, it uses the large wheels from a <a href="http://www.brickset.com/detail/?Set=8284-1">Technic kit I happened to have around</a>, and a decent swiveling rear wheel. Using treads for the drive would probably have given me a bit more precision, but this is faster and simply feels more fun.</p>
<p><img class="aligncenter size-full wp-image-1089" title="P1110612" src="http://jakob.engbloms.se/wp-content/uploads/2010/02/P1110612.JPG" alt="P1110612" width="550" height="491" /></p>
<p>The inspiration for the programming method came from the boardgame <a href="http://www.boardgamegeek.com/boardgame/18/roborally">Roborally</a>, where you are dealt a set of card with meanings like &#8220;forward&#8221;, &#8220;back&#8221;, &#8220;turn right&#8221;, &#8220;turn around&#8221;, etc., and have to make your robot navigate a hazardous landscape to get to a destination. In my kindergarten robot, I simplified the programming to just forward, left, and right. And there are no conveyor belts, lasers, pits, or other hazards on the field.</p>
<p>The program steps available are the following (the color sensor can only distinguish a few primary colors):</p>
<ul>
<li>Black &#8211; start bit</li>
<li>Blue &#8211; move forward</li>
<li>Green &#8211; turn right</li>
<li>Yellow &#8211; turn left</li>
<li>Red &#8211; honk the horn (beep)</li>
<li>White &#8211; stop bit</li>
</ul>
<p>As a programming language, this is definitely not Turing-complete and nothing that you could program anything useful with. In particular, the programming model lacks decision statements, loops, and variables. However, it conveys what I feel is at the heart of programming: obtaining a goal by putting together a sequence of very small and simple steps. If you cannot grasp the idea of many small steps, you will never be able to program in any meaningful way.</p>
<h2>User Testing</h2>
<p>I have not tested this with a group of kids yet, but only with myself and my five-year-old son. So far, it seems to work. After some initial confusion, he is starting to get the idea of putting steps in order and having the robot execute them.</p>
<p>Here are some very simple missions that can be used to get the programming thinking going:</p>
<ul>
<li>Turn around a corner (of the fridge in this case)</li>
<li>Move to hit a balloon lying on the floor some distance away</li>
<li>Move in a square pattern to get back where it started</li>
</ul>
<p>I am sure I will think of more as I go along. I will blog some more once I have more experience with the robot.</p>
<h2>Details of the Program Memory</h2>
<p>The major problem that had to be solved to build this robot was creating a working program memory. I have decided to call the program memory <strong>MEPROM</strong>, for &#8220;Mechanically Erasable Programmable Read-Only Memory&#8221;. It is a ROM, since the robot itself cannot change it.  Since you can both remove program steps and put in new steps using mechanical means (human hands, typically), it is definitely an M-EPROM.</p>
<p>The idea for the memory is simple: use Lego bricks to represent moves.  It took a while to come up with the current form, as there are many ways  to move colored bricks past a sensor.</p>
<p>Two of the program steps can be seen below: I used 3&#215;1 standard lego bricks (which I borrowed from my son&#8217;s Legos, since  it seems very hard to find good kits containing this particular type of brick):</p>
<p><img class="aligncenter size-medium wp-image-1087" title="P1110625" src="http://jakob.engbloms.se/wp-content/uploads/2010/02/P1110625-300x210.jpg" alt="P1110625" width="300" height="210" /></p>
<p>To move these programming blocks past the color sensor in order to read them, I used some classic Lego treads (which seems to have been in use <a href="http://www.brickset.com/detail/?Set=856-1">since the late 1970s</a>!). Today, these can be best obtained by buying the <a href="http://http://www.brickset.com/detail/?Set=8259-1">Mini Bulldozer kit (8259)</a>. The program steps are put on alternate tread elements:</p>
<p><img class="aligncenter size-full wp-image-1088" title="P1110631" src="http://jakob.engbloms.se/wp-content/uploads/2010/02/P1110631.JPG" alt="P1110631" width="550" height="405" /></p>
<p>The Mindstorms color sensor only sees six colors, as discussed above. Worse, it tends to see black in dark shadows. For this reason, it needs to read the bricks head-on to be reliable. I have tried in vain to make the system self-adjusting, so currently, the program start has to be manually aligning the start bit (black brick) in front of  the sensor. For the rest of the run, turning the driving motor 90 degrees reliably puts the next brick in place in front of the sensor.</p>
<p>The program turns out to be quite simple in the NXT programming environment. Turn program motor 90 degrees, sample the color sensor, and act accordingly using a &#8220;switch statement&#8221;:</p>
<p><a href="http://jakob.engbloms.se/wp-content/uploads/2010/02/Program.jpg"><img class="alignright size-medium wp-image-1090" title="Program" src="http://jakob.engbloms.se/wp-content/uploads/2010/02/Program.jpg" alt="Program" width="550" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1086/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Describe is not the same as Design</title>
		<link>http://jakob.engbloms.se/archives/1083?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1083#comments</comments>
		<pubDate>Mon, 15 Feb 2010 20:56:41 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[EDA]]></category>
		<category><![CDATA[ESL]]></category>
		<category><![CDATA[computer simulation technology]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[virtual platforms]]></category>
		<category><![CDATA[DML]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1083</guid>
		<description><![CDATA[The discussion on my previous blog post about &#8220;the ideal ESL language&#8221; made me think some more about the purpose of a hardware modeling or description language. If you look closely, you realize that there are two quite different goals being pursued by the tools and languages discussed there.
On one hand, we have the task [...]]]></description>
			<content:encoded><![CDATA[<p>The discussion on my previous blog post about &#8220;<a href="http://jakob.engbloms.se/archives/1008">the ideal ESL language</a>&#8221; made me think some more about the purpose of a hardware modeling or description language. If you look closely, you realize that there are two quite different goals being pursued by the tools and languages discussed there.</p>
<p>On one hand, we have the task of supporting the design of new hardware bits, for the purpose of creating it. On the other hand, we have the task of describing a particular design for the purpose of simulating it. These two are not necessarily the same.</p>
<p><span id="more-1083"></span>To use an <a href="http://jakob.engbloms.se/archives/1035">analogy with building a house</a>, a design language helps the architect create the house (piece of hardware). Since the architect relies on craftsmen and experts (compilers) to do detailed design (how to put in windows, where to put light switches, etc.), the high-level description does not contain all the details of the house. However, if you are trying to simulate the house (piece of hardware) so that its inhabitants (software) don&#8217;t see the difference to the real thing, the details are sometimes what matters most. For example, the precise way to operate the stove in the house is very important for familiarity, but is a detail most likely left out of the architect&#8217;s initial drawings.</p>
<p>A design language can leave many things unspecified to be filled in by a compiler, but these things can be absolutely core to a description language. In particular, programming register maps tend to be created as a not-too-important side activity in hardware design. They do not really need to be visible in higher-level ESL languages, as they can obviously be filled in later by a tool or a human. But for a description language, they are absolutely core.</p>
<p>A description language can also leave out many parts of the hardware. If the software being used or written does not use certain modes or functions of a piece of hardware, those pieces can be ignored and implemented as dummies. That means that support for dummies is very important in description languages. But dummies make little sense in a design language, as you are unlikely to design a chip with lots of area spent on dummy functions that do nothing.</p>
<p>A description language can also ignore crucial aspects like power constraints and synthesis constraints. These are guidelines for a compilation step that has no bearing on the description of the hardware &#8212; the description language should describe what ended up happening, not the if, please, what, and buts that guided how we got there.</p>
<p>For virtual platform creation, you seem to need a bit of both. I maintain that most of a VP is based on old hardware that exists, which calls for languages with strong description abilities. That&#8217;s the space that <a href="http://jakob.engbloms.se/archives/99">Simics DML </a>was designed for. For the small part of the hardware that is novel would be nice to have some way to convert from a design language to a virtual platform. Here, I don&#8217;t really see any usable current tools or languages &#8212; SystemC is really more a design language, but if you want a virtual platform model, you have to use it as a description language. There is no automagic getting to a fast abstract model from a design-oriented description. That&#8217;s why we need new, higher level systems, that can push out decent descriptions from a design.</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1083/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Kindergarten Robot</title>
		<link>http://jakob.engbloms.se/archives/1079?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1079#comments</comments>
		<pubDate>Tue, 09 Feb 2010 20:16:50 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[appearances]]></category>
		<category><![CDATA[embedded systeme]]></category>
		<category><![CDATA[teaching]]></category>
		<category><![CDATA[lego]]></category>
		<category><![CDATA[Mindstorms]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1079</guid>
		<description><![CDATA[One of my little projects while on parental leave has been to play around with my Lego Mindstorms NXT 2.0 robotics kit. Apart from being fun for a serious dad like myself, I always had in mind how I could use it with kids to get them interested in technology.
When I was a PhD student [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1057" style="margin: 10px 5px;" title="lego mindstorms nxt2" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/lego-mindstorms-nxt2.png" alt="lego mindstorms nxt2" width="146" height="126" />One of my little projects while on parental leave has been to play around with my Lego Mindstorms NXT 2.0 robotics kit. Apart from being fun for a serious dad like myself, I always had in mind how I could use it with kids to get them interested in technology.</p>
<p>When I was a PhD student in Uppsala back around 2000, we bought a pile of the Lego Mindstorms RCX kits, for use in real-time courses. Obviously, the students loved the opportunity to play with Lego (including the few females). What was less obvious and much more interesting was what happened when we brought in a bunch of children from a local kindergarten to visit &#8212; they really took a liking to our little yellow robots running around a classroom. They treated the robots as little animals, wondering what they were doing and why&#8230;</p>
<p>With that in mind, I decided to try to reprise this myself with my own son and his kindergarten friends. <img title="More..." src="../wp-includes/js/tinymce/plugins/wordpress/img/trans.gif" alt="" />Last week, I took my robot kit with me and went to meet the kids.</p>
<p><span id="more-1079"></span>My top-level goal with exercise was really to get the kids interested in technology as a future field of study and venture&#8230; you have to start early to counteract the prevalent tendency of people to want to be famous and work in media or something&#8230; Only time will tell if this had any effect at all (I doubt it).</p>
<p>In addition to the top-level goal, I wanted to communicate some about how things work. Make technology more understandable and less magical, and more accessible. In particular:</p>
<ul>
<li>Autonomy: the robot is not under remote control, it acts autonomously based on its programming.</li>
<li>Sense-compute-actuate: the robot perceives the world and makes decisions that get sent to the motors.</li>
<li>Limited sensors: the robot does not see like we do, it uses far simpler sensing.</li>
<li>Programmability: the same physical setup can do a lot of different things just by switching to a different program.</li>
<li>Concurrency: the robot can do several unrelated things at once.</li>
<li>Stupidity: the robot is really dumb and just reacts very predictably to its environment.</li>
</ul>
<p>I think these points can be brought across using an indirect approach. You cannot tell a four-year-old about programmability. But you can show that if you go to the robot&#8217;s control unit and press some buttons it does something different.</p>
<p>Note that some of the points above are artificial, in that you could build much smarter programs with more complex behaviors and less direct reactions. But that would make things more magical and &#8220;human-like&#8221;, which is not what I wanted to communicate.</p>
<p>Anyway, in the end I used two configurations of a driving base, with a few different programs.</p>
<p>The first configuration is shown below, using a color sensor pointing downwards and an ultrasound sensor pointing forward.It also had a shooter pointing forward (in this picture, the organic styling of the <a href="http://bionicle.wikia.com/wiki/Zamor_Launcher">Lego Bionicle Zamor</a>-derived shooter comes across very nicely, as well as the apparently <a href="http://www.brickset.com/detail/?Set=8719-1">quite special silver- and gold-colored </a>balls I picked up on a sale).</p>
<p><img class="aligncenter size-full wp-image-1080" title="shooterbot" src="http://jakob.engbloms.se/wp-content/uploads/2010/02/shooterbot.jpg" alt="shooterbot" width="500" height="620" /></p>
<p>First, I had this robot follow a black line on the floor. Putting the line down was fun, watching the robot follow the line did not work out as intended. Too hard to explain the algorithm for following the contrast between black and not-black. Adding the behavior to stop when the robot hit a red line was also too subtle.</p>
<p>Next, I tried to put the robot on a table with the program &#8220;stay within black lines&#8221;. Or rather &#8220;reverse and turn if you hit a black line&#8221;. Problem was that the table had a spotted pattern that included small specks of black, and the robot just kept doing avoidance maneuvers&#8230; so that failed. I still want to do a table-dancing robot, but I guess relying on an ultrasound sensor pointing downwards to detect the chasm at the edge will work better.</p>
<p>What was fun though was when I activated the ultrasound sensor and the shooter: the robot would crawl along the line, and if something got in the way, it would fire a ball. That was huge fun! All the kids crowded around to get the robot to shoot and collect the balls. Note for future attempts: dramatic actions are great!</p>
<p>It was even better when I set the robot to rove freely, using the ultrasound sensor to turn when something got in its way. This was an easy-to-understand behavior that the kids appreciated, putting feet and hands in the way of the robot to make it turn. The poor robot was often the center of a pile of kids that were all trying to make it turn.</p>
<p>I also tried a configuration using bumper sensors:</p>
<p><img class="aligncenter size-full wp-image-1081" title="bumberbot" src="http://jakob.engbloms.se/wp-content/uploads/2010/02/bumberbot.jpg" alt="bumberbot" width="500" height="375" />Here, the robot only had one program, to move forward until it hit something, and based on the side that hit, back up and turn to avoid hitting the same obstacle again. This was a very successful configuration. The kids started to play &#8220;don&#8217;t touch the robot&#8221; with it, having it drive between their legs or bending over the robot to make a bridge &#8211; but not touching it and making it turn.</p>
<p>Note that I did not bring any computer with me, all programs were preloaded on the NXT brick. Very handy, actually.</p>
<p>In summary, I had a great time doing this, and I will be back with new configurations and programs. Creating the programs was very quick and easy in the Mindstorms environment, proving the value of domain-specific programming.</p>
<p>The kids have hopefully learned that you can play with and control technology, and that you should not be too respectful. Maybe someone also picked up some of the ideas I presented at the start of this blog post.</p>
<h3>Gender-Theoretical Notes</h3>
<p>I do have to end with a slightly sad note.</p>
<p>It was surprising to me just how differently the boys and the girls reacted and behaved. I had assumed that kids would just be kids at this age (three to five years old), with no gender-related differences. It was very striking that this was not the case in reality. The boys just ran in and started playing, and very quite hard to get to listen to anything I had to say. The girls walked in and quietly waited for instructions, and took some warming-up before they would interact with the robot.</p>
<p>I cannot blame our kindergarten for this, they are definitely trying to avoid gender-based stereotypes.I guess it shows that fighting societal norms is just as hard as everyone says it is.</p>
<p>It was also interesting that the kids were surprised to see a parent build with Lego and have a great time. For some reason, that was not expected behavior from a dad. Sad too.</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1079/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>500K Spam</title>
		<link>http://jakob.engbloms.se/archives/1076?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1076#comments</comments>
		<pubDate>Wed, 03 Feb 2010 20:11:39 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[security]]></category>
		<category><![CDATA[spam]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1076</guid>
		<description><![CDATA[We recently had a malfunction in our spam filters at work, so I had to go back and review the catch for possible false positives. I sort things into two bins using spamassassin, one for most likely spam, and one for probable spam.  When things started to go bad, the most likely folder had reached [...]]]></description>
			<content:encoded><![CDATA[<p>We recently had a malfunction in our spam filters at work, so I had to go back and review the catch for possible false positives. I sort things into two bins using spamassassin, one for most likely spam, and one for probable spam.  When things started to go bad, the most likely folder had reached more than 2 GB, and the probable some 500 MB.</p>
<p><span id="more-1076"></span>As you can see from the webmail screenshot below, the probable folder contained almost 100 thousand spam email. These were collected since May of 2008, or in a space of roughly 21 months.</p>
<p><img class="aligncenter size-full wp-image-1077" title="spamassassin 98322 messages caught" src="http://jakob.engbloms.se/wp-content/uploads/2010/02/spamassassin-98322-messages-caught.png" alt="spamassassin 98322 messages caught" width="715" height="400" /></p>
<p>If I guesstimate that the other folder has about the same average size, that adds in another 400 thousand spam. Bringing the total caught by these filters to about half a million overall. If you divide it down to days, it is &#8220;only&#8221; about 630 per day, plus some more that secondary spam filters catch, plus the ones that get through and I manually have to delete. But these other ones won&#8217;t add up to much more than a few tens of thousands in the same time spa<del datetime="2010-02-03T20:02:13+00:00">m</del>n.</p>
<p>It is amazing just how voluminous this infestation is&#8230;</p>
<p>Legit business emails can&#8217;t be much more than fifty per day, plus various general mailing lists. Still, that means that probably no more than 75% of all email I receive is spam. Maybe I should consider myself lucky, I have seen analysis talking about 99% of all email on the Internet being spam&#8230;</p>
<p>Interesting it was.</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1076/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Neat Register Design to Avoid Races</title>
		<link>http://jakob.engbloms.se/archives/1070?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1070#comments</comments>
		<pubDate>Thu, 28 Jan 2010 18:59:53 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[ESL]]></category>
		<category><![CDATA[embedded software]]></category>
		<category><![CDATA[embedded systeme]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[64-bit computing]]></category>
		<category><![CDATA[device driver]]></category>
		<category><![CDATA[Gary Stringham]]></category>
		<category><![CDATA[high-level synthesis]]></category>
		<category><![CDATA[programming register]]></category>
		<category><![CDATA[race condition]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1070</guid>
		<description><![CDATA[In his most recent Embedded Bridge Newsletter, Gary Stringham describes a solution to a common read-modify-write race-condition hazard on device registers accessed by multiple software units in parallel. Some of the solutions are really neat!
I have seen the &#8220;write 1 clears&#8221; solution before in real hardware, but I was not aware of the other two [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-589" style="margin: 5px 10px;" title="racecondition" src="http://jakob.engbloms.se/wp-content/uploads/2008/01/racecondition.png" alt="racecondition" width="99" height="78" />In his most recent <a href="http://garystringham.com/newsletter.shtml?nid=039">Embedded Bridge Newsletter</a>, Gary Stringham describes a solution to a common read-modify-write race-condition hazard on device registers accessed by multiple software units in parallel. Some of the solutions are really neat!</p>
<p>I have seen the &#8220;write 1 clears&#8221; solution before in real hardware, but I was not aware of the other two variants. The idea of having a &#8220;write mask&#8221; in one half of a 32-bit word is really clever.</p>
<p>However, this got me thinking about what the fundamental issue here really is.</p>
<p><span id="more-1070"></span></p>
<p>As I see it, it is the fact that the processor cannot address small enough units atomically. The <a href="http://garystringham.com/newsletter.shtml?nid=037">read-modify-write that was used to start the discussion in the Embedded Bridge #37</a> was needed in order to get the current state of a configuration register, change some setting that only occupied a few bits in it, and write back the result to the register. The way most configuration registers that I have seen in practice works.</p>
<p>But if each setting could be given its own register, the problem would go away. Each operation would target a unique address, achieving the same effect as the bit-wise masks or write-1 solutions proposed. The core problem is that hardware tends to share settings into registers, as it has been considered too expensive to put information that might cover a range as small as [0,1] into a 32-bit register. Probably, since there is a lack of addresses for registers, you cannot have 1000 settings cause each simple device to use up 1000 words of physical addresses.</p>
<p>But is that really an issue, if we look forward?</p>
<p>It seems to me that, as 64-bit instruction sets and addressing systems penetrate down into more and more embedded systems, a simple solution would be to throw address space at the problem. I don&#8217;t think it is uneconomical to allocate huge chunks of memory space to each device, giving each setting its own register, when you have 64 bit virtual addresses to work with. There is no way you can fill up a physical memory system (guess that will some day come back to haunt me)&#8230; even the highest-end machines today only use something like 40 bits for actually addressing physical memories.</p>
<p>The software would be simpler and more robust, with virtually no cost.</p>
<p>Another solution that I have also seen starting to appear is to dispense with register settings altogether, and rather define a command API that the processor &#8220;calls&#8221; by putting in command packets into some memory area. This does require quite a bit of silicon for a decoder, but it provides for a much higher level of interaction with devices. As hardware devices get defined in successively higher-level languages (C, C++, UML, MatLab, &#8230;), and <a href="http://jakob.engbloms.se/archives/871">their programming interfaces and associated drivers get autogenerated</a>, this solution makes eminent sense.</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1070/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Compiler Code Size Comparisons (for Possible Embarrassment)</title>
		<link>http://jakob.engbloms.se/archives/1068?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1068#comments</comments>
		<pubDate>Tue, 26 Jan 2010 11:34:48 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[embedded software]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[code optimization]]></category>
		<category><![CDATA[code size]]></category>
		<category><![CDATA[compilers]]></category>
		<category><![CDATA[gcc]]></category>
		<category><![CDATA[John Regehr]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1068</guid>
		<description><![CDATA[An embedded researcher friend of mine has posted some data on code sizes from various compilers at http://embed.cs.utah.edu/embarrassing/. The &#8220;embarrassing&#8221; bit is the idea that compiler writes should be ashamed when other compilers do better than theirs. It is worth looking over the data, even though the methodology and benchmarks are not yet perfect by [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-166" title="whyc" src="http://jakob.engbloms.se/wp-content/uploads/2008/07/whyc.png" alt="whyc" width="100" height="106" />An embedded researcher friend of mine has posted some data on code sizes from various compilers at <a href="http://embed.cs.utah.edu/embarrassing/">http://embed.cs.utah.edu/embarrassing/</a>. The &#8220;embarrassing&#8221; bit is the idea that compiler writes should be ashamed when other compilers do better than theirs. It is worth looking over the data, even though the methodology and benchmarks are not yet perfect by any means.</p>
<p><span id="more-1068"></span></p>
<p>When this data was brought to the attention of the gcc developers on the gcc mailinglist, a very interesting and elucidating discussion followed. See <a href="http://gcc.gnu.org/ml/gcc/2009-12/msg00176.html">http://gcc.gnu.org/ml/gcc/2009-12/msg00176.html </a>and follow all the subthreads from there.</p>
<p>There is a key issue in the gcc discussions, about whether code that relies on uninitialized variables and similar make any sense. I personally think that any code that triggers warnings on one or more compilers should be disqualified, as only really portable code should be reasonable to compare in a shoot-out like this. Code that is &#8220;undefined&#8221; by the C standard really does not provide any interesting information.</p>
<p>Personally, I would also like to see some comparisons between compilers aiming for size, for targets where size really matters. For example, ARM Cortex-R or Cortex-M CPUs, with compilers from commercial players like ARM, IAR, GreenHills, etc. I understand that such a shoot-out is very hard to arrange in practice, however .</p>
<p>Another interesting measure would be the evenness or robustness of a compiler. Is a compiler consistently generating decent code, or does it swing wildly from very good to very bad? I guess you could approximate this if you compared the size for a function generated by a particular compiler to the average of all other compilers&#8217; code for that function. Could give an interesting graph for each compiler.</p>
<p>The code sources are quite interesting: it is isolated functions collected from a large spread of open-source projects. Quite often it looks like the extremes of differences from one compiler to another corresponds to extreme functions. I liked <a href="http://embed.cs.utah.edu/embarrassing/jan_10/harvest/source/E8/E88C5111.c">this one</a>, where <a href="http://embed.cs.utah.edu/embarrassing/jan_10/harvest/compare_clang-head_llvm-gcc-head/">clang created a file 20x the size of llvm</a>. I can see how a naive switch generator gets big here, while an optimized switch code generator can make some very simple comparison statements out of it (this is a bit from Qemu, from a PCI device model, which is close to my interest of virtual platforms, we get this kind of code a lot).</p>
<p><code>sh_pci_reg_write (void *p, target_phys_addr_t addr, uint32_t val)<br />
{<br />
uint32_t *__tmp__282;</code></p>
<p>switch ((int) addr)<br />
{<br />
case 0:<br />
case 1:<br />
case 2:<br />
case 3:<br />
case 4:<br />
case 5:<br />
case 6:<br />
case 7:<br />
case 8:<br />
case 9:<br />
case 10:<br />
case 11:<br />
case 12:<br />
case 13:<br />
case 14:<br />
case 15:<br />
case 16:<br />
case 17:<br />
case 18:<br />
case 19:<br />
case 20:<br />
case 21:<br />
case 22:<br />
case 23:<br />
case 24:<br />
case 25:<br />
case 26:<br />
case 27:<br />
case 28:<br />
case 29:<br />
case 30:<br />
case 31:<br />
case 32:<br />
case 33:<br />
case 34:<br />
case 35:<br />
case 36:<br />
case 37:<br />
case 38:<br />
case 39:<br />
case 40:<br />
case 41:<br />
case 42:<br />
case 43:<br />
case 44:<br />
case 45:<br />
case 46:<br />
case 47:<br />
case 48:<br />
case 49:<br />
case 50:<br />
case 51:<br />
case 52:<br />
case 53:<br />
case 54:<br />
case 55:<br />
case 56:<br />
case 57:<br />
case 58:<br />
case 59:<br />
case 60:<br />
case 61:<br />
case 62:<br />
case 63:<br />
case 64:<br />
case 65:<br />
case 66:<br />
case 67:<br />
case 68:<br />
case 69:<br />
case 70:<br />
case 71:<br />
case 72:<br />
case 73:<br />
case 74:<br />
case 75:<br />
case 76:<br />
case 77:<br />
case 78:<br />
case 79:<br />
case 80:<br />
case 81:<br />
case 82:<br />
case 83:<br />
case 84:<br />
case 85:<br />
case 86:<br />
case 87:<br />
case 88:<br />
case 89:<br />
case 90:<br />
case 91:<br />
case 92:<br />
case 93:<br />
case 94:<br />
case 95:<br />
case 96:<br />
case 97:<br />
case 98:<br />
case 99:<br />
case 100:<br />
case 101:<br />
case 102:<br />
case 103:<br />
case 104:<br />
case 105:<br />
case 106:<br />
case 107:<br />
case 108:<br />
case 109:<br />
case 110:<br />
case 111:<br />
case 112:<br />
case 113:<br />
case 114:<br />
case 115:<br />
case 116:<br />
case 117:<br />
case 118:<br />
case 119:<br />
case 120:<br />
case 121:<br />
case 122:<br />
case 123:<br />
case 124:<br />
case 125:<br />
case 126:<br />
case 127:<br />
case 128:<br />
case 129:<br />
case 130:<br />
case 131:<br />
case 132:<br />
case 133:<br />
case 134:<br />
case 135:<br />
case 136:<br />
case 137:<br />
case 138:<br />
case 139:<br />
case 140:<br />
case 141:<br />
case 142:<br />
case 143:<br />
case 144:<br />
case 145:<br />
case 146:<br />
case 147:<br />
case 148:<br />
case 149:<br />
case 150:<br />
case 151:<br />
case 152:<br />
case 153:<br />
case 154:<br />
case 155:<br />
case 156:<br />
case 157:<br />
case 158:<br />
case 159:<br />
case 160:<br />
case 161:<br />
case 162:<br />
case 163:<br />
case 164:<br />
case 165:<br />
case 166:<br />
case 167:<br />
case 168:<br />
case 169:<br />
case 170:<br />
case 171:<br />
case 172:<br />
case 173:<br />
case 174:<br />
case 175:<br />
case 176:<br />
case 177:<br />
case 178:<br />
case 179:<br />
case 180:<br />
case 181:<br />
case 182:<br />
case 183:<br />
case 184:<br />
case 185:<br />
case 186:<br />
case 187:<br />
case 188:<br />
case 189:<br />
case 190:<br />
case 191:<br />
case 192:<br />
case 193:<br />
case 194:<br />
case 195:<br />
case 196:<br />
case 197:<br />
case 198:<br />
case 199:<br />
case 200:<br />
case 201:<br />
case 202:<br />
case 203:<br />
case 204:<br />
case 205:<br />
case 206:<br />
case 207:<br />
case 208:<br />
case 209:<br />
case 210:<br />
case 211:<br />
case 212:<br />
case 213:<br />
case 214:<br />
case 215:<br />
case 216:<br />
case 217:<br />
case 218:<br />
case 219:<br />
case 220:<br />
case 221:<br />
case 222:<br />
case 223:<br />
case 224:<br />
case 225:<br />
case 226:<br />
case 227:<br />
case 228:<br />
case 229:<br />
case 230:<br />
case 231:<br />
case 232:<br />
case 233:<br />
case 234:<br />
case 235:<br />
case 236:<br />
case 237:<br />
case 238:<br />
case 239:<br />
case 240:<br />
case 241:<br />
case 242:<br />
case 243:<br />
case 244:<br />
case 245:<br />
case 246:<br />
case 247:<br />
case 248:<br />
case 249:<br />
case 250:<br />
case 251:<br />
case 252:;<br />
__tmp__282 = (uint32_t *) ((((SHPCIC *) p)-&gt;dev)-&gt;config + addr);<br />
*__tmp__282 = val;<br />
break;<br />
case 448:;<br />
((SHPCIC *) p)-&gt;par = val;<br />
break;<br />
case 452:;<br />
((SHPCIC *) p)-&gt;mbr = val;<br />
break;<br />
case 456:;<br />
((SHPCIC *) p)-&gt;iobr = val;<br />
break;<br />
case 544:;<br />
pci_data_write (((SHPCIC *) p)-&gt;bus, ((SHPCIC *) p)-&gt;par, val, 4);<br />
break;<br />
}<br />
return;<br />
}</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1068/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Contributing to the Reversible GDB</title>
		<link>http://jakob.engbloms.se/archives/1065?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1065#comments</comments>
		<pubDate>Tue, 19 Jan 2010 20:54:35 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[gdb]]></category>
		<category><![CDATA[Tomas Holmberg]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1065</guid>
		<description><![CDATA[Last week, I finally got the last &#8220;OK&#8221; from the maintainers of GDB, the Gnu Debugger, indicating that my contribution to the GDB project was accepted. This is my first contribution to an open-source project, and the piece of code that has my name on it is positively puny. It is actually not really code [...]]]></description>
			<content:encoded><![CDATA[<p>Last week, I finally got the last &#8220;OK&#8221; from the maintainers of GDB, the Gnu Debugger, indicating that my contribution to the GDB project was accepted. This is my first contribution to an open-source project, and the piece of code that has my name on it is positively puny. It is actually not really code at all, it is just a piece of documentation, for the extensions to the GDB-MI command set needed to support <a href="http://sourceware.org/gdb/news/reversible.html">reversible debugging</a>. The actual code doing the work was contributed by a colleague of mine, Tomas Holmberg, credit where credit is due.</p>
<p><span id="more-1065"></span>So what is the significance of this code?</p>
<p>Essentially, there are three main communications protocols or channels involved with GDB. There is the direct command-line interface familiar to most GDB users. There is the gdb-serial protocol for talking between a GDB and a GDB server on some remote machine.There is the GDB-MI, Machine Interface, protocol used to directly control a GDB debugger from another program. In particular, <a href="http://www.eclipse.org">Eclipse </a>uses GDB-MI to control GDB, when using GDB as the debugger back-end for Eclipse.</p>
<p>With GDB-serial, a remote machine can also be a simulator, hardware emulator, or anything else that presents the right interface to GDB. Indeed, using gdb-serial is the most common way to attach &#8220;anything&#8221; to be debugged by GDB. Simics, VMWare, and many other virtual platform solutions support gdb-serial as a way to get the power of the GDB debugger (source code lookup, scripting, and the smarts to deal with complex languages like C++ and Ada, and much more) for debugging code running on the virtual machine. The requirements on a gdb server are very simple, it really is just start/stop/step, and setting breakpoints and modifying memory.</p>
<p>When GDB 7.0 came out, support for reverse debugging was the really big piece of news. With the initial release of 7.0, you could access reverse debug from the GDB command-line interface, driving either local process record/replay targets, or remote gdb-serial targets. Simics was among the first simulators to support reverse debugging over gdb-remote, since the command set for doing reverse debug was essentially contributed by Virtutech with the initial release of reverse debugging in Simics back in 2005. <a href="http://sourceware.org/ml/gdb-patches/2006-03/msg00388.html">Michael Snyder got that code into the reversible GDB development from the start</a>, we can claim no credit for getting it into the mainline GDB.</p>
<p>However, the MI interface was missing reverse debugging commands, and I have been involved in getting that support into the GDB source tree. It has taken quite a while longer than I expected, and it has been quite an interesting journey.</p>
<p>When we started the work back in late 2008, we had a set of MI commands that was used in a Virtutech-specific patch to GDB 6.8. This set of commands and their supporting code was submitted to the GDB mailinglist in early 2009, but got rejected by the maintainers. In the end, we changed the commands according to the wishes of the maintainers, and added test cases and documentation (my bit). This patch was then resubmitted, reviewed, and updated in a few more iterations. The final update was to align the code with the latest code updates to GDB.</p>
<p>Along the way, Tomas and I had to sign some legal papers to assign copyright to the code we contributed to the <a href="http://www.fsf.org/">FSF</a>. For some reason, the first batch of papers got lost on their way across the Atlantic to us to get signed, forcing a delay of some months.</p>
<p>So, now, we have GDB with MI supporting reversible debugging. Finally, I hope it arrived in time to help the Eclipse people get reverse debugging into Eclipse as a standard feature.</p>
<p>For me, even though this process sometimes felt like it would never end, it has been very interesting.</p>
<ul>
<li>The process is frustrating in that if you disagree with a maintainer on some issues, things can stall until you realize the errors of your way and repent. We had such a discussion on the style of the GDB reverse commands, both in MI and the main command-line interface. The viewpoint that I supported lost, which I think is a shame, but at least the functionality is there.</li>
<li>Related to that, the discussions on the gdb mailinglists have been quite interesting. If you have relevant points, people will tend to listen. The value of ideas is judged from how well they work, and usually not from set agendas or corporate grand strategies.</li>
<li>Sometimes, you really miss the function of an overall product manager for GDB. Somewhere or someone that takes responsibility for the overall direction of the product. Today, we have a very productive anarchy, which certainly works, but is a bit unfamiliar to someone used to commercial and planned software development.</li>
<li>Compared to some other standards work that I have been involved in, GDB is a much faster process. Collaboratively improving a shared body of code is a nice way to work, but it might be very hard to port over to company-driven future-pointing standards. For example, if no code exists, the model hardly works.</li>
<li>The user-interface design coming out of the GDB community is clearly quite geeky and often not what I think a UI designer would come up with. The GDB reverse commands, with a &#8220;set direction&#8221; command is one example. Another interesting one starts <a href="http://sourceware.org/ml/gdb/2009-11/msg00210.html">here</a>, with my input <a href="http://sourceware.org/ml/gdb/2009-12/msg00016.html">here</a>.</li>
</ul>
<p>Happy reversible debugging, all!</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1065/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Eclipse: Changing the Java Heap Size</title>
		<link>http://jakob.engbloms.se/archives/1062?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1062#comments</comments>
		<pubDate>Wed, 13 Jan 2010 16:46:53 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[desktop software]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[eclipse]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1062</guid>
		<description><![CDATA[I just won a battle against Eclipse, managing to finally rid myself of a string of strange out-of-heap warnings. It is a long story, involving lots of web searching and fiddling with the eclipse.ini file options for the JVM. It just never seemed to work as I wanted it to, despite changing the -Xmx VM [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1063" title="eclipseicon" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/eclipseicon.png" alt="eclipseicon" width="73" height="71" />I just won a battle against Eclipse, managing to finally rid myself of a string of strange out-of-heap warnings. It is a long story, involving lots of web searching and fiddling with the eclipse.ini file options for the JVM. It just never seemed to work as I wanted it to, despite changing the -Xmx VM argument to 256, then 512, and finally 1024m.</p>
<p><span id="more-1062"></span>Turned out that the problem was not at all related to the names of the parameters to the VM. Xmx is the right way to grow the heap.This set of parameters <em>does </em>work when put into an eclipse.ini file (for Eclipse 3.5):</p>
<pre>-vmargs
-Dosgi.requiredJavaVersion=1.5
-Xms40m
-Xmx1024m</pre>
<p>The problem was that Eclipse actually never read its eclipse.ini file, because I had changed the name of the main Eclipse binary. I have several Eclipse installations with different versions active at the same time, and to bring some sanity to shortcuts and Windows start menu items, I started renaming the executables to include the version name. Thus, I had &#8220;eclipse-3.5.1.exe&#8221; rather than &#8220;eclipse.exe&#8221; in the problematic case.</p>
<p>It seems that eclipse when starting reads a file like &#8220;my-file-name&#8221;.ini, and thus all changes to the file &#8220;eclipse.ini&#8221; has no effect for &#8220;eclipse-3.5.1.exe&#8221;.</p>
<p>Why do I always find these bugs?</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1062/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Concurrency in Lego Mindstorms NXT</title>
		<link>http://jakob.engbloms.se/archives/1058?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1058#comments</comments>
		<pubDate>Fri, 08 Jan 2010 21:19:54 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[parallel computing]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[ARM]]></category>
		<category><![CDATA[AVR]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[LabView]]></category>
		<category><![CDATA[lego]]></category>
		<category><![CDATA[Mindstorms]]></category>
		<category><![CDATA[NXT]]></category>
		<category><![CDATA[parallelized software]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1058</guid>
		<description><![CDATA[
For my parental leave, I have just bought myself a Lego Mindstorm NXT 2.0 kit. It is not much fun for our youngest, who mostly gets a bit scared by a piece of Lego driving around making noises, but I hope to be able to use it to teach my older child (almost five) to [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1057" style="margin: 5px 10px;" title="lego mindstorms nxt2" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/lego-mindstorms-nxt2.png" alt="lego mindstorms nxt2" width="146" height="126" /></p>
<p>For my parental leave, I have just bought myself a <a href="http://www.mindstorms.com">Lego Mindstorm NXT 2.0 kit</a>. It is not much fun for our youngest, who mostly gets a bit scared by a piece of Lego driving around making noises, but I hope to be able to use it to teach my older child (almost five) to program. Let&#8217;s see how that turns out. It looks hard to make the NXT environment provide the kind of <a href="http://www.boardgamegeek.com/boardgame/18/roborally">Roborally</a>-style programming blocks that I had hoped to create, as I cannot for some reason get a sufficiently custom icon onto custom blocks.</p>
<p>It also presented me with an opportunity to try some domain-specific high-level graphical programming. The programming environment provided for the NXT series of Mindstorms kits is based on LabView from National Instruments, and it really does seem to work. It even features parallel tasks, which I tried to use&#8230;</p>
<p><span id="more-1058"></span>It turned out that it is not that easy to get it right. I was trying to have a few different tasks look at different sensors and steer the robot in different directions based on the sensor readings. However, this quickly turned into a literal deadlock: the robot just sat there, doing nothing, after the first time that my ultrasound sensor task tried to steer it. Failure.</p>
<p>The manual is quite silent on the tasking semantics, and there are no (or I have not yet found) shared variables, locks, or message-passing mechanisms to synchronize the tasks.</p>
<p>Looking for an answer on the web, I came across a nice tutorial on tasking:</p>
<ul>
<li><a href="http://www.ortop.org/NXT_Tutorial/tasks.html">http://www.ortop.org/NXT_Tutorial/tasks.html</a></li>
</ul>
<p>It is a video, and it ends with the note that the only reliable way to multitask in the NXT environment is to NOT try to control the same thing from multiple tasks. If I want to listen to multiple sensors, the only way is to create a loop with switching on inputs. I.e., manual polling. So much for using the natural language of tasks to handle naturally concurrent activities. At some point, I might figure out if I can construct it from tasks and data value transfers, but for now, I will just go with the flow and write (or rather draw) some polling loops.</p>
<p>Here is an example from the manual. Note that the top &#8220;beam&#8221; controls motor A, and the bottom controls motors B and C:</p>
<p><img class="aligncenter size-full wp-image-1059" title="mindstorms manual excerpt" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/mindstorms-manual-excerpt.png" alt="mindstorms manual excerpt" width="691" height="448" /></p>
<p>That last part about data wires is intriguing&#8230; but I will need to find some more reference materials.</p>
<p>Anyway, the way to express parallel tasks here is really quite neat. At least as long as they are dealing with completely separate aspects of the control of the robot.</p>
<p>If this had been a more hard-core environment, it would have been fun to put different tasks on the ARM7 and AVR processors that are inside the NXT 2.0 brick. Yes, it is a true multiprocessor, if very limited in capabilities. At <a href="http://mindstorms.lego.com/en-us/whatisnxt/default.aspx">http://mindstorms.lego.com/en-us/whatisnxt/default.aspx </a>you have the specs. ARM7, 256 kB of FLASH, 64 kB of RAM, and the AVR has 512 bytes of RAM and 4 kB of FLASH. A nice real embedded machine!</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1058/feed</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Parental Leave</title>
		<link>http://jakob.engbloms.se/archives/1054?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1054#comments</comments>
		<pubDate>Fri, 08 Jan 2010 18:26:32 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[appearances]]></category>
		<category><![CDATA[blogging]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1054</guid>
		<description><![CDATA[
For the next few months, I will be on parental leave, so there is likely to be less blogging about technical subjects (and less blogging overall). There is simply less inspiration about virtual platforms, and a bit more about toys. 
]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1055" style="margin-left: 10px; margin-right: 10px;" title="jakob on parental leave_1" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/jakob-on-parental-leave_1.jpg" alt="jakob on parental leave_1" width="160" height="200" /></p>
<p>For the next few months, I will be on parental leave, so there is likely to be less blogging about technical subjects (and less blogging overall). There is simply less inspiration about virtual platforms, and a bit more about toys. </p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1054/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Off-Topic: Old and New Lego</title>
		<link>http://jakob.engbloms.se/archives/1048?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1048#comments</comments>
		<pubDate>Fri, 08 Jan 2010 18:09:08 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[gadgets]]></category>
		<category><![CDATA[general history]]></category>
		<category><![CDATA[history]]></category>
		<category><![CDATA[off-topic]]></category>
		<category><![CDATA[lego]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1048</guid>
		<description><![CDATA[During the Christmas holidays, I got the chance to compare my oldest child&#8217;s brand new Lego set with some from the mid-1980s. It is quite striking how much larger the things in the sets have become, and how much more affordable (in relative terms) Lego has become since then.
In the picture below, we have the [...]]]></description>
			<content:encoded><![CDATA[<p>During the Christmas holidays, I got the chance to compare my oldest child&#8217;s brand new Lego set with some from the mid-1980s. It is quite striking how much larger the things in the sets have become, and how much more affordable (in relative terms) Lego has become since then.</p>
<p><span id="more-1048"></span>In the picture below, we have the <a href="http://www.brickset.com/detail/?Set=6073-1">&#8220;Knight&#8217;s Castle&#8221; kit from 1984 (set #6073)</a>. I remember this as being a major kit at the time, one of the dream things to buy, and one of the biggest ones around. Compare it to the new <a href="http://www.brickset.com/detail/?Set=7743-1">Police Command Center (set #7743)</a> from 2008. The small police station accompanying the large trailer is as high as the old castle, and the trailer as long as the castle is wide. It has about 25% more pieces that the old castle.</p>
<p><img class="aligncenter size-full wp-image-1050" title="20091225_Gammalt och nytt lego_01_1" src="http://jakob.engbloms.se/wp-content/uploads/2010/01/20091225_Gammalt-och-nytt-lego_01_1.jpg" alt="20091225_Gammalt och nytt lego_01_1" width="600" height="413" /></p>
<p>Also, note the old small vehicles in the front. Four Lego notches wide, unlike the six-wide police trailer. I remember the <a href="http://www.brickset.com/detail/?Set=6653-1">highway truck </a>as being one of the magical models of my childhood.</p>
<p>To me, the most interesting aspect of comparing Lego sets is that it is a very good illustration of the economic growth that we have seen over the past 30 years. In relative terms, Lego sets have become far more affordable. Average income has certainly increased faster than the price of Lego, and my kids have quite a few more pieces to play with than I did at the same age. The nice thing with comparing Lego buying power with my childhood is that it is a product that is mostly &#8220;the same&#8221;, unlike comparisons involving electronics&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1048/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google is some kind of Glasses</title>
		<link>http://jakob.engbloms.se/archives/1045?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1045#comments</comments>
		<pubDate>Wed, 30 Dec 2009 20:21:14 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[funny]]></category>
		<category><![CDATA[goggles]]></category>
		<category><![CDATA[Google]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1045</guid>
		<description><![CDATA[We bought some ski goggles for our kids&#8230; and look who have infiltrated that business:

]]></description>
			<content:encoded><![CDATA[<p>We bought some ski goggles for our kids&#8230; and look who have infiltrated that business:</p>
<p><img class="aligncenter size-full wp-image-1046" title="junior google" src="http://jakob.engbloms.se/wp-content/uploads/2009/12/junior-google.jpg" alt="junior google" width="600" height="272" /></p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1045/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CoWare SystemC Checkpointing</title>
		<link>http://jakob.engbloms.se/archives/1039?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1039#comments</comments>
		<pubDate>Tue, 29 Dec 2009 12:02:24 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[Checkpointing]]></category>
		<category><![CDATA[CoWare]]></category>
		<category><![CDATA[Mambo]]></category>
		<category><![CDATA[Reiner Leupers]]></category>
		<category><![CDATA[Simics]]></category>
		<category><![CDATA[SimOS]]></category>
		<category><![CDATA[Stefan Kraemer]]></category>
		<category><![CDATA[SystemC]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1039</guid>
		<description><![CDATA[Continuing on my series of posts about checkpointing in virtual platforms (see previous posts Simics, Cadence, our FDL paper), I have finally found a decent description of how CoWare does things for SystemC. It is pretty much the same approach as that taken by Cadence, in that it uses full stores a complete process state [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-735" style="margin: 5px 10px;" title="gears" src="http://jakob.engbloms.se/wp-content/uploads/2009/04/gears.png" alt="gears" width="56" height="57" />Continuing on my series of posts about checkpointing in virtual platforms (see previous posts <a href="http://jakob.engbloms.se/archives/714">Simics</a>, <a href="http://jakob.engbloms.se/archives/817">Cadence</a>, our <a href="http://jakob.engbloms.se/archives/880">FDL paper</a>), I have finally found a decent description of how <a href="http://www.coware.com">CoWare </a>does things for <a href="http://www.systemc.org">SystemC</a>. It is pretty much the same approach as that taken by Cadence, in that it uses full stores a complete process state to disk, and uses special callbacks to handle the connection to open files and similar local resources on a system. The approach is described in a paper called  &#8220;A Checkpoint/Restore Framework for SystemC-Based Virtual Platforms&#8221;, by Stefan Kraemer and Reiner Leupers of RWTH Aachen, and Dietmar Petras, and Thomas Philipp of CoWare, published at the <a href="http://soc.cs.tut.fi/2009/">International Symposium on System-on-Chip, in Tampere, Finland, in October of 2009.</a></p>
<p><span id="more-1039"></span></p>
<p>The approach taken for their checkpointing system is to save the entire state of  the running simulation program (i.e., an entire host operating system process), and later recreate the process in the same state. This gets around the need program all simulation models to explicitly support checkpointing, but it also limits the applicability of checkpointing severely. Of the <a href="http://jakob.engbloms.se/archives/714">checkpointing operations described in my previous post</a>, it only supports the bringing up of a checkpoint into the same model, on the same machine (or a machine that runs a completely identical software stack down to the exact versions of all libraries, drivers, etc., which is not very likely to happen). This is honestly admitted in the paper, I appreciate that.</p>
<p>Process-based checkpointing in this way is also used by Cadence, and just like Cadence&#8217;s solution, the problem that appears when implementing it in practice is how to handle all the OS resources opened by a process. The process itself is not enough. The resources are typically files open for input and output, connections to debuggers, and other things that reach out of the virtual world of the simulation into the real world of the host machine. The solution is just like Cadence&#8217;s solution: provide callbacks for the SystemC side of such connections that can save the state of the connection in some way, and restart the connection when a checkpoint is opened. Doing this right does require some care in what to do in which order, and the paper nicely explains this.</p>
<p>For example, you need to close down all connections before taking a checkpoint, and then restore them after taking it. This is a fairly destructive operation, compared to the Simics-style checkpointing where all you do is interrogate the state of all objects and save that. I had not thought of that before, but it makes perfect sense.</p>
<p>To me, this also points to an important architectural issue in SystemC simulations in general: what are these simulation modules doing opening files on their own anyway? In my opinion, a simulation model should never do such low-level thing, it should operate using only the defined simulation system API and simulation-level connections to other simulation modules. If you need to load test data, do that by putting it into some storage system managed by the simulator itself. In all my professional life, I have considered file I/O to be a fundamental service provided by the application framework I use, nothing that my actual payload code should have to deal with. For example, in Simics, we tend to solve the loading and checkpointing of test data vectors using a memory &#8220;image&#8221;, which supports checkpointing in itself. Then a script just loads a file into the memory image, and a device reads the memory and moves transactions into the simulated system. This means that file I/O is totally absent from the model, and also that the test data can be managed and inspected by existing infrastructure.</p>
<p>The cost of taking a checkpoint is quantified in the paper, and it is not as bad as one could fear. The size of  a checkpoint easily reaches 100s of MB for even small target systems, but saving and loading that today does not take all that long. Still, going to a system with only 16 target processors (8 ARM, 8 DSP, and 8 times 64 MB of target memory = 512 MB) generates a checkpoint taking 1.7 GB to store and 30 seconds to save.</p>
<p>Once again, it is interesting to compare this to the Simics-style approach, where only differences are saved for target memories, and only target memory that is in use needs to be saved at all. This makes for usually far more compact checkpoints, which save and open in a few seconds in most cases. A checkpoint taking 30 seconds to open in Simics is rare indeed, and basically requires a target containing many gigabytes of target memory that is all in use (not host memory).</p>
<p>The paper does raise a novel point for why checkpointing is good: it saves you the time to setup a debugger. It is certainly true that setting up a debug environment for a session does take time, but it is not made clear just how it is recreated. My impression is that really what is going on here is that the debugger remains alive and loaded, and the simulation goes back and forth in time using checkpoints. Which is perfectly valid and nice.</p>
<p>In Simics, we solve this problem in two ways: when it comes to setting up the internal debugger when opening a checkpoint, the solution is to use a script to configure it. On purpose and by design, Simics checkpoints do not store the simulation session state, only the target system state, as that is the only way to be portable over time and across widely different machines. it would be very strange to open a checkpoint a few years after it was created, by some random user, start a simulation, and have it stop just because there was some breakpoint still in place for some long-forgotten reason. In any case, the simulator-side of the debugger has to be adopted in all systems to accept checkpointing.</p>
<p>Another strange point in the paper that I would have liked to ask the authors about is the idea that you can always change the target software in the middle of a session. But what is the value of checkpointing then? Since the idea is saving the cost of booting a machine and setting up a debug session, it is hard to see what is gained by booting a machine, keeping the hardware state, but replacing the software state. The expensive operation is presumably setting up the software state? At least it is in my experience.</p>
<p>I commend the paper for actually running something more than the archetypal &#8220;ARM+DSP&#8221;, by running eight copies of an ARM+DSP subsystem. That is at least starting to look like something interesting to simulate.</p>
<h2>Reviewer Notes for the Paper</h2>
<p>Finally, I have some small critiques on the academic paper itself, of the kind that I tend to provide to paper authors when active as a reviewer for conferences.</p>
<p>The SoC conference paper itself is well-written, but I have point out that the authors for some reason ignore the history of checkpointing in full-system simulation. The seminal work here was the checkpointing system used for changing the level of abstraction from fast functional simulation to cycle-accurate simulation in the SimOS system developed at Stanford <a href="ftp://db.stanford.edu/pub/cstr/reports/csl/tr/94/631/CSL-TR-94-631.pdf">already in the early 1990s</a>. This has later been continued in both IBM Mambo and Virtutech Simics, and remains the most powerful way of doing checkpointing until this day. I don&#8217;t think the authors were completely ignorant of this work, even though finding good references can be a bit difficult. Even so, here are some to add to future versions of that paper:</p>
<ul>
<li><a href="http://portal.acm.org/citation.cfm?id=891451">SimOS: A Fast Operating System Simulation Environment</a>, Stanford CS Technical Report CSL-TR-94-631, 1994. The earliest mention of using checkpointing in a full-system simulator (for switching from fast to detailed simulation).</li>
<li>&#8220;<a href="http://portal.acm.org/citation.cfm?id=1014602">Design and validation of a performance and power simulator for PowerPC systems</a>&#8220;, from the IBM Journal of Research and Development in 2003. Mentions that IBM Mambo does checkpointing like SimOS.</li>
<li><a href="http://parsa.epfl.ch/simflex/publ/per2004.pdf">SIMFLEX: A Fast, Accurate, Flexible Full-System Simulation Framework for Performance Evaluation of Server Architecture</a>, ACM SIGMETRICS Performance Evaluation Review, 2004. Also see the <a href="http://parsa.epfl.ch/simflex/">Simflex </a>homepage. Shows an ambitious use of checkpointing in computer architecture simulations.</li>
</ul>
<p>It is also a bit disingenuous to dismiss the issue of just how the process checkpointing is performed by a reference to an early requirements paper from the <a href="https://ftg.lbl.gov/CheckpointRestart/CheckpointRestart.shtml">BLCR project</a>.  All that says is that there are lots of possible variants of implementation, nothing on what was done in this particular instance. It would have been nice to have had some more details: does the approach use a kernel module or not?</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1039/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The System, Not the Parts</title>
		<link>http://jakob.engbloms.se/archives/1035?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1035#comments</comments>
		<pubDate>Sat, 19 Dec 2009 19:38:22 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[ESL]]></category>
		<category><![CDATA[business issues]]></category>
		<category><![CDATA[virtual platforms]]></category>
		<category><![CDATA[Peter Day]]></category>
		<category><![CDATA[podcast commentary]]></category>
		<category><![CDATA[Russel Ackoff]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1035</guid>
		<description><![CDATA[I just listened to the November 16, 2009, issue of the BBC podcast called &#8220;Peter Day&#8217;s World of Business&#8220;. It is a rerun (in memoriam) of an interview with business professor Russell Ackoff, which was originally published in 2007.

The main theme of the interview is the need to shift business thinking from small details to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2009/12/300x300.jpg"><img class="alignleft size-full wp-image-1036" style="margin: 10px;" title="Peter days world of business" src="http://jakob.engbloms.se/wp-content/uploads/2009/12/300x300.jpg" alt="Peter days world of business" width="100" height="100" /></a>I just listened to the November 16, 2009, issue of the BBC podcast called &#8220;<a href="http://www.bbc.co.uk/podcasts/series/worldbiz/">Peter Day&#8217;s World of Business</a>&#8220;. It is a rerun (in memoriam) of an interview with business professor Russell Ackoff, which was <a href="http://news.bbc.co.uk/2/hi/business/6338527.stm ">originally published in 2007</a>.</p>
<p><span id="more-1035"></span></p>
<p>The main theme of the interview is the need to shift business thinking from small details to entire systems. From operations research where you spend lots of time understanding some process or department in great detail, to a system-level thinking where you focus on what an entire enterprise is doing.</p>
<p>For me, this struck a chord in my system-level heart&#8230; in my world of computer systems and virtual platforms, system-level is what it is so hard to get engineers to. Far too much time is spent (in my opinion) understanding, modeling, and tweaking subsystems. Far too little effort is spent on understanding the whole, how things fit together in practice, taking software, hardware, and software system evolution over time into account. The analogy is not perfect, but there are more things that are alike than are not.</p>
<p>The most interesting analysis that Russell Ackoff fires off from his perspective is that of comparing companies and architecture. An architect knows the whole of a building, but does not entirely go into details on just how it is to be built. He/she trusts the carpenters, bricklayers, and other workers to know how best to solve their local problems. Basically, applying hierarchical abstraction to the task of constructing an actual building.</p>
<p>This got me thinking some of why this is the case. I think it could be because building things (castles, cathedrals, houses, walls, pyramids, canals, &#8230;) must have been among the most complex tasks undertaken for a very long time in human history. Thanks to this long history, we have perfected the abstraction and division of labor in construction. Buildings are built in a certain way, by a certain set of crafts, since that method has been proven to work well for a very long time. So just like in the case of the design patterns craze in the late 1990&#8217;s, architecture might have something to teach us about how to build hardware/software systems too.</p>
<p>Note that for some reason, I cannot find a link to the podcast on the BBC homepage. But if you subscribe in iTunes or similar, I think you will find it. Something is not as user-friendly as it could be.</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1035/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SAAB no more</title>
		<link>http://jakob.engbloms.se/archives/1032?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1032#comments</comments>
		<pubDate>Sat, 19 Dec 2009 19:15:44 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[off-topic]]></category>
		<category><![CDATA[cars]]></category>
		<category><![CDATA[GM]]></category>
		<category><![CDATA[SAAB]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1032</guid>
		<description><![CDATA[It is the end of the road for SAAB. As a Swede, it feels sad (and a bit scary) to see a part of our industrial heritage go down and end. It lasted a bit more than 60 years, but now the  manufacturing of cars called SAAB has ended for good. But to be quite [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2009/12/saab.png"><img class="alignleft size-full wp-image-1031" style="margin: 5px;" title="saab" src="http://jakob.engbloms.se/wp-content/uploads/2009/12/saab.png" alt="saab" width="136" height="29" /></a>It is the end of the road for SAAB. As a Swede, it feels sad (and a bit scary) to see a part of our industrial heritage go down and end. It lasted a bit more than 60 years, but now the  manufacturing of cars called SAAB has ended for good. But to be quite honest, it is hard to see how things could have gone differently. The closing of SAAB cars must have been considered inevitable for the past ten years or more. There will be lots of finger-pointing in the coming weeks, with the opposition parties trying to smear this on the government. However, I don&#8217;t see what the government could have done other than possibly postpone the inevitable.</p>
<p><span id="more-1032"></span>If you look at the facts, SAAB has very rarely made a profit. Apparently, the 1980&#8217;s were decent, but since GM took over in 1990, maybe there have been two profitable years. With that kind of history, it is hard to motivate why they should have been allowed to continue for this long in a market economy.</p>
<p>That said, the reason that SAAB is closing now is squarely and simply GM. General Motors has to be one of the worst-run companies in the business, and they have badly mauled and mistreated all their car brands except maybe Opel. SAAB was bought as European luxury brand for GM, which could have worked very well. If only the company had been given solid funding and a strategic direction, it could well have grown into a Lexus-Toyota pairing with Opel. Now, SAAB was never given the room to innovate and develop new products, instead it turned a steady draining loss each year. GM managed to do the worst possible: it didn&#8217;t invest in the brand to give it a fighting chance, but it also kept it going as a loss-making unit for almost twenty years. Overall, this long slow decline must have cost more money than a solid up-front investment back in 1990&#8230;</p>
<p>I guess in five years time, we will be seeing the real analysis of what happened, and this might be taught in business schools as a classic example of how not to manage car companies &#8212; or any brand, for that matter.</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1032/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Power Architecture Rip Van Winkle</title>
		<link>http://jakob.engbloms.se/archives/1026?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1026#comments</comments>
		<pubDate>Sun, 06 Dec 2009 20:07:23 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[computer architecture]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[IBM]]></category>
		<category><![CDATA[power architecture]]></category>
		<category><![CDATA[Rip van Winkle]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1026</guid>
		<description><![CDATA[For some reason (I guess it is the job&#8230;) I was browsing through the Power ISA version 2.06 specification last week and hit the following gem of an instruction: &#8220;rvwinkle&#8220;. It is named after a short story I had never heard about, but which apparently is sufficiently well-known in the US literary canon to warrant [...]]]></description>
			<content:encoded><![CDATA[<p>For some reason (I guess it is the job&#8230;) I was browsing through the <a href="http://www.power.org/resources/downloads/PowerISA_V2.06_PUBLIC.pdf">Power ISA version 2.06 specification </a>last week and hit the following gem of an instruction: &#8220;<tt>rvwinkle</tt>&#8220;. It is named after a <a href="http://en.wikipedia.org/wiki/Rip_Van_Winkle">short story I had never heard about</a>, but which apparently is sufficiently well-known in the US literary canon to warrant a sleep mode being named after it.<br />
<span id="more-1026"></span></p>
<p>Anyway, here is a screenshot of the manual:</p>
<p><img class="aligncenter size-full wp-image-1027" title="ripvanwinkle ppc mode" src="http://jakob.engbloms.se/wp-content/uploads/2009/12/ripvanwinkle-ppc-mode.png" alt="ripvanwinkle ppc mode" width="568" height="848" /></p>
<p>It is one of four thread-sleep-state control instructions in the 64-bit server variant of the Power ISA. Essentially, it is an IBM extension for their POWER series machines, as well as the Cell and Xenon CPUs I guess. See the <a href="http://www.power.org/devcon/07/Session_Downloads/PADC07_Frey_PowerISA.pdf">Power ISA tutorial from the Power Architecture Developer&#8217;s Conference 2007</a> for some more on this.</p>
<p>I like this kind of whimsicalness in technical systems. It makes them human and more approachable. Sometimes, big companies (and small companies) once they are mature end up trying a bit too hard to sound business-wise and &#8220;professional&#8221;&#8230; ending up being plain boring and stone-faced and cold. There is no contraction between a chuckle and a professional system for most people.</p>
<p>Some people would put the Power Architecture &#8220;eieio&#8221; instruction in the same category of slightly funny. However, the limit for all assembly languages I have ever encountered seems to be the natural name for an instruction to Sign EXtend something. It is never called what it &#8220;should&#8221; be.</p>
<p>Note that this instruction is not new, it has been around since 2005 at least, probably longer. There are no history notes in the manual, and I have no intention of reading through lots of old manuals to find the first when this one did <em><span style="text-decoration: underline;">not </span></em>appear.</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1026/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MCC 2009 Presentations Online</title>
		<link>http://jakob.engbloms.se/archives/1023?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1023#comments</comments>
		<pubDate>Thu, 03 Dec 2009 08:29:35 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[appearances]]></category>
		<category><![CDATA[computer architecture]]></category>
		<category><![CDATA[conferences]]></category>
		<category><![CDATA[embedded software]]></category>
		<category><![CDATA[multicore debug]]></category>
		<category><![CDATA[multicore software]]></category>
		<category><![CDATA[Andras Vajda]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[Ericsson]]></category>
		<category><![CDATA[heterogeneous]]></category>
		<category><![CDATA[homogeneous]]></category>
		<category><![CDATA[keynote]]></category>
		<category><![CDATA[LTE]]></category>
		<category><![CDATA[MCC]]></category>
		<category><![CDATA[UpMarc]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1023</guid>
		<description><![CDATA[The presentations from the 2009 Swedish Workshop on Multicore Computing (MCC 2009) are now online at the program page for the workshop. Let me add some comments on the workshop per se.
This was the first multicore event that I have been to where we did not have a keynote speaker or technical paper from a [...]]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-1016" style="margin-top: 5px; margin-bottom: 5px;" title="UPMARC_700x150" src="http://jakob.engbloms.se/wp-content/uploads/2009/11/UPMARC_700x150.gif" alt="UPMARC_700x150" width="122" height="45" />The presentations from the 2009 Swedish Workshop on Multicore Computing (MCC 2009) are now online at the <a href="http://www.it.uu.se/research/upmarc/MCC09/prog">program page for the workshop</a>. Let me add some comments on the workshop per se.</p>
<p><span id="more-1023"></span>This was the first multicore event that I have been to where we did not have a keynote speaker or technical paper from a hardware company. So there was really nothing here directly about how to build multicore chips. Rather, the workshop tended to be about how to program, use, measure performance on, verify software for, and generally work with multicore chips. From the perspective of software people, rather than hardware designers.</p>
<p>Obviously, hardware aspects enter into such talks, but it is the perspective of a user, not a designer. For example, a hardware designer could explain how an atomic compare-and-swap is optimized in a multicore device. But here, we saw measurements on the actual operation latencies observed on real machines using such operations. Quite refreshing, and closer to my personal interests.</p>
<p>The keynote by <a href="http://a-vajda.eu/blog/">Andras Vajda</a> of Ericsson was quite interesting. The slides are not online, but the main points that I picked up and that I might not have considered before:</p>
<ul>
<li>Software development costs can mean that the cheapest, fastest, most efficient hardware is not necessarily the most economic. Too hard to code for means the software development time and effort removes the advantage. Obvious, but worth reiterating. Software is king.</li>
<li>The workload on a cellular basestation can sometimes be highly linear and single-threaded. For example, serving a single terminal with a very high bandwidth LTE connection. And suddenly shift to a massively parallel workload as a crowd of a thousand all suddenly appear and start doing data downloads. And then go back to serial again. This means that the age-old argument that signal processing naturally &#8220;<a href="http://www.edn.com/blog/980000298/post/50023005.html">conveniently concurrent</a>&#8221; (<a href="http://www.scdsource.com/article.php?id=87">and here</a>) is not always true. Nice point!</li>
<li>Thus, we need adaptable architectures that can trade serial and parallel performance over time, and rebalance quite quickly. In the same chip.</li>
<li>He is a firm believer that homogeneous systems will win out in the end, I still hold on to a belief in accelerators and offload engines and DSPs. This is partially because of an admitted focus on servers and services processors, and not on the baseband and signalling side. Makes sense.</li>
<li>Domain-specific languages (DSL) are the future of efficient programming. Agree.</li>
</ul>
<p>On the topic of DSLs, there was a question about the cost to support them. To me, that is a non-issue. In the organizations that I have worked, it seems that maintaining a useful DSL requires at most one engineer. Developing one, a few good computer scientists for a fairly limited time. In any case, they tend to appear organically when good programmers <a href="http://jakob.engbloms.se/archives/747">generalize repeated tasks</a>.</p>
<p>I gave a keynote about how multicore has impacted virtual platforms (in particular, <a href="http://www.virtutech.com/products/simics">Virtutech Simics</a>) with the following main points:</p>
<ul>
<li>Multicore targets increase the performance pressure on a virtual platform, as more processors will have to be simulated.</li>
<li>Multicore hosts means that sequential performance of the host is going down compared to the aggregate parallel performance demands from the targets.</li>
<li>To handle large target systems, the virtual platform itself has to run multithreaded on a multicore host. Getting this in place is a major, interesting, and sometimes painful process.</li>
<li>Once you have a parallel virtual platform, multicore hosts provide a very nice boost in scalability and the manageable system sizes. A single multithreaded virtual platform process is also a bit easier to manage from a user perspective.</li>
<li>All features in the virtual platform have to be multicore and multimachine-aware&#8230; meaning that they often get a bit harder to use initially, as there is no &#8220;default processor&#8221; you can fall back to for debugging setups etc. Everything has to be explicitly targeted.</li>
<li>Multicore targets have proven to  be a great sales driver for virtual platforms, as debugging software on a physical multicore, multichip, multiboard system is just too painful.</li>
</ul>
<p>Overall, this was a fun event, looking forward to next year at Chalmers!</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1023/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The Dream ESL Language</title>
		<link>http://jakob.engbloms.se/archives/1008?&amp;owa_from=feed&amp;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/1008#comments</comments>
		<pubDate>Fri, 27 Nov 2009 19:51:27 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[EDA]]></category>
		<category><![CDATA[computer simulation technology]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[virtual platforms]]></category>
		<category><![CDATA[FDL]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=1008</guid>
		<description><![CDATA[ This post is a belated comment on the FDL 2009 conference that I attended some months ago. I have had some things in mind for a while, but some recent podcast listening has brought the issues to front again. What has been striking is the extent to which FDL was about languages only to [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jakob.engbloms.se/wp-content/uploads/2009/08/fdllogosmall.jpg"><img class="alignleft size-full wp-image-881" style="margin: 5px 10px;" title="fdllogosmall" src="http://jakob.engbloms.se/wp-content/uploads/2009/08/fdllogosmall.jpg" alt="fdllogosmall" width="80" height="79" /></a> This post is a belated comment on the FDL 2009 conference that I attended some months ago. I have had some things in mind for a while, but some recent podcast listening has brought the issues to front again. What has been striking is the extent to which FDL was about <em>languages </em>only to a very small degree. Compared to programming-language conferences like PLDI, there was precious little innovation going on in input languages, and very little concern for the <em>programming </em>aspects of virtual platform design and hardware modeling.</p>
<p><span id="more-1008"></span>Walking to and from the conference from my hotel, I listened through a <a href="http://www.twit.tv/floss79">FLOSS Weekly interview </a>with David Heinemeier Hanson, the creator of Ruby on Rails. His approach to programming and languages was quite unlike that exposed at FDL. In his world, anything that is repeated in code should be put into the language or library. In Ruby, that is easier than in many other cases, as the language can be extended arbitrarily without recompiling the VM. His focus on programmer productivity and convenience is in stark contrast to the FDL discussions which mostly dealt with how to simulate things in a single language, SystemC. Quite boring from a programming language perspective.</p>
<p>Another podcast that triggered thoughts on programming and how to improve it using languages was <a href="http://itc.conversationsnetwork.org/shows/detail4291.html">Stackoverflow Episode 73. </a>In the listener questions section, the topic of language evolution came up. Joel and Jeff pointed out that C# is a glowing example of a language that quickly evolves and adds useful features, including things from the field of dynamic languages. Quite interesting. They made the crucial point that backwards compatibility in a language is not really needed, as long as you can link code compiled from the old and the new languages together. So, if C# 3.0 won&#8217;t compile all C# 2.0 code, it is no big deal, as you can still have the old C# 2.0 compiler around, and then link with the new C# 3.0 code.</p>
<p>The key is linkability between modules, not the standard of the input language. Here, Microsoft&#8217;s .net system is starting to make a very impressive showing, I think. C#, VB, F#, Python, Ruby &#8212; a ton of languages all share the same common language runtime and the basic libraries of .net. After hearing a talk by Tim Harris of Microsoft UK at <a href="http://www.it.uu.se/research/upmarc/MCC09/prog">MCC 2009</a>, I am even more impressed by what .net can do.</p>
<p>.net was also the topic of the <a href="http://www.twit.tv/floss82">FLOSS Weekly interview with the team behind IronPython</a>. IronPython is Python on top of the .net framework, and the interview went into a lot of interesting details on how that has played out. The short answer is: very impressive, very smart, and very much the way things should be.</p>
<p>Note that even if the perspective is that &#8220;ESL languages describe a single hardware chip configuration, which is fixed&#8221;, having a language which is more dynamic still helps.Remember that modeling is programming, and anything that makes programming more efficient is a good. All you need to do is to have a &#8220;freeze&#8221; operation that says that &#8220;this particular set of things is my design&#8221;. But you might get there by interactively adding and removing things at a command-line interface.</p>
<p>Working in OSCI CCI WG, I have come to realize just how useful reflection in languages like Python is (or as we implement it in Simics). When all you have is a static C++ compiled binary, you cannot easily do things like ask objects for their type and other metadata like documentation. Since it just is not there. While in Python, you can do such inspection, and also extend things at run-time, which is very useful. If you want to add configuration hooks to a class, Python makes it dead easy, while C++ makes it major painful.</p>
<h2>The Dream ESL Language</h2>
<p>Overall, what that I get from all of this that a sound design for an &#8220;ESL&#8221; language, had we started today, would be:</p>
<ul>
<li>Basic semantics given by a virtual machine, not an input language.</li>
<li>Opportunities for several different input languages of potentially very different styles to be used, all compiling and linking into the same VM. That would open up for real innovation.</li>
<li>Extensive reflection and introspection features.</li>
<li>Dynamic reconfiguration during run-time, optionally frozen if the goal is to actually describe some hardware design for synthesis. But such synthesis would be from VM code, not some input language.</li>
</ul>
<p>Essentially, taking the approach of providing a stable interoperability layer between languages in the form of a VM, and allowing languages to be anything anyone could care to invent.</p>
]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/1008/feed</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>
