Prev: ALP for Real Time Clock using timer unit of HC12
Next: How to create a code in C++ for LM3S811 in IAR Embedded Workbench
From: FreeRTOS info on 26 Oct 2009 14:41 > Some OSes claim that they never disable interrupts, however from what I > have seen it was all very impractical. I have seen this claim too - but when you look closely you find it is achieved by having the kernel itself execute with the absolute highest interrupt priority - so the effect on lower priority interrupts is exactly as if interrupts had been disabled. So while the claim is not incorrect, it is somewhat deliberately misleading. People who are that good at marketing should not be engineers. [disclaimer - I don't know this to be the case for all systems that make this claim, just the ones I know about] -- Regards, Richard. + http://www.FreeRTOS.org Designed for Microcontrollers. More than 7000 downloads per month.
From: D Yuniskis on 26 Oct 2009 15:06 Vladimir Vassilevsky wrote: > > > D Yuniskis wrote: >> KIRAN wrote: >> >>> I am working on some RTOS, in which I see lot of interrupts "enabling" >>> and "disabling" code in most of the RTOS API's to protect kernel data. > >> A common approach to providing an atomic operation. >> Some CPUs don't need this. > > Some OSes claim that they never disable interrupts, however from what I > have seen it was all very impractical. Once you have more or less > sophisticated structure of threads and interrupts, you've got to have > critical parts with the interrupts disabled. You only need to disable interrupts if an interrupt context can access those "shared objects" *without* observing whatever other "mutex" mechanism you are using. It *can* be done. But, it is a lot trickier than just a tiny little critical region. E.g., if the jiffy comes along (perhaps the most notable active element that *would* be interrupt spawned and asynchronously compete for access to those strctures), it has to notice that a critical region has been entered (by whatever it has interrupted!) and then "schedule" a defered activation. So, the jiffy terminates as expected. The interrupted routine (probably an OS action) finishes up what it was working on, then, examines a flag to see if it can "simply return" or if it has to process some deferred "activity" (i.e. those things that the jiffy *would* have done had it been fortunate enough to come along "outside" that critical region.
From: D Yuniskis on 26 Oct 2009 15:07 Tim Wescott wrote: > On Mon, 26 Oct 2009 10:34:33 -0700, D Yuniskis wrote: > >> KIRAN wrote: >> >>> I am working on some RTOS, in which I see lot of interrupts "enabling" >>> and "disabling" code in most of the RTOS API's to protect kernel data. >>> For example, Semaphore API's, Message Queue APIs, Runtime memory >>> management API's. Is enabling / disabling interrupts only to protect >>> the kernel data? Why I am asking this is whenever interrupts are >>> disabled, I am scared of losing timer interrupts. Any input is >>> appreciated? >> A common approach to providing an atomic operation. Some CPUs don't need >> this. >> >> If it is done correctly, the critical region will be very small >> (temporally). You shouldn't *lose* a timer interrupt (nor any other) as >> the hardware should latch the interrupt and you will respond to it as >> soon as the critical region passes. (a few instructions?) >> >> If the critical region is much longer than this, the OS implementation >> is sloppy. > > .... or your timer period is too short for that RTOS/processor combination. I look at it as the RTOS not having been designed "lean enough" (to keep with the meat analogy :> ) > One man's meat...
From: FreeRTOS info on 26 Oct 2009 15:08 D Yuniskis wrote: > and then "schedule" a defered activation. So, the jiffy > terminates as expected. The interrupted routine (probably > an OS action) finishes up what it was working on, then, > examines a flag to see if it can "simply return" or if it has > to process some deferred "activity" ....and how are you protecting access to the flag - or are you assuming the hardware supports atomic read-modify-writes on variables - or that the hardware supports atomic semaphore type operations? -- Regards, Richard. + http://www.FreeRTOS.org Designed for Microcontrollers. More than 7000 downloads per month.
From: D Yuniskis on 26 Oct 2009 15:19
FreeRTOS info wrote: > D Yuniskis wrote: >> and then "schedule" a defered activation. So, the jiffy >> terminates as expected. The interrupted routine (probably >> an OS action) finishes up what it was working on, then, >> examines a flag to see if it can "simply return" or if it has >> to process some deferred "activity" > > ....and how are you protecting access to the flag - or are you assuming > the hardware supports atomic read-modify-writes on variables - or that > the hardware supports atomic semaphore type operations? Assuming you don't have a second processor... ever hear of a "Test and Set" instruction? |