03.08.2013 Views

Design and Implementation of TinyGALS: A Programming Model for ...

Design and Implementation of TinyGALS: A Programming Model for ...

Design and Implementation of TinyGALS: A Programming Model for ...

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

if there is an event in the global event queue then {<br />

if any TinyGUYS have been modified<br />

end if<br />

Copy buffered values into variables.<br />

Get token corresponding to event out <strong>of</strong> input port.<br />

Pass value to the method linked to the input port.<br />

else if there is a TinyOS task then {<br />

end if<br />

Take task out <strong>of</strong> task queue.<br />

Run task.<br />

4.6 Memory Usage<br />

Figure 18: <strong>TinyGALS</strong> scheduling algorithm.<br />

Tables 1 <strong>and</strong> 2 show the sizes <strong>of</strong> the generated functions <strong>and</strong> variables <strong>for</strong> the system<br />

shown in Figure 17. Note that the system contains one port. Here, we assume that the<br />

method linked to A_out writes values <strong>of</strong> type short <strong>and</strong> returns a confirmation value <strong>of</strong><br />

type char. Additionally, the queue connected to inport B_in is <strong>of</strong> size 50 (i.e., it holds 50<br />

elements <strong>of</strong> type short). Thus, memory usage <strong>of</strong> a <strong>TinyGALS</strong> application is determined<br />

mainly by the user-specified queue sizes <strong>and</strong> total number <strong>of</strong> ports in the system. The Tiny-<br />

GALS communication framework is very lightweight, since event queues are generated as<br />

application-specific data structures.<br />

Table 3 compares the sizes <strong>of</strong> the <strong>TinyGALS</strong> <strong>and</strong> original TinyOS portions <strong>of</strong> the sched-<br />

uler. The code size <strong>of</strong> the <strong>TinyGALS</strong> scheduler is only 114 bytes. For backwards compat-<br />

ibility with TinyOS tasks, we include the original 86 byte TinyOS scheduler. If TinyOS<br />

tasks are not used, the scheduler is about the same size as be<strong>for</strong>e. Refer to Section 6.1 on<br />

why TinyOS tasks are made obsolete by the <strong>TinyGALS</strong> model.<br />

12 The queue holds 50 elements <strong>of</strong> type short.<br />

36

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!