Presentation is loading. Please wait.

Presentation is loading. Please wait.

Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh

Similar presentations


Presentation on theme: "Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh"— Presentation transcript:

1 Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau (smyau@cs.berkeley.edu) Alan Shieh (ashieh@hkn.eecs.berkeley.edu)

2 Tiny OS Overview Small footprint system Used in small, low-power, embedded devices (e.g., temperature sensors) Event-based programming model

3 Tiny OS Primer Program consist of state machines All threads run to completion, unless preempted by hardware events Event filtering Radio Bit Radio Tran- ceiver Radio Byte Packet Object Applic- ation Active Mess- age

4 Interrupt Handling in Tiny OS Context switch during interrupts are most expensive primitive Interrupt lost is power lost

5 A Bag of tricks: Software simulated register window Lightweight Interrupt handler Optimistic (Lazy) interrrupt handler

6 Software Register Window Register windows useful for low- overhead interrupt handling Providing this support in hardware may not be cost-effective –Additional area can be used for other I/O optimizations

7 Software Register Window (implementation) Two versions of gcc –User-mode and Interrupt-mode gcc Each allowed to use approximately half of register file Calling conventions restricted Post-compilation function rename

8 Software Register Window R31 R30 R29 R28 R27 R26 R25 R24 R20-R23 R16-R19 R8-R15 R2-R7 R1 R0 Shared registers User registers Interrupt registers

9 Lightweight Interrupt Handler Software Simulated register windows means less registers to work with => more register spills Want a handler that is Lightweight –Consumes less register (reduce register spills) –Lower execution time (reduce lost interrupts)

10 Lightweight IH (implementation) The IH does not fire off an event, but rather posts a thread that does. We can vary the amount of filtering where this is done.

11 Lazy Interrupt Handler Most of the time the CPU is in sleep mode (I.e., has no thread running). In those cases, saving register is unnecessary. Set aside a register for sleep mode, and check it during interrupts.

12 Evaluation environment Simulated CPU, with Radio, LED, and Photo sensor. Benchmarks –Single processor simulation –Network simulation Measure: –Number of cycles in sleep / active mode –Energy consumption –Number of cycles with interrupts disabled –Number of lost interrupts

13 Evaluation Register window –Radio interrupt is now 113 cycles (down from 165) But improvement is unstable because asymmetry of register set increases register pressure

14 Evaluation (cont) Lightweight Handler –Reduces execution time of Timer Interrupt handler by 57%; Radio Interrupt handler by 33%. But added thread posting/scheduling overhead for event handler. –Bad for radio interrupt due to real time constrains and the overhead. –Benchmark performance…

15 Evaluation (cont) Lazy Interrupt handler –Reduces a typical radio interrupt from 165 cycles to 114 cycles –On the bench mark…


Download ppt "Tiny OS Optimistic Lightweight Interrupt Handler Simon Yau Alan Shieh"

Similar presentations


Ads by Google