Download Trusted embedded System Operating System (TeSOS)

Transcript
interfaces are bi-directional and declare a set of functions (called commands), the provider of the
interface must provide. Function calls (events) used by the interface also have to be implemented.
These components consist of:
•
Frame: A Frame represents the internal state of a component.
•
Functions: Functions are responsible for the computation of the application code itself.
•
Interface: Interfaces include the events and commands of TinyOS components.
Moreover, TinyOS distinguishes between two dierent types of components:
•
Modules: Modules represent the application code. They implement one or more interfaces
to hard-/software of the system.
•
Conguration: The component conguration is designed to connect other components
together. It connects interfaces used by other components. This technique is called wiring.
Components and their interfaces are a set of commands and events.
They dene interaction
boundaries between other components, commands as their entry points, and events as their
callback points.
The before mentioned component wiring provides functionality to all other
components. Also there is no restrictions on usage of components all components can use other
components as they want.
Each nesC application is described by a top-level conguration, wiring together all its components inside. TinyOS does not block events at all, however, the latest version includes a thread
library.
In general, it is possible to run a threaded application on top of the rest of all other
applications of the operating system. This threaded application now has a blocking API, and
can also include large loops. This new library also allows the author to write applications in C,
rather than nesC, what even reduces the eort or learning a new programming language.
7.4.2 Protection
In contrast to old versions of TinyOS, version 2.1 introduced some signicant enhancements to
core TinyOS components and interfaces. Special interest is the fully preemptable applicationlevel threads library known as TOSThreads, and a runtime memory protection service called Safe
TinyOS that enables the operating system to be able to make basic memory safety checks.
TOSThreads provides an extension to the pre 2.1 TinyOS concurrency model, requiring
some changes to the TinyOS kernel In the existing TinyOS concurrency model, there were two
execution contexts:
•
synchronous (tasks), and
•
asynchronous (interrupts).
Asynchronous code can preempt synchronous code but synchronous code is unable to preempt asynchronous code. TOSThreads provides a third execution context: user-level application
threads. All threads are able to synchronize with each other and the system, using common synchronization techniques such as semaphores, mutexes, barriers, or condition variables. Switching
the context produces an overhead of about 0.92 percentage, compared to applications without
implemented threading techniques.
Current development also introduces TinyLD, a dynamic linker and loader for TinyOS. However the development is still not nished. After deployment, TinyLD can be used to dynamically
deploy and execute TOSThreads based applications at runtime.
Optionally, TinyOS 2.1 applications can be used with its safe mode where the compiler is
used to enforce memory safety at runtime. Using this mode, the programmer has to provide some
124