Under the Hood: The Microware OS-9 Architecture
OS-9 utilizes an advanced modular software structure that creates an optimum balance of speed and protection for the embedded systems and applications. OS-9 runs faster compared to microkernel operating systems, and offers an increased level of security compared to monolithic architectures. All modules and components that make up an OS-9 system–including the kernel, file managers, drivers and applications–are stored as logical OS-9 memory modules. Each memory module is a self-contained program consisting of module header, module body, and a Cyclic Redundancy Check (CRC) value. These logical software components are easy to create and manage, while ensuring high availability of the OS-9 platfom.
Real-Time, Multi-Tasking Kernel
OS-9 features a process-based, real-time kernel with POSIX thread support, complete with an extensive scheduler and inter-process communication facilities. Kernel features include:
- Pre-emptive, priority-based, aging scheduler–assuring real-time responsiveness to interrupts and events
- Fault tolerance with exception handling and MMU support
- Process-based architecture with unlimited number of threads
- Inter-process communication services: Signals, Events, Semaphores, Pipes, and Data modules
- Tasks divided into priority-based classes
- Tasks can dynamically change priority
- Modular architecture based on dynamic linking
- Able to run out of Flash or ROM with no file system requirement
- Support for lightweight processes via the POSIX threads API allows easy portability to the OS-9 environment
Microware OS-9 supports three types of protective boundaries:
- The user/system state boundary: User state code uses the processor's non-privileged instruction set, and the operating system's user-state system calls. These restrictions let the operating system contain the application within processor boundaries.
- Process boundaries: Each process is granted access to resources by the operating system. OS-9 prevents processes from erroneously or maliciously disturbing other processes' resources without proper authorization. If the system is using a memory management unit, OS-9 uses it to enforce memory access protection rules. If there is no MMU, OS-9 still makes an effort to enforce protection rules.
- User/group protection: Each process, each module, and (for most file systems) each file has an associated owner. OS-9 uses ownership and permissions to administer access to resources.
The OS-9′s real-time kernel allows multiple independent applications to execute simultaneously through task switching and inter-process communication facilities. All OS-9 programs run as processes containing at least one lightweight process (thread), but may also contain an effectively unlimited number of threads. Within a process, these lightweight processes share memory, I/O paths, and other resources in accordance with the POSIX threads specification and API.
OS-9 schedules threads using a fixed-priority preemptive scheduling algorithm with round-robin scheduling within each priority. The priority levels can be divided into a range that supports aging and a higher-priority range that uses strict priority scheduling. Each process can access any system resource by issuing the appropriate OS-9 service request. At every scheduling point, OS-9 compares the priority of the thread at the head of the active queue to the priority of the current thread. It contextually switches to the thread on the active queue if its priority is higher than the current processes' priority. Aging artificially increases the effective priority of the threads in the active queue as time passes. At defined intervals, time slicing returns the current thread to the active queue behind other threads at the same priority.