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

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>of</strong> interrupts <strong>and</strong> their effect on the order <strong>of</strong> events in the global event queue.<br />

2.4 TinyGUYS<br />

Module A<br />

A_out<br />

Module B<br />

B_in<br />

Module C<br />

C_in<br />

Figure 10: Single output multiple input connection.<br />

The <strong>TinyGALS</strong> programming model has the advantage that the modules become decoupled<br />

through message passing <strong>and</strong> are easier to develop independently. However, each mes-<br />

sage passed will trigger the scheduler <strong>and</strong> activate a receiving module, which may quickly<br />

become inefficient if there is global state which must be updated frequently. TinyGUYS<br />

(Guarded Yet Synchronous) is a mechanism <strong>for</strong> sharing global state, allowing quick access<br />

but with protected modification <strong>of</strong> the data.<br />

One must be very careful when implementing global data spaces in concurrent pro-<br />

grams. Many modules may access the same global variables at the same time. It is possible<br />

that while one module is reading the variables, an interrupt may occur <strong>and</strong> preempt the<br />

reading. The interrupt service routine may modify the global variables. When the module<br />

resumes reading the remaining variables after h<strong>and</strong>ling the interrupt, it may see an inconsis-<br />

tent state. In the TinyGUYS mechanism, global variables are guarded. Modules may read<br />

the global variables synchronously (i.e., without delay). However, writes to the variable<br />

are asynchronous in the sense that all writes are delayed. A write to a TinyGUYS global<br />

variable is actually a write to a copy <strong>of</strong> the global variable. One can think <strong>of</strong> this as a write<br />

buffer <strong>of</strong> size one. Because there is only one buffer per global variable, the last module to<br />

write to the variable “wins”, i.e., the last value written will be the new value <strong>of</strong> the global<br />

21

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

Saved successfully!

Ooh no, something went wrong!