[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Disable interrupts in critical sections?

The book "Programming Embedded Systems in C and C++" (Michael
Barr) / O'Reilly, states that 

  A critical section is a part of a program that must be 
  executed atomically. That is, the instructions that make up
  that part must be executed in order and without interruption.
  Because an interrupt can occur at any time, the only way
  to make such a guarantee is to disable interrupts for the
  duration of the critical section. (p105-106)

He continues:
  These are the critical sections that we talked about earlier,
  and there are no alternative methods for protecting them. (p122)

He builds an operating system, and disables interrupts all the time.

I thought that operative system curriculum taught that it should
be enough to have an atomic test-and-set instruction to build on? 


|        Oyvind Teig |          oyvind.teig@xxxxxxxxxxxx |    |    |
|  Navia Maritime AS |          oyvind.teig@xxxxxxxxxxxx |    |    |
| division Autronica |                                   |Tel:|Fax:|
|               7005 |               http://www.navia.no | +47| +47|
|          Trondheim |           http://www.autronica.no |7358|7391|
|             Norway | http://www.autronica-maritime.com |1268|9320|