Before starting playing with an RTOS it is advisable to acquire some general concepts about Real Time Systems and then about RTOSes for embedded use. Initially we will use a very generic terminology, we will map those terms in more specific terms in next chapter.
Imagine a realtime system as something composed by one or more, likely many, realtime processes. Our definition of realtime process is: an entity that, in response to an external events, produces a reaction in a finite time.
We will not enter at this point into details about the nature of those entities nor what a event or a reaction can be, an abstract approach is preferable at this point, moreover, we are assuming that there can be a single possible event and a single possible reaction, this is not necessarily the case.
A complex systems can always be decomposed in a set of elementary processes connected in a network, the system has a set of input and output signals, we can still consider them events and reactions but on a system level. A system can also have a global state, information that can optionally be accessed by the various processes in the system.
Note that in a system, there are like multiple paths leading from an event to a reaction, lets name those paths activities.
A small summary:
Processes, activities and, by extension, systems can classified in one of the following categories.
“A non real time system is a system where the programmed reaction to an event will certainly happen sometime in the future”.
“A soft real time system is a system where the programmed reaction to an event is almost always completed within a known finite time”.
“An hard real time system is a system where the programmed reaction to an event is guaranteed to be completed within a known finite time”.
Note that into a system, processes of all kinds can be present at the same time, each one potentially with a different classification. The classification of an activity into a system must be considered equal to the classification of the qualitatively worst process influencing it.
If a system includes activities with different classification then it is a mixed system, this is a common case. An example:
In this system the process 2 is non-realtime, its response time cannot be estimated. Because of this the internal path I2→O1 must be considered non-realtime as well. Note that also process 1 could be affected by the non-deterministic response time of process 2 because there is some global data sharing. If mutual exclusion is used then process 1 and 2 affect each other for the duration of the worst case time spent in the mutual exclusion zone.
Processes never react in a constant time, at a sufficiently small time scale any physical process is bound to have jitter.
When assessing the response time of a system the jitter of each single internal process must be accounted for and, note, the only meaningful value is the worst case jitter. Unbounded or not assessed jitter is not compatible with an hard realtime systems.
An RTOS is an operating system whose internal processes are guaranteed to be compliant with (hard or soft) realtime requirements. The fundamental qualities of an RTOS are:
RTOS are often confused with “fast” operating systems. While efficiency is a positive attribute of an RTOS, efficiency alone does not qualifies an OS as RTOS but it could separate a good RTOS from a not so good one.
An RTOS is not a magic wand, your system will not be “realtime” just because you are using an RTOS, what matters is your system design. The RTOS itself is just a toolbox that offers you the required tools for creating a realtime system, you can use the tools correctly or in the wrong way.