next up previous contents
Next: Fault Service Routines Up: Overview Previous: The Main Thread-Initialization

Interrupt Service Routines

The programmer may register Interrupt Service Routines (ISRs) to handle hardware interrupts. These routines are not independent threads, but more like signals. Any currently executing thread is suspended by an interrupt, and the ISR called. The ISR runs on a separate interrupt stack only if the hardware supports it. Otherwise, the ISR stack frames are pushed onto the stack of the interrupted thread.

Most of the thread manipulation routines can be called within interrupt service routines. These routines move threads between ThreadQueue objects, including the run queue, and invoke the thread_switch() routine. If the ISR switches threads, the thread switch will take effect when the ISR returns. This might be useful, for example, in implementing a time-slice scheduler.

However, the ISR, although more flexible then in typical OSs, still must not block in any way. To do so would cause deadlock. This limits the synchronization tools that ISRs can use. (The ISync class is provided especially for use in ISR routines.)



Stephen Williams
9/2/1997