Real time systems: software engineering

Rusul Ibrahim Ghani
13 min readMar 29, 2024

--

Most software you use daily is “interactive,” meaning it responds to your commands with some delay. You’ve likely experienced that frustrating lag when a word processor stalls after a keystroke, or when your mouse cursor feels sluggish. These are examples of general-purpose systems, where performance matters, but deadlines are flexible and delays don’t pose serious risks.

But in some critical situations, every millisecond counts. Imagine piloting an aircraft, controlling a nuclear reactor, or performing delicate surgery with robotic instruments. These scenarios call for real-time systems. These specialized systems interact with the physical world using sensors and actuators, responding to events instantly and precisely. A delayed response here could be disastrous, even deadly.

That’s why real-time systems are defined by two key principles:

  • Timeliness: The accuracy of the response matters just as much as its correctness. Every action must occur within a strictly defined timeframe.
  • Criticality: Missing deadlines can have immediate and severe consequences, ranging from system malfunctions to catastrophic failures.

Where do we use real-time systems?

  • transportation: control systems for and traffic control of vehicles, ships, aircraft and spacecraft;
  • military: weapons system, tracking and communications;
  • industrial processes: control for production, including energy, chemicals and manufacturing using robotics;
  • medical: patient monitoring, defibrillation and radiation therapy;
  • telecommunications: telephone, radio, television, satellite, video telephony, digital cinema and computer networks;
  • household: monitoring and control of appliances; and
  • building management: security, heating, ventilation, air conditioning and lighting.

Advantages:

  • Real-time systems provide immediate and accurate responses to external events, making them suitable for critical applications such as air traffic control, medical equipment, and industrial automation.
  • They can automate complex tasks that would otherwise be impossible to perform manually, thus improving productivity and efficiency.
  • Real-time systems can reduce human error by automating tasks that require precision, accuracy, and consistency.
  • They can help reduce costs by minimizing the need for human intervention and reducing the risk of errors.
  • Real-time systems can be customized to meet specific requirements, making them ideal for a wide range of applications.

Disadvantages:

  • Real-time systems can be complex and difficult to design, implement, and test, requiring specialized skills and expertise.
  • They can be expensive to develop, as they require specialized hardware and software components.
  • Real-time systems are typically less flexible than other types of computer systems, as they must adhere to strict timing requirements and cannot be easily modified or adapted to changing circumstances.
  • They can be vulnerable to failures and malfunctions, which can have serious consequences in critical applications.
  • Real-time systems require careful planning and management, as they must be continually monitored and maintained to ensure they operate correctly.

Rich Variety or real-time Disciplines

These components invariably are physical in nature and thus, while providing information to the system, they are also part of the environment. This high-level approach is shown in Figure 1–1.
A general system with inputs and outputs.
A classic representation of a real-time system as a sequence of schedulable jobs.

What is a Real-Time Operating System (RTOS)?

A real-time operating system (RTOS) is an operating system that is used in computing systems that requires strict completion deadlines for all the tasks that need to be performed on it.

Here, the system is connected to an external event, and whenever that event is completed, a signal is sent to the system with the help of a sensor.

Now that signal is communicated to the system as an interrupt. After the operating system receives an interrupt, it initiates a process that is associated with it. Once the interrupt is completed, the operating system hands the power back to the CPU. Since all this is happening in real-time and there’s a need for a quick response from the system, speed is very important here.

Components of Real-Time Operating System (RTOS)
Components of Real-Time Operating System (RTOS)

Difference between Hard and Soft Real-Time System?

Hard and Soft Real-Time System

Hard vs. soft deadlines?

Soft deadline
Hard deadline

What is a real-time application?

A real-time application, or RTA, is an application that functions within a time frame that the user senses as immediate or current. The latency must be less than a defined value, usually measured in seconds. The use of real-time applications is part of real-time computing.

To determine if a specific application qualifies as Real Time is a function of its worst-case execution time. WCET is the maximum amount of time a defined task or set of tasks requires on a given hardware platform

Types:

  • Hard Real-Time: Missing deadlines means system failure (industrial safety systems).
  • Firm Real-Time: Missed deadlines degrade quality (video conferencing).
  • Soft Real-Time: Degradation is expected (video games).

Features & Benefits:

  • Engagement: Immediate interaction keeps users hooked.
  • Communication: two-way communication for better collaboration.
  • Response Time: Faster feedback for efficient workflows.
  • Streamlined Workflows: Tasks adapt to real-time data.

Real-time application Features benefits, and examples

Features:

  • High Engagement: Immediate responses and interaction keep users immersed.
  • Enhanced Communication: Two-way, real-time communication fosters better collaboration.
  • Fast Response Time: Users receive immediate feedback, streamlining workflows.
  • Dynamic Workflows: Tasks adapt to real-time data, boosting efficiency.
  • Industrial automation

Benefits:

  • Improved Customer Connection: Businesses engage with customers in a more meaningful way.
  • Enhanced Collaboration: Teams work together seamlessly with real-time communication.
  • Increased Productivity: Faster responses and adaptable workflows lead to efficiency gains.
  • Data-Driven Decision Making: Real-time data analysis provides valuable insights for informed decisions.

Examples:

  • Video conferencing
  • Online gaming
  • Instant messaging
  • Real-time analytics
  • Geolocation
  • Medical monitoring
  • Industrial automation
  • internet of things (IoT)
  • business intelligence

Real-Time System Challenges?

  • Timing constraints: Real-time systems must meet strict deadlines for data processing and response. This can be difficult to achieve, as there are many factors that can affect the timing of a system, such as the performance of the hardware, the complexity of the software, and the workload on the system.
  • Resource constraints: Real-time systems often run on embedded devices with limited processing power and memory. This can make it difficult to implement complex algorithms and data structures.
  • Fault tolerance: Real-time systems must be able to tolerate errors and failures without compromising their deadlines. This requires careful design and testing, as well as the use of redundant hardware and software.
  • Concurrency: Real-time systems often have multiple tasks that must be executed concurrently. This can lead to concurrency issues, such as race conditions and deadlocks, which can cause the system to malfunction.
  • Verification and validation: It is essential to verify and validate real-time systems to ensure that they meet their requirements. This can be a complex and time-consuming process, as it often requires the use of specialized tools and techniques.

Real-Time System Opportunities?

High-Demand Expertise:

  • Embedded Systems: Design and develop software for devices like medical implants, drones, and autonomous vehicles, pushing the boundaries of performance and reliability.
  • Control Systems: Build software for industrial automation, robotics, and power grids, ensuring smooth operation and safety-critical responses.

Technological Advancements:

  • AI and Machine Learning: Integrate AI and machine learning into real-time systems for predictive maintenance, anomaly detection, and intelligent control.
  • Internet of Things (IoT): Design and develop software for interconnected devices, enabling real-time data analysis and intelligent decision-making.
  • Dynamic Scheduling and Resource Allocation: Developing algorithms and strategies to prioritize tasks, dynamically allocate resources, and optimize overall system performance.

Self-driving car:

Challenges:

  • Sensor fusion and data processing: real-time analysis of data from cameras, LiDAR, radar, and other sensors to create a dynamic map and react to changing environments.
  • Path planning and decision-making: selecting optimal routes and making instant decisions based on real-time traffic and obstacles.
  • Safety and reliability: ensuring system robustness and fault tolerance to prevent accidents and maintain passenger safety.

Solutions:

  • Multi-core processors and GPUs: parallel processing for efficient sensor data processing and path planning algorithms.
  • Real-time operating systems (RTOS): prioritize critical tasks and guarantee predictable response times.
  • Formal verification and testing: rigorous testing and validation to ensure software correctness and safety.

Surgical Robot:

Challenges:

  • Precise control and minimal latency: Robot movements must be smooth and accurate to avoid harming the patient.
  • Sterile environment and safety protocols: Software must be robust to prevent contamination and ensure patient safety.
  • Haptic feedback and surgeon interaction: Provide surgeons with real-time feedback on tissue resistance and instrument movements.
  • Integration with medical imaging data: Overlay real-time surgical data on pre-operative scans for better guidance

Solutions:

  • Real-time communication protocols: Ensure fast and reliable data exchange between the robot, the surgeon's console, and medical devices.
  • Redundant control systems and fail-safe mechanisms: Prevent catastrophic failures in case of hardware or software errors.
  • Advanced motion control algorithms: Smoothly control robot movements based on the surgeon's input and real-time feedback.
  • Augmented reality displays: Provide surgeons with visual overlays of critical information during surgery.
A solar-powered, autonomous real-time system with radiocommunication links and a variety of sensors and actuator

Real-Time Software Development Process:

Developing software for real-time systems requires careful planning and specific methodologies to handle critical deadlines and ensure consistent performance.Developing software for real-time systems requires careful planning and specific methodologies to handle critical deadlines and ensure consistent performance.

  1. Requirements Engineering:
  • Define system function and behavior: Clearly outline the real-time tasks, deadlines, and interaction with the physical environment.
  • Identify resource constraints: Analyze available processing power, memory, and communication bandwidth.
  • Establish quality attributes: Define reliability, fault tolerance, security, and performance requirements.
  • Use real-time modeling tools: Tools like UML or MARTE can visualize system behavior and timing constraints

2. Design and Architecture:

  • Partition tasks and prioritize deadlines: Divide functionality into manageable tasks and assign deadlines based on criticality.
  • Choose a real-time operating system (RTOS): Select an RTOS that fits your resource constraints and scheduling needs (e.g., FreeRTOS, VxWorks, QNX).
  • Design communication protocols: define efficient and reliable methods for data exchange between tasks and with external devices.
  • Implement error handling and fault tolerance mechanisms: Ensure graceful degradation or system shutdown in case of errors.

3. Implementation and Coding:

  • Use real-time programming languages: Choose languages like Ada, C/C++, or Java with predictable execution times and deterministic behavior.
  • Apply real-time coding practices: avoid dynamic memory allocation, minimize context switching, and use efficient algorithms.
  • Modularize code and enforce strict coding standards: Promote maintainability and reduce the risk of errors.
  • Perform early and frequent unit testing: Ensure each module functions correctly and meets timing constraints.

4. Integration and Testing:

  • Integrate system components and test overall functionality: Verify interactions between tasks and with the environment.
  • Conduct performance testing: Analyze resource usage, meet deadlines, and identify bottlenecks.
  • Perform stress testing and fault injection: Simulate critical scenarios and ensure system robustness under stress conditions.
  • Formal verification: Use mathematical methods to prove the system meets its timing requirements and desired behavior

5. Deployment and Maintenance:

  • Download and configure software on the target hardware.
  • Develop monitoring and logging mechanisms: Track system performance and identify potential issues.
  • Implement patch and update mechanisms: maintain the software and address any bugs or vulnerabilities.
Use-case diagram for the elevator control system.
Context diagram for the elevator control system.

Requirements Engineering for Real-Time Systems

  1. Standard Requirement Classes:
  • Functional requirements describe the system’s behavior.
  • External interface requirements define inputs and outputs.
  • Performance requirements specify timing and numerical constraints.
  • Logical database requirements define data structures.
  • Design constraints relate to standards and hardware limitations.
  • Software system attributes include availability, maintainability, etc.

2.Functional Requirements:

  • Functional requirements describe the sequence of operations for each input.
  • They must cover both normal and abnormal situations.
  • They define the complete deterministic behavior of the system.

3. Nonfunctional Requirements:

  • Nonfunctional requirements include performance, interface, database, and attribute requirements.
  • They specify quantitative and qualitative characteristics of the system.
  • They are crucial for ensuring the system’s usability, reliability, and maintainability.

Real-time Operating Systems (RTOS) Market Insights 2022

The global Real-time Operating Systems (RTOS) market size was valued at USD 1.34586 billion in 2022 and is expected to expand at a CAGR of 8.83% during the forecast period, reaching USD 2.23552 billion by 2028.

Real Time Operating Systems (RTOS) for IoT:

Real-time Operating System Market Revenue, By Type, 2021–2032, (USD Billion)
Real-time Operating System Market Share, By Application, 2022

RTOS play in various industries through IoT! Your points hit the nail on the head by highlighting how different sectors leverage the real-time capabilities of RTOS to:

  • Industrial Equipment: Automate processes, optimize production lines, and ensure precise control of machinery.
  • Automotive: Power ADAS features like collision avoidance and lane departure warning, improving safety and efficiency.
  • Healthcare: Enable real-time monitoring of vital signs, deliver prompt medical intervention, and streamline medication management.
  • Telecommunications: Support smooth data flow, maintain network uptime, and deliver a seamless user experience.
  • Government: Manage critical infrastructure like traffic lights, energy grids, and public safety systems with reliability and security.

Who is the largest manufacturers of Real-time Operating Systems (RTOS) Market worldwide?

  • Accelerated Technology, Inc
  • NXP Semiconductors
  • ARM Ltd
  • Mentor Graphics
  • Huawei
  • FreeRTOS
  • Green Hills Software
  • Quadros Systems
  • ESOL

Vision: Real-Time Operating Systems for Heterogeneous Soft Multi-Cores (HSMCs)

Challeng:

  • Existing multi-core processors pose difficulties for multitasking in hard real-time systems due to complex scheduling and potential non-determinism.
  • Solution: The HSMC architecture addresses this by dedicating a CPU core to each task, leading to a distributed multi-processor system on a single chip.

Benefits:

  • Deterministic and manageable: This RTOS design simplifies system complexity and makes hard real-time systems easier to manage and analyze.
  • Focus on Application Design: By handling essential services, the RTOS frees development teams to concentrate on application design and functionality.
  • True Task Concurrency: Dedicated cores for each task ensure true concurrency and eliminate priority inversion issues.

Technical Architecture:

  • Sensor fusion and data processing: Real-time analysis of data from cameras, LiDAR, radar, and other sensors to create a dynamic map and react to changing environments.
  • Path planning and decision-making: Selecting optimal routes and making instant decisions based on real-time traffic and obstacles.
  • Safety and reliability: Ensuring system robustness and fault tolerance to prevent accidents and maintain passenger safety

Who is the largest manufacturers of Real-time Operating Systems (RTOS) Market worldwide?

  • Accelerated Technology, Inc
  • NXP Semiconductors
  • ARM Ltd
  • Mentor Graphics
  • Huawei
  • FreeRTOS
  • Green Hills Software
  • Quadros Systems
  • ESOL

What are the types of Real-time Operating Systems (RTOS) available in the Market?

Growing demand for below applications around the world has had a direct impact on the growth of the Real-time Operating Systems (RTOS)

  • Aerospace & Defense
  • Industrial Engineering
  • Automotive

What are the types of Real-time Operating Systems (RTOS) available in the Market?

  • Soft Real Time Operating System
  • Hard Real Time Operating System
  • Frim Real Time Operating System

RTOS Design:

  • Focus on Service Provision: The RTOS primarily focuses on reliable synchronization and intertask communication, eliminating the need for intra/inter-core scheduling/dispatching.
  • Single Coordinating System Task: All application tasks run in isolation, while a single system task handles essential services like synchronization and communication.
  • Local Scheduling/Dispatching: Each application task handles its own scheduling and dispatching based on local hardware interrupts and system events.
  • Mutex Locks for Synchronization: Critical resources are protected using mutex locks managed by the system task. Tasks request and release mutexes via the high-speed communication channel.
  • Priority/Round-Robin Communication Handling: The system task handles concurrent communication requests from applications using priority, round-robin, or a combination approach.
  • Time-Bounded Shared Resource Access: Access to shared resources is guaranteed within a specific time frame by the system task, ensuring worst-case execution time analysis.
  • Task-Local Message Buffers: Intertask communication utilizes task-local message buffers connected by the system task. Messages are transferred through the high-speed channel and delivered based on recipient readiness.
  • Additional Utility Services: The system task can offer additional services like real-time clock and calendar functionalities.

Real-time systems are ubiquitous in our modern world, playing a critical role in diverse applications from industrial automation and medical devices to telecommunications and transportation. Their defining characteristic is the need to respond to inputs and events within strict deadlines, making their design and development a challenging but rewarding field.

It is important to remember that the field of real-time systems is dynamic and constantly evolving. This text provided a snapshot of the current landscape, but further exploration and research are vital for staying abreast of the latest developments and contributing to the ongoing progress in this fascinating field.

resources:

  • Laplante, P. A. (2012). Real-time systems: Design and analysis. John Wiley & Sons.
  • Kopetz, H. (2011). Software engineering for real-time: A roadmap. Springer Science & Business Media.
  • Sha, L., Moody, T., Rajkumar, P., & Zhu, S. (2004). A practical introduction to real-time systems for undergraduate engineering. Springer.
  • TimeSys Corporation. (2010). The Concise Handbook of Real-Time Systems. TimeSys Corporation.
  • A practical introduction to real-time systems for undergraduate engineering
  • Advantages and Disadvantages of Real-time Operating System
  • Real-time challenges in embedded systemsReal-time challenges in embedded systems
  • Real-time systems.

--

--

Rusul Ibrahim Ghani

. “I want to see and understand the world outside. I don’t want to die inside these walls without knowing what’s out there!”