Embedded real-time operating systems are present today in many devices that we use for our day-to-day functioning as well as medical and other significant practices. A real-time system in an embedded system enables the generation of a certain output within a constrained time period. For example- the instant switching off of lights in a smart home, sensors installed in vehicles or resuscitation equipment turning on within milliseconds reacting to respiratory failure, cardiac arrest, or other changes in a patient’s health condition.
Before we understand the implementation of embedded architecture in real-time systems, let us take you through what embedded systems and embedded real-time operating systems are, what are RTOS design patterns, and their application and significance.
Embedded systems are hardware-and-software computer systems that are designed to perform a specific function with a larger system or device/non-computer device. The usual hardware components include: a CPU, microcontrollers, microprocessors, RAM or ROM memory, I/O ports, signal converters, computer buses, various peripherals, systems-on-chip (SOC), systems-on-module (SOM), and software components that may include: an operating system, application software, and management software.
Embedded systems are recognized by their three defining characteristics:
- Application specific: An embedded system function to run one specific application to meet its real-world function. Unlike a generic computer that is capable of running any compatible application in the system.
- No user interface: There is no platform where the user can interact with the system or give any input/instruction. They instead take command from a data source or hidden sensors.
- Hardware and software-based: As mentioned earlier, there is software in embedded systems that take command and runs the specific function and hardware to run that function in the live environment.
Embedded systems are used in two types of operating systems:
- GPOS (General purpose operating system) – They are generally personal computers and other systems that aid with common tasks and require high-performance processing power. They are usually not time-critical in nature.
- RTOS (Real-time operating systems) – They are used for sensors and devices that are expected to deliver a function with a constrained time limit. They do not require high processing power as such and are designed to comply with the time limits. Examples of RTO designs are airline traffic control systems, airline reservations systems, heart pacemakers, network multimedia systems, robots, etc.
Real-time operating systems fall into 3 categories depending on the flexibility of the time constraint.
Soft RTOS- It is acceptable in soft real-time operating systems to exceed the deadline. The user’s experience does get impacted but it does not impact the performance value at once. In such cases, they either recover or gradually diminish their operations. For example, TV router boxes and gaming consoles.
Firm RTOS- It is occasionally acceptable in cases of firm RTOS to exceed deadlines. In such systems, operation failures or delays do not have a harmful effect but they lose their credibility and performance value in the long run. Manufactured robots are an example of firm RTOS.
Hard RTOS- Embedded RTOS that is hard has absolutely no room for delays or violation of time constraints. Their inability to perform within the given time frame can lead to harmful consequences and the device totally losing its operation value. Some examples are- airplane sensors, self-driving car control systems, etc.
Now that we have established how real-time operating systems function and the level of impact any sort of delay from the prescribed time limit can have on its operations. We can move towards the different design patterns used by software engineers during the development of specific products.
Based on the nature of the design patterns, they can be classified into:
- Object design patterns - Manager Design Pattern, Resource Manager Pattern, Half Call Design Pattern
- Protocol design patterns - Protocol Stack Design Pattern, Protocol Layer Design Pattern, Protocol Packet Design Pattern
- Architecture design patterns - Processor Architecture Patterns, Feature Coordination Patterns, Timer Management Design Patterns
A. Object Design Patterns
- Manager Design Pattern – It is implemented to manage multiple entities in embedded system applications.
- Resource Manager Pattern – this pattern is used to manage multiple resources of the same type by a centralized resource manager.
- Half Call Design Pattern - This design pattern is used for operations that need communication between more than one communication protocol.
B. Protocol Design Patterns
- Protocol Stack Design Pattern - This design pattern is meant for putting a layered protocol and provides dynamic insertion and removal of protocol layers within the stack.
- Protocol Layer Design Pattern - This design pattern is used to disengage protocol layers and lessens the reliability between layers of the protocol stack.
- Protocol Packet Design Pattern - A single buffer is used in this design pattern that supports the insertion and extraction of the various protocol layers.
C. Architecture Design Patterns
- Processor Architecture Patterns- Each architecture design pattern specifies its own processes and modules along with the corresponding roles and responsibilities.
- Feature Coordination Pattern - Feature coordination has the role of making sure that a feature does not fail to complete a result of packet loss or task failure.
- Timer Management Design Patterns - They include patterns for failure detection, message loss and fault recovery sequences, inactivity detection, sequencing operations, and other features that are responsible for the completion of a task under the prescribed time frame.
Design patterns work as set solutions to commonly occurring problems when designing a specific device. The patterns act as a blueprint for engineers to solve a specific problem with the help of a framework that has stemmed as a solution to a similar issue in the past.
The design patterns act as a foundational structure upon which engineers can develop their specific embedded software.
There are certain challenges and advantages to developing real-time embedded systems.
Some of the key challenges are:
Physical constraints – Sometimes the business requirements are such that they pose a challenge for software engineers to design products that meets certain conditions like definitive device size, spatial constraints of installing the device, limited memory and power consumption, external environmental conditions that support the device (temperature, humidity, etc.).
Timing constraints – It is natural to face timing-related challenges since the very essence of real-time systems is their ability to respond to output/events within a predetermined time limit. Hard RTOs are the most challenging in this sense but also high in demand due to their capability of creating an output within seconds/milliseconds.
Task scheduling: Real-time operating systems comprise scheduling algorithms that are responsible for managing these constraints. Rapid response and seamless shifting of tasks are dependent on the scheduling algorithms used by engineers for their real-time embedded solutions.
Priority scheduling: This algorithm puts forth tasks with the highest priority to be performed first by the processor. As a result, a preventive version of the algorithm stops a running task if there is another one with a higher priority in the line. On the other hand, a non-preventive version does not stop running tasks, but a higher priority task will be the next in the line.
This approach is not helpful if there are cases where tasks with equal priority are in the queue.
- Round-robin scheduling: This is a form of preventative scheduling algorithm which instead of prioritizing one task over the other, allocates time intervals for each task.
- First come, first served (FCFS): This is a non-preventive algorithm that lists tasks in the operational state as they arrive. Hence, the task that comes first gets to utilize the computing power first.
- Shortest job first: In this type of schedule, the priority is given according to the execution time of the task resulting in the tasks with short time duration being scheduled first.
Irrespective of these preventative and non-preventative algorithms, it is sometimes a challenge for an engineer to choose the right combination to prioritize operations and ensure a timely response without any space for errors and delays. There are also cases, where the nature of one type of scheduling can contradict the functioning of software when it is expected to deliver a different task.
Advantages of Embedded RTOS:
- Maximum consumption –It allows the maximum optimization of devices and systems. Thus, creating more output from all the resources.
- Task Shifting –The time assigned for moving from one task to another task in these systems is very less. In the latest systems, it takes about 3 microseconds.
- Focus On Application –The entire focus is put on running the application which is being commanded instead of the ones in the queue.
- Real-TimeOperating System In Embedded System –Due to the compactness of the programs they can be embedded in transport and other smaller devices easily making them more accessible and taking the possibilities of expansion even further.
- Error Free –they ensure preciseness along with quick and timely output.
Embedded systems with real-time operations today have made their mark across industries globally. Software architecture for embedded systems has evolved drastically over the years and made real-time operations accessible to healthcare, manufacturing, transportation, infrastructure, and many other fields today.
In the healthcare sector, the application of RTOS in embedded systems has helped in improving diagnosis, controlling health conditions, and providing telemedicine. For the transportation industry, modern vehicles that come with GPS trackers, sensors, and control systems help in ensuring safety and preventing accidents. Additionally, online monitoring of vehicles has increased business efficiency and reduced time and money investment.
Modern factories are being run today with the help of robotics, AI, and lot devices which help in the smooth functioning and speed of manufacturing. Even our homes today are adept with smart lighting, heating, air conditioning, etc.
Real-time embedded solutions increase the quality of life and simplify processes so that we can make the optimum use of our time and energy. The embedded architecture can be used to create real-time systems that are reliable, efficient, and cost-effective. These systems can be used to monitor and control processes in real time, as well as provide feedback to users. In addition, the architecture can be used to develop custom applications to meet specific needs.