<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: I hate RTOSes</title>
	<atom:link href="http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/feed/" rel="self" type="application/rss+xml" />
	<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/</link>
	<description>A Blog by Miro Samek</description>
	<lastBuildDate>Tue, 08 May 2012 09:20:07 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Is an RTOS really the best way to design embedded systems? &#171; State Space</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-7578</link>
		<dc:creator>Is an RTOS really the best way to design embedded systems? &#171; State Space</dc:creator>
		<pubDate>Tue, 07 Jun 2011 17:46:07 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-7578</guid>
		<description>[...] I consider this discussion to be a continuation of the topic from my post ( &#8220;I hate RTOSes&#8221;) [...]</description>
		<content:encoded><![CDATA[<p>[...] I consider this discussion to be a continuation of the topic from my post ( &#8220;I hate RTOSes&#8221;) [...]</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rom H.</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-606</link>
		<dc:creator>Rom H.</dc:creator>
		<pubDate>Mon, 06 Sep 2010 15:26:13 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-606</guid>
		<description>&quot;Why Threads Are A Bad Idea (for most purposes) &quot;  http://web.cecs.pdx.edu/~walpole/class/cs533/spring2006/slides/51.pdf</description>
		<content:encoded><![CDATA[<p>&#8220;Why Threads Are A Bad Idea (for most purposes) &#8221;  <a href="http://web.cecs.pdx.edu/~walpole/class/cs533/spring2006/slides/51.pdf" rel="nofollow">http://web.cecs.pdx.edu/~walpole/class/cs533/spring2006/slides/51.pdf</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Rom H.</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-595</link>
		<dc:creator>Rom H.</dc:creator>
		<pubDate>Sun, 05 Sep 2010 16:34:32 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-595</guid>
		<description>I have read the TTE(old version,Chinese translation), It&#039;s simple and stable, and easy testing . TTE views the program in the time sequence, periodically checks the event flags and handles them, and can handles  some Simple random  events. I think TTE is suitable for definitely coming events within a time range, but It&#039;s a problem for low-power sleep mode, cann&#039;t be in sleep mode with TTE. The QP can run in IOC mode and can buffer the the events, no limited for events coming time,  and QP can enter low-power sleep mode if no events coming.</description>
		<content:encoded><![CDATA[<p>I have read the TTE(old version,Chinese translation), It&#8217;s simple and stable, and easy testing . TTE views the program in the time sequence, periodically checks the event flags and handles them, and can handles  some Simple random  events. I think TTE is suitable for definitely coming events within a time range, but It&#8217;s a problem for low-power sleep mode, cann&#8217;t be in sleep mode with TTE. The QP can run in IOC mode and can buffer the the events, no limited for events coming time,  and QP can enter low-power sleep mode if no events coming.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Petr</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-101</link>
		<dc:creator>Petr</dc:creator>
		<pubDate>Sat, 08 May 2010 19:56:16 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-101</guid>
		<description>There are some theoretical results showing that threads (aka RTOS) are technically equivalent to event systems (you call state machines). This paper describes that threads are easier for humans to grasp and use.

&quot;Why Events Are A Bad Idea (for high-concurrency servers)&quot;
http://www.cs.berkeley.edu/~brewer/papers/threads-hotos-2003.pdf</description>
		<content:encoded><![CDATA[<p>There are some theoretical results showing that threads (aka RTOS) are technically equivalent to event systems (you call state machines). This paper describes that threads are easier for humans to grasp and use.</p>
<p>&#8220;Why Events Are A Bad Idea (for high-concurrency servers)&#8221;<br />
<a href="http://www.cs.berkeley.edu/~brewer/papers/threads-hotos-2003.pdf" rel="nofollow">http://www.cs.berkeley.edu/~brewer/papers/threads-hotos-2003.pdf</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ignacio G. T.</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-85</link>
		<dc:creator>Ignacio G. T.</dc:creator>
		<pubDate>Tue, 20 Apr 2010 15:52:52 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-85</guid>
		<description>Hello, Miro.

I have been using both RTOSes and state machines since the late 80s. And I&#039;m never tired of learning new things, so I read this topic with pleasure. In fact, I read your Statecharts book some years ago, and applied successfully your ideas in some products with no RTOS.

What I missed in this discussion, and perhaps belongs to a new thread, is a comparison with another contender: time-triggered architectures. I read with curiosity &quot;Patterns for time-triggered embedded systems&quot; (available here: http://www.tte-systems.com/books/pttes ) and I found it a mix of a very simple event-driven mechanism (where the event is always a time event) and a curious scheduler. I have never tried this approach, Do you consider it useful?</description>
		<content:encoded><![CDATA[<p>Hello, Miro.</p>
<p>I have been using both RTOSes and state machines since the late 80s. And I&#8217;m never tired of learning new things, so I read this topic with pleasure. In fact, I read your Statecharts book some years ago, and applied successfully your ideas in some products with no RTOS.</p>
<p>What I missed in this discussion, and perhaps belongs to a new thread, is a comparison with another contender: time-triggered architectures. I read with curiosity &#8220;Patterns for time-triggered embedded systems&#8221; (available here: <a href="http://www.tte-systems.com/books/pttes" rel="nofollow">http://www.tte-systems.com/books/pttes</a> ) and I found it a mix of a very simple event-driven mechanism (where the event is always a time event) and a curious scheduler. I have never tried this approach, Do you consider it useful?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miro Samek</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-81</link>
		<dc:creator>Miro Samek</dc:creator>
		<pubDate>Mon, 19 Apr 2010 23:50:59 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-81</guid>
		<description>Thank you everyone for great comments. I&#039;d like to address most of the issues mentioned in your comments, but obviously I cannot do it all in one post. Therefore, I&#039;d like to lay out my plan of attack, so that you know in which order I am going to build my argument:

1. In my next post I&#039;ll talk about avoiding blocking in RTOS-based applications. I&#039;ll introduce run-to-completion event-processing, the concept of an event-driven framework, and inversion of control.

2. I&#039;ll talk about challenges of programming without blocking. I&#039;ll explain what you need to sacrifice when you write non-blocking code and why this often leads to &quot;spaghetti&quot; code.

3. I&#039;ll explain how state machines can work as powerful &quot;spaghetti reducers&quot; and why state machines didn&#039;t catch on in the traditional event-driven GUI programming.  

4. In the subsequent post I&#039;ll explain the important things that an event-driven framework can easily do, but a traditional RTOS can&#039;t.

5. I&#039;ll describe the pros and cons of the most popular state machine implementation techniques in C.

6. I&#039;ll describe the main shortcomings of the traditional state machines and how modern hierarchical state machines avoid them.

7. I&#039;ll explain how modern modeling tools work and what kind of code they can generate.

8. I&#039;ll plan to explain a very simple and absolutely portable cooperative kernel for executing event-driven state machines.

9. I&#039;ll explain an ultra-light preemptive kernel that is ideal for executing state machines in run-to-completion fashion.

I count on interesting, challenging comments. Stay tuned!</description>
		<content:encoded><![CDATA[<p>Thank you everyone for great comments. I&#8217;d like to address most of the issues mentioned in your comments, but obviously I cannot do it all in one post. Therefore, I&#8217;d like to lay out my plan of attack, so that you know in which order I am going to build my argument:</p>
<p>1. In my next post I&#8217;ll talk about avoiding blocking in RTOS-based applications. I&#8217;ll introduce run-to-completion event-processing, the concept of an event-driven framework, and inversion of control.</p>
<p>2. I&#8217;ll talk about challenges of programming without blocking. I&#8217;ll explain what you need to sacrifice when you write non-blocking code and why this often leads to &#8220;spaghetti&#8221; code.</p>
<p>3. I&#8217;ll explain how state machines can work as powerful &#8220;spaghetti reducers&#8221; and why state machines didn&#8217;t catch on in the traditional event-driven GUI programming.  </p>
<p>4. In the subsequent post I&#8217;ll explain the important things that an event-driven framework can easily do, but a traditional RTOS can&#8217;t.</p>
<p>5. I&#8217;ll describe the pros and cons of the most popular state machine implementation techniques in C.</p>
<p>6. I&#8217;ll describe the main shortcomings of the traditional state machines and how modern hierarchical state machines avoid them.</p>
<p>7. I&#8217;ll explain how modern modeling tools work and what kind of code they can generate.</p>
<p>8. I&#8217;ll plan to explain a very simple and absolutely portable cooperative kernel for executing event-driven state machines.</p>
<p>9. I&#8217;ll explain an ultra-light preemptive kernel that is ideal for executing state machines in run-to-completion fashion.</p>
<p>I count on interesting, challenging comments. Stay tuned!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miro Samek</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-80</link>
		<dc:creator>Miro Samek</dc:creator>
		<pubDate>Mon, 19 Apr 2010 23:17:32 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-80</guid>
		<description>I agree that the most important reason why one should still consider using a traditional blocking RTOS is compatibility with the existing software, such as TCP/IP, USB, or CAN communication stacks that are designed for a traditional blocking kernels.

On the other hand, there is absolutely no technical reason why communication stacks would require blocking. In fact, this kind of software is very event-driven by nature. For example, the popular, open source, lightweight TCP/IP stack lwIP uses internally a strictly event-driven API, exactly to reduce its memory footprint and increase performance. lwIP can run without a traditional blocking kernel, and a port of lwIP to the QP event-driven framework works beautifully (see state-machine.com/lwip).  Porting other stacks (USB, CAN, etc.) is just a matter of time.</description>
		<content:encoded><![CDATA[<p>I agree that the most important reason why one should still consider using a traditional blocking RTOS is compatibility with the existing software, such as TCP/IP, USB, or CAN communication stacks that are designed for a traditional blocking kernels.</p>
<p>On the other hand, there is absolutely no technical reason why communication stacks would require blocking. In fact, this kind of software is very event-driven by nature. For example, the popular, open source, lightweight TCP/IP stack lwIP uses internally a strictly event-driven API, exactly to reduce its memory footprint and increase performance. lwIP can run without a traditional blocking kernel, and a port of lwIP to the QP event-driven framework works beautifully (see state-machine.com/lwip).  Porting other stacks (USB, CAN, etc.) is just a matter of time.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Miro Samek</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-79</link>
		<dc:creator>Miro Samek</dc:creator>
		<pubDate>Mon, 19 Apr 2010 23:01:24 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-79</guid>
		<description>Great comment. Thank you for pointing out that RTOS is too heavy for many low-end systems, mostly because an RTOS requires a separate *stack* (RAM) for each task. In contrast, event-driven approach can have really tiny footprint, especially in RAM, which makes it ideal for high-volume, cost-sensitive applications such as motor control, lighting control, capacitive touch sensing, remote access control, RFID, thermostats, small appliances, toys, power supplies, battery chargers, or just about any custom system on chip (SOC or ASIC) that contains a small CPU inside. Also, because the event-driven paradigm naturally uses the CPU only when handling events and otherwise can very easily switch the CPU and peripherals into a low-power sleep mode, the paradigm is particularly suitable for ultra-low power applications, such as wireless sensor networks and implantable medical devices.

So, yes tiny event-driven frameworks are a viable alternative to the venerable &quot;superloop&quot; in low-end systems. For example, the ultra-lightweight QP-nano framework with hierarchical state machines, event queues, timers, and cooperative or preemptive scheduler can run in as little as 128 bytes of RAM and a few KB of ROM (see the eZ430 example included in the QP-nano distribution available from Sourceforge.net). 

I plan to dedicate at least one post to low-end systems and scalability of the modern event-driven programming techniques based on state machines.</description>
		<content:encoded><![CDATA[<p>Great comment. Thank you for pointing out that RTOS is too heavy for many low-end systems, mostly because an RTOS requires a separate *stack* (RAM) for each task. In contrast, event-driven approach can have really tiny footprint, especially in RAM, which makes it ideal for high-volume, cost-sensitive applications such as motor control, lighting control, capacitive touch sensing, remote access control, RFID, thermostats, small appliances, toys, power supplies, battery chargers, or just about any custom system on chip (SOC or ASIC) that contains a small CPU inside. Also, because the event-driven paradigm naturally uses the CPU only when handling events and otherwise can very easily switch the CPU and peripherals into a low-power sleep mode, the paradigm is particularly suitable for ultra-low power applications, such as wireless sensor networks and implantable medical devices.</p>
<p>So, yes tiny event-driven frameworks are a viable alternative to the venerable &#8220;superloop&#8221; in low-end systems. For example, the ultra-lightweight QP-nano framework with hierarchical state machines, event queues, timers, and cooperative or preemptive scheduler can run in as little as 128 bytes of RAM and a few KB of ROM (see the eZ430 example included in the QP-nano distribution available from Sourceforge.net). </p>
<p>I plan to dedicate at least one post to low-end systems and scalability of the modern event-driven programming techniques based on state machines.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Ram</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-78</link>
		<dc:creator>Ram</dc:creator>
		<pubDate>Mon, 19 Apr 2010 06:17:48 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-78</guid>
		<description>Miro,
   You would perhaps agree that one valid reason to use RTOSs or for that matter general purpose embedded OSs, with or without QP, would be the protocol stacks (TCP/IP, USB etc) they provide.
    One suggestion for overcoming your writer&#039;s block: the article about event drive programming and deadlocks that you promised :) in  replying to my comment on the Barr Code blog entry on race conditions.</description>
		<content:encoded><![CDATA[<p>Miro,<br />
   You would perhaps agree that one valid reason to use RTOSs or for that matter general purpose embedded OSs, with or without QP, would be the protocol stacks (TCP/IP, USB etc) they provide.<br />
    One suggestion for overcoming your writer&#8217;s block: the article about event drive programming and deadlocks that you promised <img src='http://embeddedgurus.com/state-space/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  in  replying to my comment on the Barr Code blog entry on race conditions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Eduardo Viramontes</title>
		<link>http://embeddedgurus.com/state-space/2010/04/i-hate-rtoses/comment-page-1/#comment-77</link>
		<dc:creator>Eduardo Viramontes</dc:creator>
		<pubDate>Mon, 19 Apr 2010 02:37:53 +0000</pubDate>
		<guid isPermaLink="false">http://embeddedgurus.com/state-space/?p=35#comment-77</guid>
		<description>Being an 8 &amp; 16-bit developer for the last 5 years, I&#039;ve had little experience with RTOSes until recently (I&#039;ve started playing around with MQX on the Coldfire platform). In the low-end world you always find code filled with loops expecting events to happen, worst of all, there&#039;s no RTOS controlling the software flow, so the MCU does stay there. On the other hand, these devices don&#039;t run as much functions and/or code as a 32-bitter running an RTOS, so programmers usually find it&#039;s ok to keep those loops as long as the final application ends up working (barely), even if they are unable to add more functions later on. This is a similar paradigm as what you&#039;ve explained happens in RTOSes. I&#039;ve worked a lot with state-machine implementations and have a love-hate relation with them, they are great, they get the job done, and a good implementation will allow you to add more functions later on (as long as it isn&#039;t a &quot;super loop&quot; approach). The downside is that they&#039;re quite difficult to correctly implement, there are usually too many flags and/or state variables to keep track of and each implementation is unique, unless you are working at a really formal place where everybody is actually following some sort of architecture standard. Anyway, I&#039;m looking forward to your coming posts, I&#039;d really like it if you could talk about implementations of event-driven approaches in low-end MCU.</description>
		<content:encoded><![CDATA[<p>Being an 8 &amp; 16-bit developer for the last 5 years, I&#8217;ve had little experience with RTOSes until recently (I&#8217;ve started playing around with MQX on the Coldfire platform). In the low-end world you always find code filled with loops expecting events to happen, worst of all, there&#8217;s no RTOS controlling the software flow, so the MCU does stay there. On the other hand, these devices don&#8217;t run as much functions and/or code as a 32-bitter running an RTOS, so programmers usually find it&#8217;s ok to keep those loops as long as the final application ends up working (barely), even if they are unable to add more functions later on. This is a similar paradigm as what you&#8217;ve explained happens in RTOSes. I&#8217;ve worked a lot with state-machine implementations and have a love-hate relation with them, they are great, they get the job done, and a good implementation will allow you to add more functions later on (as long as it isn&#8217;t a &#8220;super loop&#8221; approach). The downside is that they&#8217;re quite difficult to correctly implement, there are usually too many flags and/or state variables to keep track of and each implementation is unique, unless you are working at a really formal place where everybody is actually following some sort of architecture standard. Anyway, I&#8217;m looking forward to your coming posts, I&#8217;d really like it if you could talk about implementations of event-driven approaches in low-end MCU.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

