Re: Disabling interrupts to protect data



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.

One man's meat...

--
www.wescottdesign.com
.


Quantcast