scmRTOS is real-time preemptive operating system and supports
up to 31 user processes (and one system idle process).
Each process has unique priority.
All processes are static and cannot be added or removed at runtime.
Priorities of the processes are static in current version of the RTOS
because dynamic priorities cause large (for Single-Chip Microcontrollers)
overhead.
Operating System consists of kernel, processes and interprocess
communication services.
Kernel provides:
- process management;
- process-level and interrupt-level scheduling;
- interprocess communications support;
- system time (system timer).
Processes allow breaking user code in different independent
asynchronous parts that greatly reduces a complication of program control
flow development. Each process has root function that must contain infinite
main loop. After OS starts, program control flow is passed to such root function.
A return from this function is not permissible.
Since processes in system executed as parallel and asynchronous, user should
not utilize simple global objects (variables of built-in types, arrays,
structures, class objects etc) for interprocess communications and
synchronization because this method is incorrect and dangerous: every process
can be interrupted by a priority one that gains access to the same global data -
this causes risk of sharing violation.
To prevent collisions the user should utilize special facilities such as Critical
Sections (where interrupts are locked) or Interprocess Communications.
scmRTOS has number of Interprocess Communications:
- Event Flags;
- Mutual Exclusion Semaphores (Mutexes);
- Byte-wide Channels;
- Arbitrary-type Channels;
- Arbitrary-type Messages.
User chooses himself what facility (or its combination) should be applied,
taking into account application, available resources and his individual preferences.