Implementing Concurrency Abstractions for Programming Multi-Core Embedded Systems in Scheme
Coen De Roover, Christophe Scholliers · 2010
This dissertation presents a study of the limitations and problems related to the prevalent way embedded systems handle signals from the outside world. Such signals are frequently handled using either polling or interrupts. Polling software will continually check whether a signal needs handling. In interruptdriven embedded systems, on the other hand, the CPU will generate an asynchronous signal when an event from the outside arrives. This signal will allow the software to react to this event. We show that both approaches have their disadvantages. The interrupt-driven approach can moreover introduce bugs that are subtle and difficult to fix in embedded software. We study a new event-driven architecture and programming style developed by the XMOS company. The architecture’s hardware support for multithreading enables an event-driven style for programming embedded systems which does not suffer from the drawbacks associated with the use of polling and interrupts. To accomplish this, the thread support is implemented in hardware. Each thread has a dedicated set of registers and is assigned a guaranteed amount of CPU cycles. Next we describe how we ported a Scheme interpreter to this new architecture. We exploit the multi-threaded nature of this architecture by running multiple interpreters in parallel, concretely one interpreter on each core. In addition, we extend each interpreter with abstractions to manage this concurrency and to exploit features specific of the XMOS hardware. Such abstractions include sending messages between interpreters over channels. Concretely, our effort enables an event-driven style for programming multi-core embedded systems in Scheme. We will illustrate the superiority of this approach over polling and interrupt-driven approaches through a realistic case study.