Real-Time Operating Systems (RTOS) are operating systems (OS) that are designed and optimized for applications that require real-time execution and processing capabilities within a specified time constraint. RTOS are critical components of most embedded systems as they allow them to execute time-specific tasks. In general, the processing or execution time of RTOS is measured in milliseconds, and any delay in execution can result in bad consequences.
However, RTOS is designed to function in the same way as a general-purpose operating system (GPOS) like Windows, MacOS, Linux, etc. But they are optimized to meet the specific requirements and deadlines of the applications.
In embedded systems, RTOS allows to communicate with the system hardware and provides an interface between application software and the hardware. Also, the embedded systems RTOS are developed to handle multiple simultaneous processes and ensure their execution within a predictable time limit.
Functionalities of Embedded System RTOS
The primary functionality of real-time operating systems (RTOS) is to provide execution of tasks within strict time limits. So, they ensure a predictable behavior of the embedded systems. Some of the other key functionalities that RTOS typically provides in embedded systems include the following –
Multitasking
RTOS are generally designed to handle multiple tasks at the same time with a rapid switching between them for execution. This creates an impression that the tasks are running in parallel. In multitasking, the RTOS allocates a single processor to multiple tasks depending on their priorities and scheduling policies.
RTOS uses different states like ready, running, or blocked to manage multiple tasks. The scheduler of the RTOS determines which task has to be processed first. In embedded systems, the multitasking functionality of RTOS ensures efficient utilization of resources.
Process Thread Prioritization
Another important functionality of RTOS is the priority-level assignment of tasks. This functionality enables RTOS to manage and execute high-priority tasks first than lower-priority tasks. This functionality makes embedded systems more reliable and efficient in time-critical applications.
For prioritizing process execution, RTOS makes use of different mechanisms like priority inheritance and preemptive scheduling.
Interrupt Levels
In an embedded system, the signals that are used to temporarily stop the processor from executing tasks are referred to as interrupts. Embedded system RTOS is designed to have various interrupts of different levels to manage different tasks of varying urgency. The multiple interrupt levels allow RTOS to handle high-priority tasks with minimal delay as compared to lower-priority tasks.
Characteristics of RTOS in Embedded Systems
Embedded system RTOS has several important characteristics that make them suitable for time-critical and performance-sensitive applications. Some of the important characteristics of embedded systems are highlighted here –
Small Footprint
Since embedded systems are designed to have minimal system resources. Therefore, RTOS used in embedded systems is also engineered to utilize limited system resources like memory, CPU, peripherals, etc. to perform tasks efficiently.
High Performance
Embedded systems have a task-specific design, hence the RTOS used in embedded systems are optimized to provide high performance in terms of speed and execution of tasks. This characteristic of RTOS allows embedded systems to take minimal time and delay in task execution. The high performance of RTOS is very important in embedded systems because any delay in the task execution can cause failure of the entire process.
Determinism
Embedded system RTOS is designed to provide deterministic and predictable behavior. This characteristic of RTOS ensures that the embedded systems will produce the same output for repeating inputs and conditions.
Also, the determinism of RTOS is important for embedded systems that are employed in applications where consistency and reliability are critical, such as industrial robotic and automation systems, medical equipment, autonomous vehicles, etc.
Safety and Security
Safety and security are other vital characteristics of embedded system RTOS. It is desired that the RTOS used in embedded systems must comply with the safety and security standards, which is important for reliable performance and protection against threats.
This characteristic of RTOS becomes prominent for embedded systems used in safety-critical systems like medical devices, aircraft control, autonomous vehicles, airbag control, etc.
Priority-Based Scheduling
Embedded system RTOS has a scheduler to assign priorities to tasks depending on their urgency. This characteristic assigns high priority to tasks that have to be executed first and lower priority to tasks which are less important.
Timing Information
It is one of the important characteristics of embedded system RTOS that allows them to efficiently manage time-sensitive operations. Timing information of RTOS includes features like task delays, scheduling timers, or timeouts.
How does Embedded System RTOS Work?
The step-by-step working of RTOS in embedded systems is explained below –
Step 1 – RTOS begins its operation by creating tasks for different functionalities like reading input data, establishing communication with peripherals, etc.
Step 2 – Next, it assigns a priority level to each task depending on its importance.
Step 3 – Then, RTOS schedules the tasks to execute. Tasks with higher priority will get executed first and then the lower-priority tasks.
Step 4 – If any external event occurs in the system, then RTOS handles it by using interrupts.
Step 5 – RTOS takes care that the tasks must be completed within their assigned time constraints.
Step 6 – If any task fails to execute, the RTOS takes an appropriate action like retrying or rolling back to a safe state or termination of the task.
Hence, RTOS in an embedded system typically operates as described in these six steps. However, in complex embedded systems, the working of RTOS can involve many other advanced functionalities as well.
Types of RTOS in Embedded Systems
Depending on how strictly RTOS handles time constraints and missing deadlines in an embedded system, they can be classified into the following three main types –
- Hard RTOS – These RTOS are designed to complete assigned tasks within specified time constraints. If the RTOS fails to meet the timing and deadline requirements, it can cause critical consequences. Hence, these RTOS do not have any tolerance for missing deadlines. Hard RTOS are commonly used in airbag systems, medical equipment, aircraft control, etc.
- Soft RTOS – This type of embedded system RTOS allows some delays in timing and deadlines of task completion without causing any serious consequences. Hence, we can say that soft RTOS has some tolerance for missing deadlines occasionally. Examples of soft RTOS applications include smartphone OS, online transaction systems, streaming services, etc.
- Firm RTOS – In firm RTOS, tasks have to be completed within specified time limits and deadlines, but if deadlines are missed, no system failure occurs and no results in serious consequences. Instead, the system produces results with degraded performance and quality. Therefore, in the case of firm RTOS, deadline misses are not desirable but not disastrous. These RTOS are used in applications like hearing aid systems, multimedia systems, industrial automation, etc.
Advantages of Embedded System RTOS
The real-time operating systems (RTOS) offer the following key benefits in embedded systems –
- RTOS minimizes the idle time of the embedded systems and hence optimizes resource utilization.
- RTOS is efficient in managing critical processes by prioritizing and completing within specified time requirements. Hence, they improve the task management efficiency of embedded systems.
- RTOS are able to work continuously for long hours with maintained stability and reliability.
- RTOS provides a deterministic and predictable behavior of embedded systems.
- RTOS is compatible with numerous development platforms, making embedded systems versatile.
Conclusion
So, this is all about RTOS in Embedded Systems. In this chapter, we have discussed all the important aspects of real-time operating systems used in embedded systems.