[Tinyos-help] Atomic and interrupts question

Philip Levis pal at cs.stanford.edu
Wed Jul 12 13:10:45 PDT 2006


On Jul 12, 2006, at 12:31 PM, Conor Todd wrote:

> The documentation for TinyOS says that interrupts are DISABLED  
> within "atomic" sections of code, such that no asynchronous will  
> even occur, since asynchronous events are generated by interrupts.
>

This all depends on the hardware. "Disable interrupts" usually means  
"do not execute interrupts." However, if an interrupt goes off, the  
hardware sets a bit. If the bit is 1 when interrupts are re-enabled,  
then it clears the bit and signals the interrupt. This behavior leads  
to the basic problem of losing interrupts if they happen too fast;  
even if the interrupt occurs 5 times, there is only one bit so it  
will execute once. These timing constraints are one reason why atomic  
sections and interrupts should be short.

A basic OS textbook is a good place to refer to for a discussion of  
these issues; I'd recommend the BSD book.

Phil



More information about the Tinyos-help mailing list