TinyOS Operating System Introduction
The TinyOS operating system is an open-source operating system developed by UC Berkeley (University of California, Berkeley), specifically designed for embedded wireless sensor networks, which is based on components (component-based) architecture allows the program to update quickly, while reducing the length of code that is limited by node memory in the sensor network.
Generally speaking, the components of the TinyOS operating system are divided into 3 types: hardware abstraction Components , synthetic hardware components , and high-level software components . The hardware abstraction component TinyOS the physical hardware devices. In the TinyOS system platform, each hardware resource is abstracted into one or more easy-to-operate components, and the user program accesses these resources simply by invoking the corresponding functional interfaces of the corresponding components to implement the operation of the hardware. The role of synthetic hardware components is to connect hardware abstraction components to high-level software components. It can take advantage of the interface provided by the hardware abstraction component to implement functions that are higher than the hardware abstraction components, such as sending and receiving bytes. The high-level software component realizes the control of the whole system, establishes the routing and the data transmission and so on. Multiple lower-level components can be connected to make up a larger component, and the topmost component is the application. TinyOS is shown in hierarchy 1.
Figure 1 Hierarchy of TinyOS
TinyOS provides a two-level scheduling mechanism for tasks and events . Tasks are typically used for applications with low time requirements, which is actually a mechanism for delaying computation. Tasks are equal to each other, there is no priority, so the scheduling of tasks uses a simple FIFO. Tasks do not preempt each other, that is, once a task runs, it must be executed to the end, and the next task can be run when the task voluntarily discards the CPU usage. Hardware event handling handles to respond to hardware interrupts, which can preempt tasks or other hardware event handling handles. When an event is triggered, all tasks associated with the event are executed quickly, and when the event and task are processed, the CPU goes to sleep until other events wake it up. In general, the TinyOS scheduling model has the following characteristics:
(1) The task single-threaded run to the end, allocating only a single task stack, which is beneficial to the memory constrained system.
(2) The Task scheduling algorithm adopts non-preemptive FIFO algorithm, the task is equal to each other, and there is no priority.
(3) The TinyOS scheduling strategy has the energy consciousness, when the task queue is empty, the processor enters the sleep mode, until the external event wakes it up, which can effectively reduce the system energy consumption.
(4) This event-based scheduling strategy allows independent components to share the context of a single execution, allowing for a high degree of concurrency with minimal running space.
The dispatch procedure for TinyOS is shown in 2.
Figure 2 Scheduling process for TinyOS
TinyOS Operating System Introduction