RTOS interrupt decoupling and buffer driving low-delay processing method and application

Through the low-latency processing method of RTOS interrupt decoupling and buffer-driven, the real-time response capability of embedded systems is improved through breakthroughs, solving the problem of frequent ISR triggering under high-frequency interrupts, significantly reducing latency and improving system performance.

CN120508366APending Publication Date: 2025-08-19XIAN ZHONGKE XIGUANG AEROSPACE TECHNOLOGY GROUP CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510602859.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-12
Publication Date
2025-08-19

AI Technical Summary

Technical Problem

In the high-frequency interrupt scenarios of existing RTOS, the context high-frequency switching and response time due to frequent triggering of ISR seriously weakens real-time and is difficult to meet the needs of high real-time.

Method used

The low-latency processing method of RTOS interrupt decoupling and buffer-driven is adopted. Through the separation of primary and secondary interrupts, combined with intelligent buffer management and dynamic triggering strategies, hardware interrupt priority and software interrupt tasks are configured, and lightweight critical area management and cross-platform adaptation are used to achieve efficient operation of the system.

Benefits of technology

Significantly reduces interrupt response delay by more than 60%, improves system throughput by 3 times, optimizes CPU utilization, reduces power consumption by 58%, and enhances system stability. It is suitable for rigorous real-time scenarios such as industrial control and on-board electronics.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508366A_ABST
    Figure CN120508366A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of embedded real-time system optimization, and discloses a low-delay processing method for RTOS interrupt decoupling and buffer driving. The method comprises the following specific use steps of S1, system structure configuration, S2, key data structure design and initialization, S3, hardware interrupt processing setting, S4, software interrupt task implementation, S5, interrupt shielding and critical zone management setting, S6, software and hardware collaborative configuration, S7, cross-platform adaptation and S8, system operation and optimization. According to the invention, the breakthrough improvement of the real-time response capability of the embedded system is realized through an innovative interrupt hierarchy separation mechanism in combination with intelligent buffer management and a dynamic trigger strategy; according to the scheme, traditional interruption processing is decoupled into a very simple hardware response layer and an efficient background processing layer, so that the instant response delay of a high-frequency event is reduced by more than 60%.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of embedded real-time system optimization, and specifically relates to a method and application of low-latency processing of RTOS interrupt decoupling and buffer drive. Background Art

[0002] In commercial satellite systems, high-frequency sensors and communication modules deployed in remote sensing and communications satellites require extremely short timeframes to collect, process, and respond to external data. While real-time operating systems (RTOSs) effectively manage task priorities and interrupts to ensure real-time task scheduling, satellite systems experience frequent interrupts. The attitude control module requires millisecond-level gyroscope data readings, while the communication module continuously interrupts to receive data frames. Existing RTOSes use a single-level interrupt service handler, in which the ISR is invoked upon each interrupt trigger. Upon completion of data acquisition, the ISR immediately interacts with the RTOS. For example, in serial communication, data arrival triggers an interrupt. The ISR reads the data into a buffer and notifies the processing thread for parsing. While this achieves task isolation and thread scheduling, it suffers from significant drawbacks: frequent ISR triggering in high-interrupt scenarios leads to frequent context switching; the involvement of RTOS synchronization mechanisms within the ISR further increases response time; and multiple interrupts nest or interrupt processing threads increase system load, severely impairing real-time performance. This causes the processor to be overloaded, interfering with the execution of critical tasks; interrupt responses are constrained by task scheduling strategies, resulting in unpredictable delays; in extreme cases, it may also cause the system response to crash, resulting in the failure of real-time task processing, making it difficult to meet high real-time demand scenarios. Summary of the Invention

[0003] The object of the present invention is to provide a method and application for low-latency processing of RTOS interrupt decoupling and buffer drive, so as to solve the problems raised in the above background technology.

[0004] To achieve the above objectives, the present invention provides the following technical solution: a method for low-latency processing of RTOS interrupt decoupling and buffer-driven processing, the specific steps of which are as follows:

[0005] S1: System structure configuration: Level 1 interrupt has the highest priority response to hardware, and Level 2 interrupt RTOS / soft interrupt has a higher priority than ordinary threads and lower than critical real-time tasks;

[0006] S2: Design and initialization of key data structures: Design and initialize a lock-free ring buffer, set up read and write mechanisms and detection, and determine interrupt triggering strategies and parameters based on the scenario;

[0007] S3: Hardware interrupt processing settings: Configure the hardware interrupt priority, set the high-frequency ISR level 1 interrupt as high priority, and register a unified entry with a function pointer;

[0008] S4: Software interrupt task implementation: RTOS designs a high-priority software interrupt thread, writes processing logic, and uses standard APIs to start and stop the thread;

[0009] S5: Interrupt masking and critical section management settings: Use lightweight critical section management, and use interrupt disabling or mutex mechanisms to ensure the safety of the first-level ISR write buffer;

[0010] S6: Software and hardware coordination configuration: Configure low-priority background threads in the RTOS to prevent preemption and select appropriate methods to trigger software interrupts;

[0011] S7: Cross-platform adaptation: Utilize HAL interface components and modules to complete the system's cross-architecture and RTOS platform adaptation and operation;

[0012] S8: System operation and optimization: Use the statistical module to record data to find bottlenecks when the system is running, and integrate strategies to optimize system performance.

[0013] Preferably, the specific steps of configuring the system structure in S1 are as follows:

[0014] Step 1: Determine the interrupt classification type: clearly set high-frequency interrupts as level 1 interrupts to directly handle hardware interrupt events; at the same time, set level 2 interrupts to be executed by RTOS threads or soft interrupt mechanisms as background processing modules;

[0015] Step 2: Configure the interrupt execution subject: Complete the settings of the first-level interrupt and second-level interrupt execution mode, ensuring that the first-level interrupt directly responds to the hardware and the second-level interrupt runs through the RTOS thread or soft interrupt mechanism;

[0016] Step 3: Set interrupt priority: Configure the highest priority for the first-level interrupt, second only to the non-maskable interrupt, and set the priority of the second-level soft interrupt task to be higher than the normal thread and lower than the critical real-time thread.

[0017] Preferably, the key data structure design and initialization in S2 refers to the need to carefully design and initialize a lock-free ring buffer based on an array structure when building a low-latency processing system with RTOS interrupt decoupling and buffer drive; by setting pointers and data counters, non-blocking writing and reading of data can be achieved, and a buffer full and empty status detection mechanism is configured.

[0018] Preferably, the hardware interrupt processing setting in S3 refers to the fact that the hardware-level configuration is crucial in the low-latency processing system of RTOS interrupt decoupling and buffer-driven. On the one hand, by supporting interrupt priority configuration, the first-level interrupt corresponding to the high-frequency ISR is set to a high priority to ensure that the hardware interrupt event can be responded to quickly, reduce processing delays, and improve system real-time performance. On the other hand, with the help of function pointers, all first-level ISR functions are registered to the hardware HAL layer to unify the hardware interrupt response entry.

[0019] Preferably, the specific steps for implementing the software interrupt task in S4 are as follows:

[0020] Step 1: Thread priority setting: Design a software interrupt handling thread in the RTOS and set its priority to be lower than the first-level interrupt but maintain a high priority;

[0021] Step 2: Processing logic writing: Write the thread processing logic, including reading data in batches from the ring buffer, calling user functions, clearing the buffer, and recording statistical information;

[0022] Step 3: Thread start and stop implementation: Use the standard API provided by RTOS to start and suspend the software interrupt processing thread.

[0023] Preferably, the specific steps of interrupt shielding and critical section management setting in S5 are as follows:

[0024] Step 1: Select a critical section management strategy: Choose from lightweight critical section management strategies based on the specific needs and performance requirements of the system. For extremely short operations, use a method that wraps head and tail pointer operations with [disable interrupts] / [enable interrupts]. This method can prevent other interrupts from interfering in a short period of time and ensure the atomicity of pointer operations. For relatively complex operations, use the mutex mechanism provided by the RTOS.

[0025] Step 2: Implement critical section management: After selecting the strategy, implement it in the relevant code part of the first-level ISR write buffer; using [disable interrupt] / [enable interrupt] package, it is necessary to accurately determine the code range of the head and tail pointer operations, and package very short operations to avoid long-term interrupt disabling affecting system response; using the mutex mechanism, it is necessary to correctly call the mutex API provided by the RTOS, obtain the mutex before entering the critical section, and release the mutex after the operation is completed.

[0026] Preferably, the hardware and software collaborative configuration in S6 refers to the need to reasonably configure low-priority background threads in RTOS system optimization, prevent them from preempting high-real-time tasks through priority setting, and ensure the timely execution of key tasks; at the same time, determine the software interrupt triggering method based on actual needs, flexibly select event groups, message queues or direct task wake-up methods to ensure that interrupt signals can be efficiently transmitted, realize timely data processing and reasonable scheduling of system resources.

[0027] Preferably, the cross-platform adaptation in S7 refers to unifying the hardware interrupt response with the help of the HAL layer interrupt processing interface when facing different architectures such as ARMCortex-M / R, RISC-V, and DSP, as well as various RTOSs such as FreeRTOS, uC / OSII, and RT-Thread, using the soft interrupt scheduler module to encapsulate the trigger logic and notification mechanism, adapting to different throughput scenarios through the universal buffer component, relying on the platform transplantation adaptation layer to be compatible with task management and kernel synchronization mechanism, completing the cross-platform adaptation of the system in all aspects, and ensuring that the interrupt decoupling and buffer-driven low-latency processing mechanism run stably and efficiently in a diverse environment.

[0028] Preferably, the specific steps for operating and optimizing the system in S8 are as follows:

[0029] Step 1: Operational data recording: When the system is running, the statistics module is introduced to continuously record key operational data such as interrupt response time, number of context switches, and buffer usage;

[0030] Step 2: Performance bottleneck analysis: Analyze the recorded operating data offline to identify the system's performance bottlenecks and identify the specific links that need to be optimized.

[0031] Step 3: Optimization strategy integration: Based on the performance analysis results, the existing optimization strategies of interrupt shared DMA, task priority improvement strategy, and energy-saving scheduling algorithm are integrated and applied to further improve system performance.

[0032] Preferably, the RTOS is primarily used in industrial automation, automotive electronics, aerospace, medical equipment, and consumer electronics.

[0033] The beneficial effects of the present invention are as follows:

[0034] 1. This invention achieves a breakthrough improvement in the real-time responsiveness of embedded systems through an innovative interrupt-level separation mechanism, combined with intelligent buffer management and dynamic triggering strategies. This solution decouples traditional interrupt processing into a minimalist hardware response layer and an efficient background processing layer, reducing the immediate response latency of high-frequency events (such as sensor sampling and communication protocol parsing) by over 60%. A batch processing mechanism also reduces context switching overhead by 90%, significantly optimizing CPU utilization. Experimental data shows that on a 100MHz MCU platform, system throughput increases by three times, with interrupt service latency jitter controlled to less than 2μs. This makes it particularly suitable for scenarios with stringent real-time requirements, such as industrial control and automotive electronics. This solution achieves seamless portability across ARM Cortex-M / R, RISC-V, and DSP architectures through HAL layer abstraction and RTOS-independent design. Developers only need to configure trigger thresholds and buffer parameters to complete adaptation, significantly shortening product time-to-market. A supporting statistical monitoring module captures key metrics such as interrupt response time and context switching frequency in real time, providing a quantitative basis for system tuning and forming a complete performance optimization loop from hardware interrupts to the application layer.

[0035] 2. The present invention achieves a leap forward in embedded system performance through the proposed RTOS interrupt decoupling and buffer-driven low-latency processing method, an innovative interrupt hierarchical processing mechanism and intelligent buffer management. Its core advantages are: a real-time breakthrough, by decoupling high-frequency interrupts into a minimalist hardware response layer and an efficient background processing layer, the interrupt response latency is reduced by more than 60%, and the system throughput is increased by 3 times, making it perfectly suitable for scenarios with strict real-time requirements such as industrial control and automotive electronics; a resource efficiency revolution, by adopting a lock-free ring buffer and batch processing mechanism, reducing context switching overhead by 90%, significantly optimizing CPU utilization, reducing power consumption by 58% in typical scenarios, and extending the battery life of battery-powered devices by 220%; enhanced system stability, hardware-level interrupt priority configuration and dynamic priority adjustment technology, reducing the probability of interruption of critical tasks by 85%, and achieving a fault injection test pass rate of 99.7%, meeting functional safety standards; development and portability friendly, by achieving cross-ARM With seamless porting of Cortex-M / R, RISC-V, and DSP architectures, developers only need to configure trigger thresholds and buffer parameters to complete adaptation, shortening product launch cycles by 40%. With an intelligent closed-loop optimization system, the accompanying statistical monitoring module can capture key indicators in real time, providing a quantitative basis for integrated DMA collaboration, energy-saving scheduling, and other strategies, forming a complete performance optimization ecosystem from hardware interrupts to the application layer. BRIEF DESCRIPTION OF THE DRAWINGS

[0036] Figure 1 This is a logic flow chart of the processing method of the present invention;

[0037] Figure 2 Schematic diagram of the overall process of the treatment method of the present invention. DETAILED DESCRIPTION

[0038] The following will clearly and completely describe the technical solutions in the embodiments of the present invention in conjunction with the accompanying drawings. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts are within the scope of protection of the present invention.

[0039] like Figures 1 to 2 As shown, an embodiment of the present invention provides a method for low-latency processing of RTOS interrupt decoupling and buffer drive, and the specific steps of using the method are as follows:

[0040] S1: System structure configuration: Level 1 interrupt has the highest priority response to hardware, and Level 2 interrupt RTOS / soft interrupt has a higher priority than ordinary threads and lower than critical real-time tasks;

[0041] S2: Design and initialization of key data structures: Design and initialize a lock-free ring buffer, set up read and write mechanisms and detection, and determine interrupt triggering strategies and parameters based on the scenario;

[0042] S3: Hardware interrupt processing settings: Configure the hardware interrupt priority, set the high-frequency ISR level 1 interrupt as high priority, and register a unified entry with a function pointer;

[0043] S4: Software interrupt task implementation: RTOS designs a high-priority software interrupt thread, writes processing logic, and uses standard APIs to start and stop the thread;

[0044] S5: Interrupt masking and critical section management settings: Use lightweight critical section management, and use interrupt disabling or mutex mechanisms to ensure the safety of the first-level ISR write buffer;

[0045] S6: Software and hardware coordination configuration: Configure low-priority background threads in the RTOS to prevent preemption and select appropriate methods to trigger software interrupts;

[0046] S7: Cross-platform adaptation: Utilize components and modules such as the HAL interface to complete the system's cross-architecture and RTOS platform adaptation and operation;

[0047] S8: System operation and optimization: Use the statistical module to record data to find bottlenecks when the system is running, and integrate strategies to optimize system performance.

[0048] Example 1: Optimization of real-time data acquisition in industrial automation control systems

[0049] Scenario description:

[0050] In smart factory PLC control systems, data from 128 sensors must be collected in real time (at a sampling frequency of 1kHz) and rapidly filtered and detected. Traditional solutions, due to frequent interrupts, incur context switching overhead exceeding 30%, and control command response delays exceeding 50μs.

[0051] Application of technical solutions:

[0052] Interrupt classification configuration:

[0053] Set the ADC sampling completion interrupt to a level 1 interrupt (Cortex-M4 core priority 3) and only execute the data writing operation of the ring buffer.

[0054] The secondary processing thread (priority 2) triggers a soft interrupt every time 64 sampling points are accumulated to perform FFT transformation and threshold comparison.

[0055] Double buffering mechanism implementation:

[0056] It adopts a dual-ring buffer alternating working mode, and automatically switches to the backup buffer when the main buffer is full to avoid data overwriting.

[0057] Configure the buffer overflow flag to trigger emergency processing when data backlog exceeds 10ms.

[0058] DMA collaborative optimization:

[0059] The first-level ISR only enables the DMA controller to complete the ADC data transfer and is only responsible for updating the buffer pointer.

[0060] Experimental data shows that the execution time of a single ISR is compressed from 8.2μs to 1.7μs, and the CPU load is reduced by 78%.

[0061] Result:

[0062] The control command response delay is reduced to less than 8μs, meeting the real-time requirements of IEC 61131-2.

[0063] The system failure false alarm rate dropped by 92%, and production line downtime was reduced by 65%.

[0064] The specific steps of the system structure configuration in S1 are as follows:

[0065] Step 1: Determine the interrupt classification type: clearly set high-frequency interrupts as level 1 interrupts to directly handle hardware interrupt events; at the same time, set level 2 interrupts to be executed by RTOS threads or soft interrupt mechanisms as background processing modules;

[0066] Step 2: Configure the interrupt execution subject: Complete the settings of the first-level interrupt and second-level interrupt execution mode, ensuring that the first-level interrupt directly responds to the hardware and the second-level interrupt runs through the RTOS thread or soft interrupt mechanism;

[0067] Step 3: Set interrupt priority: Configure the highest priority for the first-level interrupt, second only to the non-maskable interrupt, and set the priority of the second-level soft interrupt task to be higher than the normal thread and lower than the critical real-time thread.

[0068] System architecture configuration offers significant advantages by clearly defining interrupt hierarchies, execution entities, and priorities. Setting high-frequency interrupts as level-one interrupts allows for rapid response to hardware events and reduces latency. Level-two interrupts, handled by RTOS threads, enable asynchronous execution of complex tasks, improving processing efficiency. Proper priority settings ensure timely response to critical interrupts while preventing background tasks from preempting important resources. This optimizes system resource allocation, effectively improving overall responsiveness, and enhancing system stability and reliability to meet the demands of high-concurrency, real-time applications.

[0069] Example 2: Anti-interference processing of satellite communication terminal

[0070] Scenario description:

[0071] Low-orbit satellite communication terminals need to stably receive burst data packets (packet length 128-1024 bytes) in a strong electromagnetic interference environment. Traditional solutions cause data loss rates as high as 15% due to interruption storms.

[0072] Application of technical solutions:

[0073] Dynamic priority adjustment:

[0074] Dynamically adjust the secondary processing thread priority based on the signal-to-noise ratio (SNR):

[0075] When SNR>20dB: Priority 5 (normal task).

[0076] When SNR<10dB: promoted to priority 1 (second only to the watchdog timer).

[0077] Adaptive buffer management:

[0078] A dynamically expanding ring buffer is used with an initial capacity of 4KB, which automatically expands to 32KB when interference is detected.

[0079] Configure the preamble detection mechanism to trigger secondary processing only when a valid SYNC field is received.

[0080] Forward Error Correction Integration:

[0081] Integrate a Reed-Solomon decoder in the secondary processing stage to improve decoding efficiency by taking advantage of batch data processing.

[0082] Experimental data shows that data throughput is increased by 3.2 times under the same channel conditions.

[0083] Result:

[0084] The data loss rate is reduced to below 0.3%, meeting the CCSDS132.0-B-2 radiation resistance standard.

[0085] The satellite-to-ground link duration was extended to 47 minutes (an increase of 220%).

[0086] Among them, the design and initialization of the key data structure in S2 refers to the need to carefully design and initialize a lock-free circular buffer based on an array structure when building a low-latency processing system with RTOS interrupt decoupling and buffer drive; by setting pointers and data counters, non-blocking writing and reading of data can be achieved, and at the same time, a buffer full and empty state detection mechanism is configured to effectively avoid data loss and invalid reading; in addition, based on the actual application scenario, the interrupt trigger control logic should be reasonably determined, and strategies such as counter threshold triggering, time window triggering or conditional composite triggering should be flexibly selected, and the corresponding parameter settings should be completed to ensure efficient and stable operation of the system.

[0087] The design and initialization of key data structures are crucial for RTOS interrupt decoupling and low-latency processing. A lockless ring buffer enables non-blocking data reading and writing, and combined with full-empty status detection, it prevents data loss and misreading, ensuring data transmission integrity. Flexible interrupt trigger control logic precisely selects trigger strategies and sets parameters based on different scenarios, enabling optimal control of interrupt traffic, reducing system processing pressure and optimizing resource utilization. This significantly improves system stability and processing efficiency, ensuring low latency is achieved.

[0088] The hardware interrupt handling settings in S3 refer to the crucial hardware-level configuration in the low-latency processing system of RTOS interrupt decoupling and buffer-driven processing. On the one hand, by supporting interrupt priority configuration, the first-level interrupt corresponding to high-frequency ISRs is set to a high priority, ensuring that hardware interrupt events can be responded to quickly, reducing processing delays and improving system real-time performance. On the other hand, all first-level ISR functions are registered to the hardware HAL layer with the help of function pointers, unifying the hardware interrupt response entry. This approach not only enhances the standardization and maintainability of the code, but also effectively isolates hardware differences, facilitating the porting and adaptation of the system between different hardware platforms.

[0089] The specific steps for implementing the software interrupt task in S4 are as follows:

[0090] Step 1: Thread priority setting: Design a software interrupt handling thread in the RTOS and set its priority to be lower than the first-level interrupt but maintain a high priority;

[0091] Step 2: Processing logic writing: Write the thread processing logic, including reading data in batches from the ring buffer, calling user functions, clearing the buffer, and recording statistical information;

[0092] Step 3: Thread start and stop implementation: Use the standard API provided by RTOS to start and suspend the software interrupt processing thread.

[0093] Effective implementation of software interrupt tasks significantly improves RTOS system performance. Appropriate thread priority settings ensure that first-level interrupts are prioritized while enabling software interrupt threads to handle tasks promptly, ensuring system real-time performance. Comprehensive processing logic efficiently processes ring buffer data, calls user functions to implement customized functionality, clears the buffer to prevent data accumulation, and records statistical information for subsequent analysis. Thread start and stop are implemented using standard RTOS APIs, ensuring standardized operation, improving system stability and maintainability, and enhancing overall operational efficiency.

[0094] The specific steps of setting the interrupt shielding and critical section management in S5 are as follows:

[0095] Step 1: Select a critical section management strategy: Based on the specific needs and performance requirements of the system, choose an appropriate lightweight critical section management strategy. For extremely short operations, use a [disable interrupt] / [enable interrupt] wrapper for head and tail pointer operations. This method can prevent other interrupt interference within a short period of time and ensure the atomicity of pointer operations. For relatively complex operations, use the mutex mechanism provided by the RTOS, which can ensure thread safety in more complex operation scenarios.

[0096] Step 2: Implement critical section management: After selecting the strategy, implement it in the relevant code part of the first-level ISR write buffer; use [disable interrupt] / [enable interrupt] package, accurately determine the code range of the head and tail pointer operations, and only package very short operations to avoid long-term interrupt disabling affecting system response; if using the mutex mechanism, correctly call the mutex API provided by the RTOS, obtain the mutex before entering the critical section, and release the mutex after the operation is completed, thereby ensuring the thread safety of the first-level ISR write buffer process.

[0097] Among them, the hardware and software collaborative configuration in S6 refers to the need to reasonably configure low-priority background threads in RTOS system optimization, prevent them from preempting high-real-time tasks through priority setting, and ensure the timely execution of key tasks; at the same time, determine the software interrupt triggering method based on actual needs, and flexibly select event groups, message queues or direct task wake-up methods to ensure that interrupt signals can be efficiently transmitted, realize timely data processing and reasonable scheduling of system resources.

[0098] Among them, the cross-platform adaptation in S7 refers to the use of the HAL layer interrupt processing interface to unify the hardware interrupt response when facing different architectures such as ARMCortex-M / R, RISC-V, DSP, and various RTOS such as FreeRTOS, uC / OSII, RT-Thread, etc., and the use of the soft interrupt scheduler module to encapsulate the trigger logic and notification mechanism. The universal buffer component is used to adapt to different throughput scenarios. The platform transplantation adaptation layer is compatible with task management and kernel synchronization mechanisms to complete the cross-platform adaptation of the system in all aspects, ensuring that the interrupt decoupling and buffer-driven low-latency processing mechanism can run stably and efficiently in a diverse environment.

[0099] The specific steps for operating and optimizing the system in S8 are as follows:

[0100] Step 1: Operational data recording: When the system is running, the introduced statistics module is used to continuously record key operational data such as interrupt response time, number of context switches, and buffer usage;

[0101] Step 2: Performance bottleneck analysis: Analyze the recorded operating data offline to identify the system's performance bottlenecks and identify the specific links that need to be optimized.

[0102] Step 3: Optimization strategy integration: Based on the performance analysis results, existing optimization strategies such as interrupt-sharing DMA, task priority improvement strategy, and energy-saving scheduling algorithm are integrated and applied to further improve system performance.

[0103] These three steps provide a scientific and efficient solution for optimizing system performance. Operational data logging comprehensively and continuously captures key system operation indicators, providing detailed data support for subsequent analysis. Performance bottleneck analysis, based on this data, accurately locates weak links in system operation, avoids blind optimization, and improves the targetedness and efficiency of optimization. Based on the analysis results, optimization strategy integration organically integrates mature optimization strategies with the system. For example, this involves reducing interrupt processing time through interrupt-sharing DMA, ensuring the execution of critical tasks through task priority enhancement strategies, and reducing energy consumption with the help of energy-saving scheduling algorithms. Ultimately, this improves system performance in all aspects, ensuring efficient, stable, and energy-efficient operation.

[0104] Among them, this RTOS is mainly used in industrial automation, automotive electronics, aerospace, medical equipment and consumer electronics.

[0105] Industrial Automation

[0106] Industrial robots: Their control systems must process massive amounts of sensor data and execute complex actions in real time. RTOS interrupt decoupling and buffer-driven low-latency processing ensure rapid robot response to external signals. For example, when a visual sensor detects a change in the target object's position, the robot's arm's movements can be quickly adjusted, improving production efficiency and accuracy.

[0107] Automated production lines: Automated production lines involve the coordinated operation of numerous devices, such as conveyor belts, sorting machines, and processing equipment. Low-latency processing technology can ensure communication and synchronization between these devices, reducing delays in the production process and improving the overall operational efficiency and stability of the production line.

[0108] Automotive Electronics

[0109] Autonomous driving systems: Autonomous vehicles require real-time processing of data from multiple sensors, including lidar, cameras, and millimeter-wave radar, to make accurate decisions. Low-latency interrupt processing and data buffering ensure the system can respond promptly to unexpected situations, such as the sudden appearance of an obstacle ahead, allowing for rapid braking or evasive maneuvers to ensure safe driving.

[0110] Engine control systems: These systems precisely control parameters such as fuel injection and ignition timing to improve engine performance and fuel economy. Low-latency processing technology enables real-time acquisition of engine operating status data and rapid adjustments to control strategies, ensuring the engine maintains optimal operating conditions.

[0111] Aerospace

[0112] Aircraft flight control systems: Aircraft flight control systems have extremely high real-time requirements, requiring rapid response to signals from various flight attitude sensors to ensure stable flight. Low-latency processing technology ensures that the system can process large amounts of sensor data in a very short time, allowing for timely adjustments to parameters such as the aircraft's control surfaces and engine thrust, improving flight safety and controllability.

[0113] Satellite communication systems: Satellite communication systems require high-speed, stable data transmission in complex space environments. RTOS interrupt decoupling and buffer-driven low-latency processing technology can effectively reduce data transmission delays, improve communication quality and reliability, and ensure smooth communication between satellites and ground stations.

[0114] medical devices

[0115] Medical monitoring devices, such as electrocardiographs, blood pressure monitors, and blood glucose meters, must collect and process patients' physiological data in real time and transmit it promptly to a monitoring center. Low-latency processing technology ensures the real-time and accuracy of this data, enabling doctors to promptly understand changes in patients' conditions and make accurate diagnostic and treatment decisions.

[0116] Surgical robots: During surgery, surgical robots require precise control of the movements of their robotic arms to perform operations on patients. Low-latency processing technology ensures that surgical robots can quickly respond to the doctor's instructions, improving surgical accuracy and safety.

[0117] Consumer Electronics

[0118] Smartphones: Smartphones need to process data from various sensors, such as accelerometers, gyroscopes, and cameras, to enable functions such as screen rotation, photography, and gaming. Low-latency processing technology can improve the phone's responsiveness and user experience, making phone operation smoother.

[0119] Smart home devices: Various devices in a smart home system, such as smart door locks, smart cameras, and smart appliances, need to interact and communicate with users in real time. Low-latency processing technology ensures that smart home devices can quickly respond to user commands, enabling intelligent control.

[0120] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that includes a list of elements includes not only those elements but also other elements not explicitly listed, or elements inherent to such process, method, article, or apparatus.

[0121] While embodiments of the present invention have been shown and described, it will be appreciated by those skilled in the art that various changes, modifications, substitutions, and variations may be made to these embodiments without departing from the principles and spirit of the invention, and that the scope of the invention is defined by the appended claims and their equivalents.

Claims

1. A method for low-latency processing of RTOS interrupt decoupling and buffer-driven processing, characterized by: The specific steps of using this method are as follows: S1: System structure configuration: Level 1 interrupt has the highest priority response to hardware, and Level 2 interrupt RTOS / soft interrupt has a higher priority than ordinary threads and lower than critical real-time tasks; S2: Design and initialization of key data structures: Design and initialize a lock-free ring buffer, set up read and write mechanisms and detection, and determine interrupt triggering strategies and parameters based on the scenario; S3: Hardware interrupt processing settings: Configure the hardware interrupt priority, set the high-frequency ISR level 1 interrupt as high priority, and register a unified entry with a function pointer; S4: Software interrupt task implementation: RTOS designs a high-priority software interrupt thread, writes processing logic, and uses standard API to start and stop the thread; S5: Interrupt masking and critical section management settings: Use lightweight critical section management, and use interrupt disabling or mutex mechanisms to ensure the safety of the first-level ISR write buffer; S6: Software and hardware coordination configuration: Configure low-priority background threads in the RTOS to prevent preemption and select appropriate methods to trigger software interrupts; S7: Cross-platform adaptation: Utilize HAL interface components and modules to complete the system's cross-architecture and RTOS platform adaptation and operation; S8: System operation and optimization: Use the statistical module to record data to find bottlenecks when the system is running, and integrate strategies to optimize system performance.

2. The method for low-latency processing of RTOS interrupt decoupling and buffer-driven according to claim 1, characterized in that: The specific steps of the system structure configuration in S1 are as follows: Step 1: Determine the interrupt classification type: clearly set high-frequency interrupts as level 1 interrupts to directly handle hardware interrupt events; at the same time, set level 2 interrupts to be executed by RTOS threads or soft interrupt mechanisms as background processing modules; Step 2: Configure the interrupt execution subject: Complete the settings of the first-level interrupt and second-level interrupt execution mode, ensuring that the first-level interrupt directly responds to the hardware and the second-level interrupt runs through the RTOS thread or soft interrupt mechanism; Step 3: Set interrupt priority: Configure the highest priority for the first-level interrupt, second only to the non-maskable interrupt, and set the priority of the second-level soft interrupt task to be higher than the normal thread and lower than the critical real-time thread.

3. The method for low-latency processing of RTOS interrupt decoupling and buffer-driven according to claim 1, characterized in that: The key data structure design and initialization in S2 refers to the need to carefully design and initialize a lock-free ring buffer based on an array structure when building a low-latency processing system with RTOS interrupt decoupling and buffer drive; by setting pointers and data counters, non-blocking writing and reading of data can be achieved, and a buffer full and empty status detection mechanism can be configured.

4. The method for low-latency processing of RTOS interrupt decoupling and buffer-driven according to claim 1, characterized in that: The hardware interrupt processing setting in S3 refers to the fact that the hardware-level configuration is crucial in the low-latency processing system of RTOS interrupt decoupling and buffer-driven. On the one hand, by supporting interrupt priority configuration, the first-level interrupt corresponding to high-frequency ISR is set to high priority, ensuring that hardware interrupt events can be responded to quickly, reducing processing delays and improving system real-time performance. On the other hand, with the help of function pointers, all first-level ISR functions are registered to the hardware HAL layer to unify the hardware interrupt response entry.

5. The method for low-latency processing of RTOS interrupt decoupling and buffer-driven according to claim 1, characterized in that: The specific steps for implementing the software interrupt task in S4 are as follows: Step 1: Thread priority setting: Design a software interrupt handling thread in the RTOS and set its priority to be lower than the first-level interrupt but maintain a high priority; Step 2: Processing logic writing: Write the thread processing logic, including reading data in batches from the ring buffer, calling user functions, clearing the buffer, and recording statistical information; Step 3: Thread start and stop implementation: Use the standard API provided by RTOS to start and suspend the software interrupt processing thread.

6. The method for low-latency processing of RTOS interrupt decoupling and buffer-driven according to claim 1, characterized in that: The specific steps for setting the interrupt mask and critical section management in S5 are as follows: Step 1: Select a critical section management strategy: Choose from lightweight critical section management strategies based on the specific needs and performance requirements of the system. For extremely short operations, use a method that wraps head and tail pointer operations with [disable interrupts] / [enable interrupts]. This method can prevent other interrupts from interfering in a short period of time and ensure the atomicity of pointer operations. For relatively complex operations, use the mutex mechanism provided by the RTOS. Step 2: Implement critical section management: After selecting the strategy, implement it in the relevant code part of the first-level ISR write buffer; using [disable interrupt] / [enable interrupt] package, it is necessary to accurately determine the code range of the head and tail pointer operations, and package very short operations to avoid long-term interrupt disabling affecting system response; using the mutex mechanism, it is necessary to correctly call the mutex API provided by the RTOS, obtain the mutex before entering the critical section, and release the mutex after the operation is completed.

7. The method for low-latency processing of RTOS interrupt decoupling and buffer-driven according to claim 1, characterized in that: The hardware and software collaborative configuration in S6 refers to the need to reasonably configure low-priority background threads in RTOS system optimization, prevent them from preempting high-real-time tasks through priority setting, and ensure the timely execution of critical tasks; at the same time, determine the software interrupt triggering method based on actual needs, and flexibly select event groups, message queues or direct task wake-up methods to ensure that interrupt signals can be efficiently transmitted, realize timely data processing and reasonable scheduling of system resources.

8. The method for low-latency processing of RTOS interrupt decoupling and buffer-driven according to claim 1, characterized in that: The cross-platform adaptation in S7 refers to the use of the HAL layer interrupt processing interface to unify hardware interrupt responses when facing different architectures such as ARMCortex-M / R, RISC-V, and DSP, as well as various RTOSs such as FreeRTOS, uC / OSII, and RT-Thread. The trigger logic and notification mechanism are encapsulated using the soft interrupt scheduler module, and different throughput scenarios are adapted through the universal buffer component. The platform transplantation adaptation layer is compatible with task management and kernel synchronization mechanisms to complete the cross-platform adaptation of the system in all aspects, ensuring that the interrupt decoupling and buffer-driven low-latency processing mechanism run stably and efficiently in a diverse environment.

9. The method for low-latency processing of RTOS interrupt decoupling and buffer-driven according to claim 1, characterized in that: The specific steps for operating and optimizing the system in S8 are as follows: Step 1: Operational data recording: When the system is running, the statistics module is introduced to continuously record key operational data such as interrupt response time, number of context switches, and buffer usage; Step 2: Performance bottleneck analysis: Analyze the recorded operating data offline to identify the system's performance bottlenecks and identify the specific links that need to be optimized. Step 3: Optimization strategy integration: Based on the performance analysis results, the existing optimization strategies of interrupt shared DMA, task priority improvement strategy, and energy-saving scheduling algorithm are integrated and applied to further improve system performance.

10. An application of RTOS interrupt decoupling and buffer-driven low-latency processing, characterized by: This RTOS is primarily used in industrial automation, automotive electronics, aerospace, medical equipment, and consumer electronics.