<?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: RTOS Myth #3: Mutexes are Needed at the Task Level</title>
	<atom:link href="http://embeddedgurus.com/barr-code/2008/03/rtos-myth-3-mutexes-are-needed-at-the-task-level/feed/" rel="self" type="application/rss+xml" />
	<link>http://embeddedgurus.com/barr-code/2008/03/rtos-myth-3-mutexes-are-needed-at-the-task-level/</link>
	<description>A Blog by Michael Barr</description>
	<lastBuildDate>Fri, 18 May 2012 17:16:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
	<item>
		<title>By: Dan</title>
		<link>http://embeddedgurus.com/barr-code/2008/03/rtos-myth-3-mutexes-are-needed-at-the-task-level/comment-page-1/#comment-33</link>
		<dc:creator>Dan</dc:creator>
		<pubDate>Fri, 14 Mar 2008 21:35:00 +0000</pubDate>
		<guid isPermaLink="false">http://www.gfcdev.org/test-stack/2008/03/12/rtos-myth-3-mutexes-are-needed-at-the-task-level/#comment-33</guid>
		<description>Nice article... the last paragraph really resonated with me:&lt;i&gt;Note that mutexes are also necessary inside functions that control hardware through I/O registers, which are effectively global data structures.&lt;/i&gt;Just got done debugging a client&#039;s project/product that we took over after client was left high &amp; dry by another firm.  One problem they were having was intermittent interrupt problems.Turns out the interrupt enable register was originally being accessed by a single task which handled the ethernet interface (and the only interrupt that was enabled/configured once the kernel was running.)Later a 2nd task was added to handle a serial interface, and under the right conditions, the tasks were clobbering each others&#039; attempts to modify the IER.In other words, one task was just doing:  IER &#124;= foo1;and the other:  IER &#124;= foo2;and it&#039;s funny, the same comment above each one, something to the effect of:   // Fold in foo bit to enable interrupt;   // NOTE: use logical OR, not assignment, to make sure we don&#039;t alter the other bits in the IERWell, yes, use BITWISE OR, but on top of that.... protect the shared data [hardware register]!!!I&#039;m not perfect, we&#039;ve all made mistakes, but this just struck me as someone who develops in the kiddie pool, as opposed to having a deep understanding of the architecture of the whole system, how multi-tasking &amp; pre-emption work, etc...There were a host of other problems as well, probably not too surprising based on this example...Guess I should be happy, things like this keep me employed.It&#039;s funny, I&#039;ve been doing this for over 15 years, and I realize how much I learned in my first job by working with an outstanding engineering team (educated as EE, but was doing firmware/kernel/driver development since day 1 of employment.)</description>
		<content:encoded><![CDATA[<p>Nice article&#8230; the last paragraph really resonated with me:<i>Note that mutexes are also necessary inside functions that control hardware through I/O registers, which are effectively global data structures.</i>Just got done debugging a client&#8217;s project/product that we took over after client was left high &amp; dry by another firm.  One problem they were having was intermittent interrupt problems.Turns out the interrupt enable register was originally being accessed by a single task which handled the ethernet interface (and the only interrupt that was enabled/configured once the kernel was running.)Later a 2nd task was added to handle a serial interface, and under the right conditions, the tasks were clobbering each others&#8217; attempts to modify the IER.In other words, one task was just doing:  IER |= foo1;and the other:  IER |= foo2;and it&#8217;s funny, the same comment above each one, something to the effect of:   // Fold in foo bit to enable interrupt;   // NOTE: use logical OR, not assignment, to make sure we don&#8217;t alter the other bits in the IERWell, yes, use BITWISE OR, but on top of that&#8230;. protect the shared data [hardware register]!!!I&#8217;m not perfect, we&#8217;ve all made mistakes, but this just struck me as someone who develops in the kiddie pool, as opposed to having a deep understanding of the architecture of the whole system, how multi-tasking &amp; pre-emption work, etc&#8230;There were a host of other problems as well, probably not too surprising based on this example&#8230;Guess I should be happy, things like this keep me employed.It&#8217;s funny, I&#8217;ve been doing this for over 15 years, and I realize how much I learned in my first job by working with an outstanding engineering team (educated as EE, but was doing firmware/kernel/driver development since day 1 of employment.)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

