Data storage optimization method and system based on real-time operating system

Through a multi-level buffering architecture and a dynamic capacity adjustment strategy driven by machine learning, the performance bottleneck of data storage in RTOS is solved, efficient data storage and real-time response are achieved, and the overall performance and resource utilization of the system are improved.

CN120508408AActive Publication Date: 2025-08-19CHINA JILIANG UNIV
View PDF 17 Cites 0 Cited by

Patent Information

Application Number
CN202511007767.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-07-22
Publication Date
2025-08-19
Estimated Expiration
2045-07-22

AI Technical Summary

Technical Problem

Traditional real-time operating systems (RTOS) have problems such as insufficient matching of storage levels and data characteristics, limited performance and unbalanced resource allocation in terms of data storage, resulting in loss of key data, poor storage performance and insufficient real-time response capabilities.

Method used

Using a multi-level collaborative data buffering architecture, event-driven task scheduling mechanism and dynamic capacity regulating strategy based on machine learning, data storage is optimized through multi-level buffer physical isolation of data, event-driven scheduling and intelligent prediction traffic.

Benefits of technology

It realizes priority transmission and storage of high-value data, improves the system's throughput capability and real-time responsiveness, optimizes resource utilization efficiency, and solves the bottleneck problem of traditional RTOS in data storage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120508408A_ABST
    Figure CN120508408A_ABST
Patent Text Reader

Abstract

The invention belongs to the field of computer system architecture, and discloses a data storage optimization method and system based on a real-time operating system, and the method comprises the steps: carrying out the hierarchical storage of task data through a data buffer module adopting a multi-stage buffer architecture; dynamically scheduling the storage tasks by adopting a task scheduling module of an event-driven mechanism; a future data flow mode is predicted based on a dynamic capacity adjusting module of a machine learning model, so that the capacity of each buffer area is actively and cooperatively adjusted; and finally, realizing high-efficiency persistence of the data in a ping-pong buffer writing mode. Through a multi-module collaborative innovative architecture, the problem of storage performance bottleneck possibly existing in some real-time systems is effectively solved, and the throughput capacity, the real-time responsiveness and the resource utilization efficiency of the system are remarkably improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of computer system architecture, and in particular relates to an optimization technology for achieving high-throughput, low-latency data storage in a real-time operating system (RTOS). Background Art

[0002] As the application scale of real-time systems, such as those in industrial control, aerospace, and autonomous driving, continues to expand, the rate of data generation within the system is growing exponentially, which puts increasingly stringent requirements on the end-to-end determinism and real-time performance of data storage.

[0003] However, in some application scenarios, traditional real-time operating system (RTOS) data storage architecture may exhibit limitations in addressing such challenges in the following aspects: First, the storage hierarchy is not well-matched to data characteristics. Traditional real-time operating systems typically use a single, static buffering mechanism for data caching, failing to effectively distinguish between data types with different priorities and timeliness. This results in high-value, critical data, such as control instructions, being mixed with less time-sensitive, general data, such as log files, stored in the same path. When the system faces bursty data traffic, critical data is very likely to overflow and be lost due to buffer overflow with low-priority data, seriously impacting system reliability and security.

[0004] Secondly, the actual performance of data storage is limited. Although modern storage hardware such as solid-state drives (SSDs) and high-speed interconnect technologies such as PCIe offer extremely low latency and extremely high throughput, the storage protocol stack and data management mechanisms of traditional real-time operating systems (RTOSs) have inherent performance bottlenecks. During the data write process, from the application to the OS kernel and then to the storage driver, data often undergoes multiple memory copies, significantly reducing the access efficiency of storage devices and leaving them far below the theoretical performance limit of the hardware. Furthermore, data storage still relies on traditional protocol stack transmission modes. The additional operating system overhead prevents the low-latency advantages of high-speed interconnects from being fully utilized at the application layer, thus affecting the overall real-time performance of the system.

[0005] Finally, there is a lack of flexible resource allocation capabilities under dynamic load scenarios. Traditional real-time operating systems mostly adopt static resource allocation strategies, which cannot flexibly adjust the ratio of computing and storage resources according to the dynamic changes in storage load. The fixed task binding method may cause some CPU cores to be idle and some cores to be overloaded, resulting in uneven resource utilization. At the same time, low-priority tasks may occupy I / O channels for a long time, causing high-priority tasks to miss their execution deadlines, seriously affecting the real-time response capabilities of storage tasks. The present invention solves this problem by using a dynamic capacity adjustment mechanism driven by machine learning to complete buffer expansion before data arrives.

[0006] Therefore, how to design a new data storage architecture to optimize the data storage path and improve the overall storage performance of the real-time system is a technical problem that needs to be solved urgently in the current field of computer system technology. Summary of the Invention

[0007] To address the aforementioned issues in the existing technology, this paper addresses the performance bottleneck of data storage in real-time operating systems by proposing a multi-level collaborative, dynamically adaptive storage optimization method and system. This paper aims to comprehensively improve data storage throughput, real-time responsiveness, and resource utilization efficiency through an innovative buffer hierarchy design, an efficient task scheduling mechanism, and an intelligent dynamic capacity adjustment strategy.

[0008] To achieve the above object, the present invention provides the following technical solutions: A data storage optimization system based on a real-time operating system. The implementation architecture of the system includes: a data buffer module, a task scheduling module, a dynamic capacity adjustment module, a data storage module and a system self-checking module.

[0009] Data is transmitted through a high-speed transmission channel such as PCIe or 10 Gigabit Ethernet and is cached in a data buffer module.

[0010] The data buffer module adopts a multi-level ring buffer architecture. According to the data type extracted when receiving data and preset rules, it generates task data of different priorities and distributes them to buffers of different priorities.

[0011] The task scheduling module uses an event-driven mechanism to dynamically control task execution and data storage based on task data type and external instructions. The dynamic capacity adjustment module adjusts buffer capacity in real time through pipeline communication, automatically triggering expansion or contraction strategies based on dynamic changes in data flow.

[0012] The data storage module is responsible for writing the processed data to the disk and adopts a ping-pong buffer writing method to improve the efficiency of data storage and reduce disk writing latency.

[0013] A key aspect of this invention lies in the dynamic capacity adjustment module's use of machine learning to predict traffic inflection points. Experiments have shown that this mechanism improves data throughput by 300% under burst traffic conditions, while reducing buffer expansion latency to less than 2ms compared to traditional dynamic capacity adjustment methods. This provides strong technical support for the claimed "real-time coordinated adjustment."

[0014] Compared with the prior art, the present invention has the following beneficial effects: 1. The present invention uses a dynamic multi-level buffer classification strategy to physically isolate and differentiate data of different priorities, ensuring the priority transmission and storage of high-value data such as control instructions, and fundamentally avoiding the risk of loss of critical data.

[0015] 2. This invention breaks through the performance bottleneck of traditional single-level buffering and adopts an event-driven mechanism to achieve efficient data processing. The high-speed carrying capacity of the L0-level lock-free buffer combined with deadline-driven scheduling ensures that the system can respond to external instructions or data volume triggering events in real time, meeting stringent real-time requirements.

[0016] 3. This invention innovatively employs an intelligent capacity adjustment mechanism based on machine learning. The system accurately identifies data traffic patterns and automatically expands the buffer before traffic bursts, improving data throughput. During periods of low load, redundant resources are dynamically released, enabling efficient management of storage space and ensuring optimal system performance under all load conditions. BRIEF DESCRIPTION OF THE DRAWINGS

[0017] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following briefly introduces the drawings required for describing the embodiments.

[0018] Figure 1 A structural block diagram of a data storage optimization system based on a real-time operating system provided by an embodiment of the present invention; Figure 2 A schematic diagram of the internal structure of a data buffer module provided in an embodiment of the present invention; Figure 3 A schematic diagram of the workflow of the task scheduling module provided in an embodiment of the present invention; Figure 4 A schematic diagram of a dynamic capacity adjustment process based on machine learning is provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0019] 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 some embodiments of the present invention, not all 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.

[0020] See also Figure 1 As shown, the present invention provides a data storage optimization system based on a real-time operating system. The system receives task data from one or more data sources and transmits the data to a data buffer module via a high-speed transmission channel such as PCIe3.0 or 10 Gigabit Ethernet.

[0021] The data buffer module is the core hub of the entire system. It interacts with the task scheduling module, dynamic capacity adjustment module, data storage module and optional system self-check module to collaboratively optimize data storage.

[0022] See also Figure 2 As shown in Figure 1, the module innovatively adopts a multi-level buffer hierarchy architecture. The data buffer module receives the expansion or contraction instructions issued by the dynamic capacity adjustment module through a dedicated instruction interface. The interaction channel here can be referred to Figure 2 The connection relationship between the dynamic capacity adjustment module and the data buffer module.

[0023] In a preferred embodiment, the interface uses a named pipe (FIFO) that follows the first-in-first-out principle to achieve millisecond-level command transmission. The system automatically distributes received task data to different levels of buffers based on the timeliness, urgency, and storage requirements of the data.

[0024] In a preferred embodiment, the structure can be specifically divided into three levels: L0 buffer: As a high-priority real-time buffer, it is mainly used to store urgent mission data, such as flight control instructions or high-frequency trading instructions, to ensure ultra-low latency transmission in microseconds.

[0025] To achieve this, the L0 cache uses a lock-free circular queue data structure, combined with hardware cache line alignment and hardware-level atomic operations to achieve conflict-free concurrent access in a multi-threaded environment. To ensure the atomicity of multi-threaded operations, a mechanism called "compare and swap" (CAS) is used to safely update the queue's head and tail pointers.

[0026] The details of its operation are as follows: When a thread performs an insert operation, it first reads the current tail pointer value as the expected value, then calculates the new tail pointer position, and finally atomically attempts to update the tail pointer through a CAS operation. The update succeeds only if the expected value matches the current value, meaning no other thread has modified the pointer in the meantime. Otherwise, the process is retried. Read operations also use a similar mechanism to update the head pointer.

[0027] This lock-free design avoids the context switching and performance overhead that may be caused by using traditional mutexes, thereby ensuring fast response and immediate processing of high-priority tasks.

[0028] L1 buffer: Serves as a medium-priority task buffer, used to store frequently used task data, such as periodic service requests or status updates of medium importance; the L1 buffer uses a priority-aware scheduling mechanism.

[0029] When performing scheduling, the mechanism will first check and process tasks in the L0 level buffer. Only when the higher priority queue is empty will the scheduling system process tasks in the L1 level buffer.

[0030] This preemptive processing logic ensures that high-priority data can be processed first while maintaining the overall throughput efficiency of the system.

[0031] L2 cache: As a low-priority persistent cache, it is mainly used to store data that does not require high timeliness but needs to be preserved for a long time, such as system operation logs and historical status records.

[0032] To improve storage efficiency and reduce CPU burden, the L2 cache can adopt zero-copy persistence technology to achieve efficient data writing through memory mapping (mmap), writing data directly from the kernel space buffer to the persistent storage medium, avoiding additional data copying between kernel space and user space.

[0033] See also Figure 3 As shown in the figure, the task scheduling module mainly relies on two triggering mechanisms, which together constitute an event-driven mechanism: the first is external command triggering. The system receives remote commands through TCP or UDP protocols and supports various control commands such as starting, pausing, terminating, and updating storage tasks. This mode has the highest priority; the second is data volume triggering. When the data volume in any buffer reaches a preset threshold, the system automatically triggers the data storage operation. This process does not require additional command intervention. Figure 3 As shown in the diamond judgment box "Data volume ≥ threshold?"

[0034] See also Figure 4 As shown, dynamic capacity adjustment module: This embodiment discloses a buffer dynamic capacity adjustment method based on machine learning, which is one of the core innovations of the present invention.

[0035] Machine learning model, in order to avoid the risk of "abstract algorithm", the prediction model in the present invention is specifically an embedded lightweight hybrid neural network, which is deployed in the kernel module of the real-time operating system or a tightly coupled user-mode service.

[0036] See also Figure 4 As shown in the figure, the prediction model specifically adopts a lightweight hybrid network structure, which organically combines multiple neural network components. Among them, the convolutional neural network (CNN) component is used to extract local spatial features in the data stream, the long short-term memory network (LSTM) component is used to capture its time series dependencies, and the Transformer component is responsible for processing long-distance traffic pattern dependencies.

[0037] The outputs of each component are fused through a fully connected layer to generate capacity adjustment instructions. This model receives specific physical quantities as input features, including the fill rate of each buffer level, the time interval between task arrivals, and the variance of packet sizes. Its output action is to generate specific capacity expansion or contraction instructions, such as instructing the L0 buffer to expand by 150% or instructing the L2 buffer to release 50% of memory.

[0038] In the execution link, the dynamic capacity adjustment module sends capacity adjustment instructions to the data buffer module in real time via the aforementioned pipeline communication method. In a preferred embodiment, the data structure of this instruction can include information such as the target buffer level (L0 / L1 / L2), the capacity adjustment ratio, and the effective timestamp. The effective timestamp can specifically be the start of the next scheduling period, for example.

[0039] Decision-making algorithm and process: Data collection. During system operation, key load indicators of the buffer are regularly collected, including L0 / L1 / L2 fill rate, task arrival frequency, packet size distribution, etc. Among them, the fill rate can be specifically a sampling window of 1ms.

[0040] Model prediction: The system inputs the collected feature information into the trained machine learning model at preset time intervals to predict the traffic trend in the future. The future period of time can be specifically 10ms, for example.

[0041] Scaling decision-making, in the scaling decision-making stage, that is, Figure 4 In the link indicated by the diamond judgment box in the flowchart, the system calculates the traffic fluctuation rate FR using the following formula (1). When FR is greater than the preset threshold, the expansion strategy is triggered.

[0042] (1) In this formula, represents the frequency of task arrival, represents the packet size distribution, Represents the overall buffer fill rate. It should be emphasized that the weight coefficients appearing in the formula, such as 、 etc., and can be configured as non-limiting example values such as 0.5 and 0.3. In practical applications, these parameters can be dynamically optimized through a system calibration module and do not constitute a limitation of the present invention.

[0043] Model optimization: The system continuously monitors the effectiveness of buffer adjustments and records actual load data. It dynamically assesses the current model's predictive performance by calculating key evaluation metrics such as mean absolute percentage error (MAPE) and coefficient of determination (R²). When the error exceeds a set threshold, the system triggers an online learning mechanism to iteratively optimize the model parameters.

[0044] Data storage module and system self-check module: The data storage module is responsible for writing the processed data to a persistent storage medium, such as a disk.

[0045] In a preferred embodiment, the module uses a ping-pong buffer write method, which is a technique for optimizing the data writing process by alternating between two or more buffers.

[0046] When data is written to the currently idle buffer A, the other buffer B can be used to read or wait for data at the same time. When buffer A is finished writing, the system switches roles and sets buffer B as the write buffer and buffer A as the read or standby buffer.

[0047] This cycle enables parallel execution of data writing and upstream data processing operations, improving data storage efficiency and reducing disk write latency.

[0048] The system self-check module is responsible for real-time monitoring of disk status, including remaining space, read and write health, etc. When insufficient disk space or anomalies are detected, the system can promptly trigger an alarm or adjust the storage policy to ensure the stability and reliability of data storage.

[0049] The above is a further detailed description of the present invention in conjunction with specific preferred embodiments, and the specific implementation of the present invention should not be considered to be limited to these descriptions. For those skilled in the art of the present invention, without departing from the concept of the present invention, several simple deductions or substitutions can be made, which should be considered to fall within the scope of protection of the present invention.

Claims

1. A data storage optimization method based on a real-time operating system, characterized in that: The following steps are involved: Step 1, data buffering: receiving task data through a data buffer module, wherein the data buffer module adopts a multi-level buffer architecture and distributes the task data to buffers of different priorities in the multi-level buffer architecture according to the preset type and priority of the task data; Step 2, task scheduling: through the task scheduling module, using an event-driven mechanism, dynamically scheduling the storage task for the task data according to external instructions or a preset data volume threshold; Step 3: Dynamic capacity adjustment: The dynamic capacity adjustment module uses a prediction model to predict future data flow patterns based on analysis of historical buffer load data. The capacity of each buffer in the multi-level buffer architecture is adjusted in real time based on the prediction results, so that the buffer resource configuration dynamically matches the predicted data flow pattern. Step 4, data storage: The task data processed by the buffer is written into a persistent storage medium through a data storage module.

2. The data storage optimization method based on a real-time operating system according to claim 1, characterized in that: The data storage step specifically includes: adopting a ping-pong buffer writing method, by alternately using at least two buffers, so that the data writing operation and the upstream data processing operation are executed in parallel.

3. The data storage optimization method based on a real-time operating system according to claim 1, characterized in that: The multi-level buffering architecture includes: An L0 buffer for storing high-priority real-time data, wherein the L0 buffer adopts a lock-free ring queue; An L1 buffer for storing medium-priority task data, wherein the L1 buffer adopts a priority-aware scheduling mechanism; and The L2 buffer is used to store low-priority persistent data. The L2 buffer uses zero-copy technology to write data through memory mapping.

4. The data storage optimization method based on a real-time operating system according to claim 3, characterized in that: The lock-free ring queue implements pointer updates through hardware-level atomic operations, specifically using a compare-and-swap (CAS) mechanism, where: During the insert operation, the expected values of the tail pointers are compared, and if they are consistent, the tail pointer is atomically updated and the data is written; During a read operation, the expected value of the head pointer is compared, and if they are consistent, the head pointer is atomically updated and the data is removed.

5. The data storage optimization method based on a real-time operating system according to claim 1, characterized in that: The prediction model is an embedded lightweight hybrid neural network that is configured to receive buffer fill rate, task arrival interval, and packet size variance as input features and generate expansion or contraction instructions as output actions.

6. The data storage optimization method based on a real-time operating system according to claim 1, characterized in that: The dynamic capacity adjustment step further includes: judging the expansion and contraction requirements through a traffic fluctuation rate index (FR), wherein the traffic fluctuation rate index (FR) is calculated based on the statistical characteristics of task arrival frequency, data packet size distribution and overall buffer fill rate by a preset weight coefficient.

7. The data storage optimization method based on a real-time operating system according to claim 1, characterized in that: The event-driven mechanism includes: responding to external Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) instructions to trigger task scheduling; and / or automatically triggering a storage task when the amount of data in any buffer reaches a preset threshold.

8. A data storage optimization system based on a real-time operating system, characterized in that: include: A data buffer module is configured to adopt a three-level buffer architecture including an L0 buffer, an L1 buffer, and an L2 buffer; A task scheduling module is configured to dynamically schedule storage tasks using an event-driven mechanism; a dynamic capacity adjustment module, connected to the data buffer module, configured to use a prediction model to predict future data flow patterns, and to issue capacity adjustment instructions to the data buffer module in real time through pipeline communication based on the prediction results, so that the capacity of the multi-level buffer zone is cooperatively adapted to the data flow pattern; The data storage module is configured to write data into a persistent storage medium.

9. The data storage optimization system based on a real-time operating system according to claim 8, characterized in that: The data storage module is configured to adopt a ping-pong buffer writing method so that data writing and processing operations are performed in parallel.

10. The data storage optimization system based on a real-time operating system according to claim 8, characterized in that: The dynamic capacity adjustment module is internally integrated with an embedded lightweight hybrid neural network, which is configured to receive physical quantities related to the buffer as input and generate capacity adjustment instructions as output.

Citation Information

Patent Citations

  • A data storage system based on multi-task technology in embedded environment

    CN109460677A

  • Industrial control intrusion detection method for hierarchical dependency relationship modeling

    CN111245848A

  • Buffer capacity adjusting method and device

    CN112737975A

  • Selecting neural network based on amount of memory

    CN115018040A

  • Task scheduling method and device for distributed storage system

    CN117093335A