| Wireless Sensor Networks (WSNs) are applied in many fields, such as military,healthcare, traffic, environment surveillance, etc. As the abstraction of sensor nodehardware, operating system influences the way it provides services. Compared withthe traditional embedded operating system, there exist many resource constraints insensor node, such as power, memory, bandwidth, etc. Most of popular WSN OS justsupport event-driven model, which is unable to process real-time tasks and limit thescope of WSN applications. Meanwhile, the traditional over-the-air updatingmechanism, replacing the whole old image with the new one, causes large powerconsumption and memory usage. Thus, this paper proposes a task and resourceself-adaptive WSN OS, which supports event-driven and thread-driven model andprovides a various over-the-air updating mechanism.Considering the characteristic of WSN application and the heterogeneity of thehardware platform, this paper proposes a layered and modular operating system ar-chitecture. Most important of all, this paper designs a novel hybrid programmingmodel based on event-driven and thread-driven model and offers a two-level sched-uling strategy, which is resource self-adaptive through switching between twomodes, to support periodic-tasks and real-time tasks. Based on the “tuple†space and“IN/OUT†primitives, this paper designs an efficient inner system communicationscheme to support collaborative and distributed application. Additionally, this paperimplements a memory management scheme based on improved “first fit†method toallocate and free the memory efficiently.According to the granularity of the updating code size, this paper innovativelyproposes a three layer updating mechanism: variable updating, dynamic moduleloading and whole image replacement. User can choose appropriate updatingmethod by need to reduce the transmit consumption and memory usage.Last, this paper transplants the OS to the real sensor node, which consists ofAT91SAM7S and Xbee-PRO. Through the evaluation and analysis of hardware,memory usage, this paper makes a comparison with other WSN OS. To verify thereal-time performance of the OS, this paper conducts an evaluation and analysis from two aspects: interrupt response time and CPU context-switch time. |