Real Time Operating System (RTOS) is a type of operating system used in embedded systems. General purpose OS such as Windows tries to maintain the PC responsive to the user. However, an RTOS guarantee predictable execution of the tasks.
RTOS system completes tasks within the deadline in a predictable manner. Hence, safety critical and mission critical embedded systems use this type of operating systems. Similarly, it has very less memory footprint when compared with a general purpose OS.
There are mainly two types, namely, ‘soft real-time’ systems and ‘hard real-time’ systems.
In a ‘soft real-time’ system the task should complete and give the result. But it is not mandatory to meet the deadline. That is to say, the system continues to function even after the task’s deadline is missed. But if the system continues to miss task deadlines, then the functionalities may be degraded. Response times of a ‘soft real-time’ system can be within a few hundred milliseconds. Examples of ‘soft real-time’ systems include digital camera, mobile phone, mp3 player etc.
In a ‘hard real-time’ system the task should complete and give the result in its allocated time and the deadline must be met. This type gives task results predictable within milliseconds. Embedded systems such as medical embedded systems, satellite controls, aircraft embedded systems are examples of ‘hard real-time’ systems.
There are open source and proprietary RTOS available in the market.
FreeRTOS, Zephyr, RIOT, Nano-RK, Apache Mynewt, Mbed OS, DuinOS, RT-Thread, MicroC/OS
QNX, VxWorks, SafeRTOS, Nucleus, INTEGRITY, SCIOPTA, PikeOS
RTOS architectures can be broadly classified into Monolithic kernel and Microkernel.
Monolithic kernel has all the OS components built into the kernel space. For instance, a monolithic kernel includes drivers, file management, scheduler, networking, graphics etc. into its kernel space. The application software modules will be running in user space.
One good thing about this architecture is that all the OS component executes in the same address space speeds up execution times. But the downside of this architecture is that if there is an error in one of the OS components then the entire system can be affected.
Example of a monolithic kernel RTOS is VxWorks.
Microkernel has a tiny kernel. This type of system provides only minimal services such as low-level address space management, IPC, thread management etc. That is to say, OS services such as device drivers, networking, file system management etc. are moved to user address space.
Microkernel system can continue to function even if an OS component executing in user address space is failed. This is because, only the important core OS components executes in the kernel address space.
Examples of microkernel RTOS are FreeRTOS and MicroC/OS.