Abstract
Major motes operating systems like TinyOS or Contiki [1, 2] rely on an event-driven programming paradigm. While the use of events allows for limiting memory usage on resource-constrained motes, it may also hamper the development and debugging of applications, especially as their complexity increases [3]. Several authors also investigated the possibility of introducing threads to mote programming [4–6]. However, the proposed solutions all induce runtime overhead which is inherent to the thread paradigm. In contrast, protothreads[3] combine the benefits of both paradigms by providing thread semantics to the programmer while using events at runtime. This is achieved by an automatic code generation step performed by the C preprocessor. However, while using the C preprocessor guarantees portability across C compilers, it also introduces some limitations. For instance, certain C language constructs such as switch statements may not be used and values of local variables are not retained across context switches [3]. Furthermore, thread functions are not reentrant, blocking calls may only occur in the top-level thread functions, and debugging is performed in the generated code. To overcome these limitations, we propose to extend the protothreads abstraction by providing cooperative threads with blocking I/O, reentrant functions, and arbitrary nesting of function calls. This is achieved by a comprehensive compiler which translates thread-based code into efficient event-based code. In order to guarantee the efficiency of the generated code there are still some limitations, though. First, the exact number of threads must be known at compile time. Second, recursive functions must not invoke blocking functions. And third, function pointers must not be used to invoke functions that directly or indirectly invoke blocking functions. We argue, though, that these limitations do not severely affect programming of motes as these constructs are rarely used. Furthermore, the compiler can reliably detect any violations of those restrictions.
Originalsprache | Englisch |
---|---|
Seiten | 77-79 |
Seitenumfang | 3 |
Publikationsstatus | Veröffentlicht - 2010 |
Veranstaltung | 7th European Conference on Wireless Sensor Networks - Coimbra, Portugal Dauer: 17.02.2010 → 19.02.2010 Konferenznummer: 79931 |
Tagung, Konferenz, Kongress
Tagung, Konferenz, Kongress | 7th European Conference on Wireless Sensor Networks |
---|---|
Kurztitel | EWSN 2010 |
Land/Gebiet | Portugal |
Ort | Coimbra |
Zeitraum | 17.02.10 → 19.02.10 |