The development of a modern sensor network is difficult because of the long-term unattended operation mode, diverse application requirements, and stringent resource constraints. To address these issues, we present SenSpire OS, a predictable, flexible, and efficient operating system for wireless sensor networks. We improve system predictability by two-phase interrupt servicing and predictable thread synchronization; we achieve system flexibility by providing a hybrid model for both event-driven programming and multithreaded programming; we retain system efficiency by employing stack sharing and modular design. Moreover, we have designed a three-layer networking stack and an object-oriented programming language (CSpire) to enhance system usability and programming convenience. Having implemented SenSpire OS on three most commonly used sensor node platforms, we evaluate its performance extensively. Results show that SenSpire OS ensures predictable system performance, provides a flexible hybrid model for application programming, and is efficient in resource utilization.