Data prefetching optimization method and system of high-frequency multi-core real-time controller
By conducting multi-level query monitoring of the data access behavior of high-frequency multi-credit real-time controllers, generating node heat information and dynamically adjusting the prefetch strategy, the problems of low data prefetch accuracy and increased system delay in the existing technology are solved, and efficient data loading and system performance improvement are achieved.
Patent Information
- Application Number
- CN202510336808.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-21
- Publication Date
- 2025-04-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The data prefetching methods of existing high-frequency multi-credit real-time controllers cannot dynamically adjust the prefetching strategy, resulting in low prefetching accuracy and inability to fully utilize the access characteristics of the tree data structure, resulting in low data access efficiency and increased system latency.
By conducting multi-level query monitoring of data access behavior, node popularity information is generated, and a prefetch table is established based on this, the path prefetch algorithm is used to generate initial prefetch policies, dynamically adjust the policies according to the system load, and a jump pointer queue is created to achieve a fast access structure.
Effectively reduce invalid prefetching, improve data loading efficiency and system operation performance, and is suitable for multi-core controller application scenarios with high real-time requirements.
Smart Images

Figure CN119847053A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of data pre-fetching, and in particular to a data pre-fetching optimization method and system for a high-frequency multi-core real-time controller. Background Art
[0002] High-frequency multi-core real-time controllers are widely used in industrial control, autonomous driving, communication equipment and other fields with high real-time requirements. Its core task is to process a large number of data requests in an efficient and low-latency manner to ensure the stable operation of the system. In practical applications, controllers need to frequently access and operate large-scale tree data structures, and these operations are limited by memory access latency and data loading efficiency, becoming a key bottleneck affecting overall performance.
[0003] Traditional data prefetching technology usually adopts a fixed prefetching path or a simple prefetching strategy based on historical access patterns. Although this method can improve data access efficiency to a certain extent, it is difficult to adapt to the complex and dynamic data access behavior of high-frequency multi-core controllers. For example, when the system load changes or the heat distribution of data access is dynamically adjusted, the traditional method cannot optimize the prefetching strategy in real time, which can easily lead to prefetched data mismatch or invalid prefetching, wasting computing resources and increasing system latency. In addition, the existing technology lacks targeted optimization of the access characteristics of tree data structures, and cannot fully utilize the heat information and path correlation of nodes to build efficient prefetching strategies, thereby limiting the performance improvement of the controller in high concurrency scenarios. Summary of the invention
[0004] The main purpose of the present invention is to solve the technical problems that the existing high-frequency multi-core real-time controller data prefetching method cannot adjust the prefetching strategy according to the dynamic load, the prefetching accuracy is low, and the access characteristics of the tree data structure are not optimized enough, resulting in low data access efficiency and increased system delay; A first aspect of the present invention provides a data pre-fetching optimization method for a high-frequency multi-core real-time controller, the data pre-fetching optimization method for a high-frequency multi-core real-time controller comprising: Perform multi-level query monitoring on the data access behavior of the high-frequency multi-core real-time controller to obtain access statistics, and generate node heat information based on the counters of the nodes in the tree data structure used by the high-frequency multi-core real-time controller; Establishing a prefetch table based on the node heat information and access statistics data, and applying a preset path prefetch algorithm to the prefetch table to obtain an initial prefetch strategy; Dynamically adjusting the initial prefetch strategy according to the current system load of the high-frequency multi-core real-time controller to obtain an optimized prefetch strategy; Based on the optimized prefetch strategy, a jump pointer queue is created for the target data corresponding to the data access behavior to obtain a fast access structure, and a data prefetch operation is performed on the target data using the fast access structure to obtain a preloaded data set.
[0005] Optionally, in a first implementation of the first aspect of the present invention, performing multi-level query monitoring on the data access behavior of the high-frequency multi-core real-time controller to obtain access statistics, and generating node heat information based on the counters of the nodes in the tree data structure used by the high-frequency multi-core real-time controller includes: Deploy a query monitor for each processor core of the high-frequency multi-core real-time controller to record a data access address sequence of each processor core; Performing time window segmentation on the data access address sequence to obtain access subsequences within multiple time windows, and performing hash mapping on the addresses in each access subsequence to obtain address access frequency distribution; According to the address access frequency distribution, the counter values of the nodes in the update tree data structure used by the high-frequency multi-core real-time controller are updated, and the counter values are normalized to obtain node heat information reflecting the relative access frequency.
[0006] Optionally, in a second implementation of the first aspect of the present invention, establishing a prefetch table based on the node heat information and access statistics data, and applying a preset path prefetch algorithm to the prefetch table to obtain an initial prefetch strategy includes: Performing threshold screening on the node heat information to obtain a hot node set, and recording the access frequency of the hot nodes in the hot node set; Arrange the hot nodes in the hot node set in descending order of access frequency, select the hot node with the highest access frequency as the root node, and traverse the access statistics data to add child nodes to obtain a frequently accessed path tree; The frequently accessed path tree is stored in a pre-fetch table, and a path pre-fetch algorithm is applied to the pre-fetch table to generate an initial pre-fetch strategy.
[0007] Optionally, in a third implementation of the first aspect of the present invention, the hotspot nodes in the hotspot node set are arranged in descending order of access frequency, the hotspot node with the highest access frequency is selected as the root node, and the access statistics data are traversed to add child nodes to obtain a frequently accessed path tree, including: Arrange the hot nodes in the hot node set in descending order of access frequency, and select the node with the highest access frequency as the root node; Traversing access statistics, finding a subsequent access sequence of the traversed hotspot node within a statistical period, and sequentially connecting the hotspot nodes in the subsequent access sequence that also belong to the hotspot node set to form a path starting from the traversed hotspot node; Determine whether the path overlaps with an existing path, and if so, merge the overlapping parts and increase the weight of the overlapping path segment; Hotspot nodes without subsequent access sequences are added to the tree as independent leaf nodes, and the above steps of traversing access statistics are repeated until all hotspot nodes are processed to obtain a frequently visited path tree.
[0008] Optionally, in a fourth implementation of the first aspect of the present invention, storing the frequently accessed path tree in a prefetch table, and applying a path prefetch algorithm to the prefetch table to generate an initial prefetch strategy includes: Initialize the prefetch distance parameter d, and traverse the nodes in the frequently visited path tree. Use the hash index to quickly find the matching path in the prefetch table for the current node around the traversed node. If a fully matched path is found, the next d prefetch nodes are prefetched along the fully matched path into the prefetch sequence; If no exact match is found, the longest prefix match strategy is used to calculate the common prefix of the current node and each path in the prefetch table, and the path with the longest common prefix is selected as the prefetch path; Along the selected prefetch path, check whether the node is already in the cache one by one. If not, initiate a prefetch request and add the node to the prefetch sequence; According to the position of the nodes in the prefetch sequence in the path, the path weight and the node heat value, the prefetch priority is calculated, and the prefetch sequence is sorted according to the prefetch priority to obtain the initial prefetch strategy.
[0009] Optionally, in a fifth implementation of the first aspect of the present invention, dynamically adjusting the initial prefetch strategy according to the current system load of the high-frequency multi-core real-time controller to obtain an optimized prefetch strategy includes: Periodically collecting the current system load of the high-frequency multi-core real-time controller, and calculating the load score of the current system load using a weighted summation method; Based on the load score, the prefetch distance parameter d is dynamically adjusted using a piecewise function, and the initial prefetch sequence is pruned or extended according to the adjusted prefetch distance d; The expected benefit and execution cost of each prefetch operation in the modified prefetch sequence are calculated, and based on the ratio of the expected benefit to the execution cost, the modified prefetch sequence is dynamically adjusted to obtain an optimized prefetch strategy.
[0010] Optionally, in a sixth implementation of the first aspect of the present invention, based on the optimized prefetch strategy, creating a jump pointer queue for the target data corresponding to the data access behavior to obtain a fast access structure, and using the fast access structure to perform a data prefetch operation on the target data to obtain a preloaded data set includes: According to the optimized prefetch strategy, a target data set for which a jump pointer needs to be created is identified, and a data access sequence in the form of a linked list is constructed for each data item in the target data set; On the basis of the data access sequence, jump pointers are added according to predefined jump intervals to form a multi-level jump structure, and the constructed multi-level jump structure is organized into a jump pointer queue, the head of the jump pointer queue points to the most recently accessed data item, and a cursor is maintained for each jump pointer queue to point to the currently active data item; Build a hash table as a fast access structure, with the key being the unique identifier of the data item and the value being the corresponding jump pointer queue; The fast access structure is used to perform a data pre-fetch operation on the target data to obtain a pre-loaded data set.
[0011] A second aspect of the present invention provides a data pre-fetching optimization system for a high-frequency multi-core real-time controller, the data pre-fetching optimization system for a high-frequency multi-core real-time controller comprising: A behavior monitoring module, used to perform multi-level query monitoring on the data access behavior of the high-frequency multi-core real-time controller, obtain access statistics, and generate node heat information based on the counters of the nodes in the tree data structure used by the high-frequency multi-core real-time controller; A strategy generation module, used to establish a pre-fetch table based on the node heat information and access statistics, and use a preset path pre-fetch algorithm on the pre-fetch table to obtain an initial pre-fetch strategy; A strategy adjustment module, configured to dynamically adjust the initial pre-fetch strategy according to the current system load of the high-frequency multi-core real-time controller to obtain an optimized pre-fetch strategy; The fast access module is used to create a jump pointer queue for the target data corresponding to the data access behavior based on the optimized prefetch strategy, obtain a fast access structure, and use the fast access structure to perform a data prefetch operation on the target data to obtain a preloaded data set.
[0012] The data prefetching optimization method and system of the high-frequency multi-core real-time controller generate access statistics by performing multi-level query monitoring on the data access behavior of the controller, extracting the node heat based on the counter information of the tree data structure nodes, and constructing the node heat information. A prefetch table is established using the node heat information and access statistics, and an initial prefetch strategy is generated by a preset path prefetch algorithm. The initial prefetch strategy is dynamically adjusted according to the current system load of the controller to generate an optimized prefetch strategy. Subsequently, a jump pointer queue is created for the target data based on the optimized prefetch strategy, a fast access structure is constructed, and the target data is prefetched through the structure to generate a preloaded data set. The present invention effectively reduces invalid prefetching, improves data loading efficiency and system operation performance, and is suitable for multi-core controller application scenarios with high real-time requirements.
[0013] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0014] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, preferred embodiments are given below and described in detail with reference to the accompanying drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 It is a schematic diagram of a first embodiment of a data pre-fetching optimization method for a high-frequency multi-core real-time controller according to an embodiment of the present invention; Figure 2 Schematic diagram of an embodiment of a data pre-fetching optimization system for a high-frequency multi-core real-time controller in an embodiment of the present invention. DETAILED DESCRIPTION
[0016] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are 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 creative work are within the scope of protection of the present invention.
[0017] The terms "including" and "having" and any variations thereof mentioned in the embodiments of the present invention are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device end including a series of steps or units is not limited to the listed steps or units, but may optionally include other steps or units that are not listed, or may optionally include other steps or units that are inherent to these processes, methods, products or device ends.
[0018] To facilitate understanding of this embodiment, a data pre-fetching optimization method for a high-frequency multi-core real-time controller disclosed in an embodiment of the present invention is first described in detail. Figure 1 As shown, the method comprises the following steps: 101. Perform multi-level query monitoring on data access behavior of the high-frequency multi-core real-time controller to obtain access statistics, and generate node heat information based on the counters of the nodes in the tree data structure used by the high-frequency multi-core real-time controller; In one embodiment of the present invention, the data access behavior of the high-frequency multi-core real-time controller is subjected to multi-level query monitoring to obtain access statistics, and based on the counters of the nodes in the tree data structure used by the high-frequency multi-core real-time controller, node heat information is generated, including: deploying a query monitor on each processor core of the high-frequency multi-core real-time controller to record the data access address sequence of each processor core; performing time window segmentation on the data access address sequence to obtain access subsequences within multiple time windows, and performing hash mapping on the addresses in each access subsequence to obtain an address access frequency distribution; updating the counter values of the nodes in the update tree data structure used by the high-frequency multi-core real-time controller according to the address access frequency distribution, and normalizing the counter values to obtain node heat information reflecting the relative access frequency.
[0019] Specifically, the implementation process of multi-level query monitoring of data access behavior of high-frequency multi-core real-time controllers first involves deploying query monitors on each processor core. These query monitors are lightweight software components that are tightly integrated with the core's instruction pipeline. Special monitoring instructions are inserted to capture data access operations and record the address of each memory read and write. These addresses are stored in a circular buffer, and the size of the buffer is dynamically adjusted according to the expected monitoring period and access frequency. In order to deal with the data synchronization problem between multiple cores, a lock-free algorithm is used to update the shared monitoring data structure to ensure data consistency in a high-concurrency environment. The monitor also records the timestamp of each access for subsequent time window analysis. To reduce storage overhead, the address sequence is compressed and stored using incremental encoding, and only the offset relative to the base address is recorded. In the actual implementation, the query monitor obtains accurate access information through hardware performance counters and special debug registers, which are transmitted in real time to a dedicated monitoring buffer. When the buffer reaches a preset threshold, the data processing flow is triggered to convert the collected raw access data into a more compact representation and store it in a dedicated area in main memory.
[0020] Specifically, the process of time window segmentation of the recorded data access address sequence first determines the appropriate time window size. This size is usually set according to the characteristics of the system (such as cache refresh cycle, typical transaction duration). Subsequently, the complete address sequence is traversed and divided into multiple subsequences according to the timestamp information. Each subsequence corresponds to a time window and contains all access addresses within the window. In order to handle cross-window access patterns, a certain degree of overlap is allowed between adjacent windows. During the segmentation process, preliminary data cleaning is performed at the same time to remove obvious outliers and noise data. For each subsequence, its basic statistical characteristics, such as the total number of accesses, the number of unique addresses, etc., are calculated. In addition, a sliding window mechanism is implemented so that new access data can be smoothly integrated into the analysis process, while old data gradually fades out. In this process, a ring buffer is used to store the data of the most recent N time windows, and the value of N is dynamically adjusted according to the system memory and analysis requirements. Whenever new access data arrives, the latest time window is updated, and the oldest window data is eliminated when necessary. This method not only ensures the timeliness of the analysis, but also avoids the unlimited growth of storage and processing costs.
[0021] Specifically, hash mapping the addresses in each access subsequence is a complex process. First, a special hash function is designed that can evenly map the memory address space into a hash table of a predefined size. The choice of hash function takes into account the characteristics of the address space, such as using a hash algorithm that preserves locality for continuous memory areas. Each bucket of the hash table corresponds to an access frequency counter. When traversing each address in the subsequence, its hash value is calculated and the counter of the corresponding bucket is increased. In order to handle hash conflicts, an open addressing method is used, and the length of the conflict chain is recorded for subsequent hash function optimization. The output of this process is a hash table that reflects the address access frequency distribution. In order to improve efficiency, the hash mapping process is parallelized, multiple subsequences are processed simultaneously, and the results are finally merged. An adaptive mechanism is implemented that can dynamically adjust the hash table size according to the observed conflict rate to strike a balance between storage efficiency and conflict rate. In actual operation, a double buffering mechanism is used to allow the hash table of the next time window to be built while the current hash table is being processed, thereby achieving continuous and uninterrupted data processing.
[0022] Specifically, the process of updating the counter value of the node in the tree data structure according to the address access frequency distribution and normalizing it involves multiple steps. First, establish the mapping relationship between the address in the hash table and the node of the tree data structure. This is achieved by maintaining a mapping table from address range to tree node. For each node, aggregate the access frequency of all its corresponding addresses and update the counter value of the node. The update here adopts the exponential moving average algorithm, which not only takes into account the historical access pattern, but also reflects the latest change trend. Specifically, the new counter value = α * current observation value + (1-α) * old counter value, where α is the smoothing factor, which is set according to the system's requirements for the speed of response to changes. After the update is completed, the counter value in the entire tree structure is normalized. The normalization process adopts an improved min-max scaling method, while taking into account the level of the node in the tree. For each node, its normalized value is calculated as: (original value - min) / (max - min), where min and max are the minimum and maximum counter values of all nodes in the level, respectively. This method ensures the comparability between nodes at different levels and avoids the problem of over-enhancement of deep nodes due to cumulative effects. The normalized value is the heat information of the node, which accurately reflects the relative importance of each node in the overall access pattern. In actual implementation, this process is designed as an incremental update, processing only the changed part each time, thereby reducing computational overhead.
[0023] 102. Establish a prefetch table based on the node heat information and access statistics data, and use a preset path prefetch algorithm on the prefetch table to obtain an initial prefetch strategy; In one embodiment of the present invention, a prefetch table is established based on the node heat information and access statistics data, and a preset path prefetch algorithm is used on the prefetch table to obtain an initial prefetch strategy, including: threshold screening of the node heat information to obtain a hot node set, and recording the access frequency of the hot nodes in the hot node set; arranging the hot nodes in the hot node set in descending order of access frequency, selecting the hot node with the highest access frequency as the root node, and traversing the access statistics data to add child nodes to obtain a frequently visited path tree; storing the frequently visited path tree in the prefetch table, and applying the path prefetch algorithm to the prefetch table to generate an initial prefetch strategy.
[0024] Specifically, the process of establishing a prefetch table based on node heat information and access statistics first involves threshold screening of node heat information to obtain a set of hot nodes. This step is achieved by setting a heat threshold, which is usually determined based on the overall access pattern and resource constraints of the system. Specifically, the heat information of all nodes is traversed, and nodes with heat values exceeding the preset threshold are included in the hot node set. At the same time, for each selected hot node, its specific access frequency is recorded. This frequency information is directly extracted from the previously generated access statistics, which reflects the number of times the node is accessed within a certain period of time. The construction process of the hot node set also includes a dynamic adjustment mechanism, that is, the heat threshold is periodically adjusted according to the feedback of the system load and the prefetch effect. In this way, more hot nodes can be included when the system load is light, and the number of hot nodes can be more strictly limited when the system load is heavy. In addition, in order to prevent the unlimited growth of the hot node set, an upper limit value is set. When the number of hot nodes reaches this upper limit, the nodes with relatively low heat will be eliminated. The output of this process is a data structure containing hot nodes and their access frequencies, which is usually implemented as an ordered map or priority queue to facilitate subsequent frequency sorting operations.
[0025] The process of arranging the nodes in the hot node set in descending order according to the access frequency and constructing a frequently accessed path tree is the core step of establishing the prefetch table. First, sort the hot node set, using the quick sort or heap sort algorithm, and sort in descending order with the access frequency as the key value. After the sorting is completed, the node with the highest access frequency is selected as the root node, which is considered to be the starting point most likely to be frequently accessed. Next, traverse the access statistics data, which contain detailed access sequence information. For each hot node, find its subsequent access sequence within the statistical period. If the subsequent access node also belongs to the hot node set, it is added as a child node under the current node to form an access path. This process is recursive until a non-hot node is encountered or the preset path length limit is reached. In the process of adding child nodes, the access frequency of the path also needs to be recorded, which is usually calculated by accumulating the access frequency of each node on the path. If the newly formed path overlaps with the existing path, the overlapping part is merged and the weight of the overlapping path segment is increased. For hot nodes without obvious subsequent access patterns, they are added to the tree as independent leaf nodes. The whole process is repeated until all hot nodes are processed. Finally, the constructed tree is pruned and optimized to remove paths with access frequencies below a certain threshold and merge highly similar paths to reduce the complexity of the tree and improve the efficiency of subsequent prefetching.
[0026] The last key step of the prefetching process is to store the frequently accessed path tree in the prefetch table and apply the path prefetch algorithm to generate the initial prefetch strategy. First, a table format suitable for storing the tree structure is designed. This prefetch table usually contains the following fields: path identifier, path start node, node sequence, path access frequency, and path weight. The path identifier is a unique identifier used to quickly find a specific path. The path start node marks the starting point of the access sequence. The node sequence stores the complete access path and can use compression encoding to reduce storage overhead. The path access frequency records the total number of times the path is accessed, while the path weight is a value calculated by comprehensively considering the path length, access frequency, and overlap. The process of converting the tree structure into a table format involves a depth-first traversal, and each path from the root to the leaf generates a table entry. Once the prefetch table is built, the path prefetch algorithm can be applied. The algorithm first sets a prefetch distance parameter d, which represents the number of nodes to be prefetched each time. When the system receives a data access request, the algorithm searches the prefetch table for a matching path starting from the current access node. If a fully matched path is found, the data of the next d nodes are pre-fetched along the path. If a fully matched path is not found, the longest prefix match strategy is used to select the path with the most similar beginning for pre-fetching. The pre-fetched node data is sorted according to the path weight to form the final initial pre-fetch sequence. This sequence is the core content of the initial pre-fetch strategy, which guides the system on which data should be pre-fetched first in actual operation.
[0027] Furthermore, the hot nodes in the hot node set are arranged in descending order according to the access frequency, the hot node with the highest access frequency is selected as the root node, and the access statistics data are traversed to add child nodes to obtain a frequently visited path tree, including: arranging the hot nodes in the hot node set in descending order according to the access frequency, and selecting the node with the highest access frequency as the root node; traversing the access statistics data, finding the subsequent access sequence of the traversed hot node within the statistical period, and connecting the hot nodes in the subsequent access sequence that also belong to the hot node set in sequence to form a path starting from the traversed hot node; determining whether the path overlaps with an existing path, and if so, merging the overlapping parts and increasing the weight of the overlapping path segment; adding the hot node without a subsequent access sequence as an independent leaf node to the tree, repeating the above steps of traversing the access statistics data until all hot nodes are processed to obtain a frequently visited path tree.
[0028] Specifically, the process of sorting the hot nodes in the hot node set in descending order of access frequency and selecting the node with the highest access frequency as the root node first involves sorting the hot node set. This step usually uses an efficient sorting algorithm, such as quick sort or heap sort, to sort in descending order with access frequency as the key. In actual implementation, considering that the size of the hot node set may be large, the use of a parallel sorting algorithm can significantly improve the sorting efficiency. After sorting, the node with the highest access frequency is naturally at the top of the set, and this node is selected as the root node. The reason for selecting the node with the highest access frequency as the root node is that this node is the starting point that is most likely to be frequently accessed, and building a tree structure from this node can maximize the capture of common access patterns. In addition, in order to cope with the dynamic changes in access patterns, the implementation also includes a mechanism for periodically re-evaluating the root node. This mechanism is triggered at fixed time intervals or when a significant change in access patterns is detected, re-sorting the hot node set and updating the root node. This ensures that the frequently accessed path tree always reflects the latest access patterns. After selecting the root node, some data structures need to be initialized to support the subsequent tree construction process, such as creating an empty tree structure and inserting the root node into it.
[0029] Specifically, the core step of constructing a frequently visited path tree is to traverse the access statistics data, find the subsequent access sequence of the hot node within the statistical period, and connect the hot nodes in the subsequent access sequence that also belong to the hot node set in sequence to form a path starting from the traversed hot node. This process starts from the root node and processes each node in the hot node set in sequence. For each hot node, first locate the access record of the node in the access statistics data. The access statistics data are usually stored in the form of time series, recording the timestamps and access objects of all data accesses in the system. In the implementation, an efficient index structure (such as B-tree or hash table) is used to speed up this positioning process. Once the access record of the target node is found, its subsequent access sequence is analyzed. Here, "subsequent" is usually defined as the access that follows it within a fixed time window (such as 100 milliseconds). During the analysis process, a candidate node queue needs to be maintained, and all accesses within the time window are added to the queue in sequence. Then, traverse this candidate queue to check whether each candidate node also belongs to the hot node set. If so, add it to the path currently being constructed. This addition process requires updating the tree structure and path information at the same time. In the tree structure, the new node is inserted as a child of the current node; in the path information, the new edge and its related attributes (such as transition probability) are recorded. If the candidate node is not a hot node, the extension of the current path is stopped. The whole process is recursive until all hot nodes are processed or the preset path length limit is reached.
[0030] Specifically, it is determined whether the newly formed path overlaps with the existing path. If so, the overlapping part is merged and the weight of the overlapping path segment is increased. This step is to optimize the structure of the frequently accessed path tree and reduce redundant information. In the implementation, every time a new path is formed, it needs to be compared with all existing paths in the tree. This comparison process can be implemented by depth-first search or breadth-first search. Starting from the root node of the tree, traverse along each existing path and match the nodes with the new path at the same time. When an overlap is found, the start and end positions of the overlap need to be recorded. The overlap judgment criteria include not only the matching of the nodes themselves, but also whether the transition probabilities between nodes are similar. If an overlap is found, the path needs to be merged. During the merging process, the nodes of the overlapping part are merged into one, and the weight of this merged node is the weighted sum of the original weight and the weight of the new path. The weight is usually calculated using the exponential moving average method so that historical information and new access patterns can be reflected at the same time. After the merge, the tree structure needs to be updated, including adjusting the parent-child relationship and the order of sibling nodes. In addition, all path information related to these nodes needs to be updated, including statistical data such as path length and access frequency. This merging process not only reduces the storage overhead of the tree, but also improves the efficiency of subsequent prefetch operations because it reduces the number of paths that need to be considered.
[0031] Specifically, the hot nodes without subsequent access sequences are added to the tree as independent leaf nodes, and the steps of traversing the access statistics are repeated until all hot nodes are processed. Finally, the process of obtaining the frequently accessed path tree is the last stage of the construction process. For those hot nodes that do not have obvious subsequent access patterns in the access statistics, it is necessary to treat them as independent leaf nodes, because although these nodes have high access frequencies, they may be the end of the access sequence or their subsequent access patterns are too scattered. In the implementation, these nodes are directly connected to the nearest parent node, or to the root node when there is no obvious parent node. A special mark is created for each leaf node, indicating that it is a possible end point of the access sequence. This information is useful in the subsequent prefetching strategy formulation because it indicates a possible prefetching termination point. The entire traversal and path construction process is repeated until all nodes in the hot node set are processed, which ensures that the frequently accessed path tree contains all important access patterns. In this repeated process, the tree structure needs to be continuously updated and optimized, including regular tree balancing operations to maintain the depth of the tree within a reasonable range, thereby ensuring the efficiency of subsequent query operations. The resulting frequently accessed path tree is a multi-branch tree structure. In addition to basic data access information, each node also contains statistical information such as access frequency and transition probability. This tree structure comprehensively describes the main data access patterns in the system and provides a solid data foundation for the subsequent prefetching strategy formulation.
[0032] Furthermore, the frequently visited path tree is stored in a prefetch table, and a path prefetch algorithm is applied to the prefetch table to generate an initial prefetch strategy, including: initializing a prefetch distance parameter d, and traversing the nodes in the frequently visited path tree, and using a hash index to quickly find a matching path in the prefetch table for the current node around the traversed node; if a completely matched path is found, the next d prefetch nodes are prefetched along the completely matched path into the prefetch sequence; if a complete match is not found, the longest prefix matching strategy is used to calculate the common prefix of the current node and each path in the prefetch table, and select the path with the longest common prefix as the prefetch path; along the selected prefetch path, check whether the node is already in the cache one by one, if not in the cache, initiate a prefetch request, and add the node to the prefetch sequence; calculate the prefetch priority according to the position of the node in the prefetch sequence in the path, the path weight and the node heat value, and sort the prefetch sequence according to the prefetch priority to obtain the initial prefetch strategy.
[0033] Specifically, the process of storing the frequently accessed path tree in the prefetch table and applying the path prefetch algorithm to generate the initial prefetch strategy first involves initializing the prefetch distance parameter d. This parameter d determines the number of nodes to be preloaded for each prefetch operation, and its value setting needs to balance the prefetch effect and system resource consumption. Usually, the initial value of d is determined according to the system's cache size, memory bandwidth, and typical access sequence length. In actual implementation, d can be set as an adjustable parameter to adapt to different workload characteristics. After the initialization is completed, the nodes in the frequently accessed path tree are traversed. This traversal process uses a depth-first search algorithm, starting from the root node and recursively visiting each child node. For each traversed node, it is regarded as the current node, and a hash index is used in the prefetch table to quickly find a matching path. The implementation of the prefetch table uses a hash table data structure, where the key is the starting node sequence of the path and the value is the complete path information. The selection of the hash function needs to take into account the characteristics of the path prefix to minimize hash conflicts. During the search process, the hash table is queried using the current node and its first few ancestor nodes as keys, so that possible matching paths can be quickly located.
[0034] Specifically, when a fully matched path is found in the prefetch table, the prefetch algorithm will prefetch the next d nodes along this path into the prefetch sequence. A fully matched path means that the current node and its ancestor node sequence are exactly the same as the prefix of a path in the prefetch table. In this case, the prefetch algorithm starts from the matching point, moves forward d steps along the path, and adds these d nodes to the prefetch sequence. This process needs to take into account the possibility that the path may reach the end point within d steps. If the path length is less than d, only the end point of the path is prefetched. For each node to be prefetched, the algorithm records its position information in the original path, which is important for subsequent priority calculations. If a fully matched path is not found, the prefetch algorithm will switch to the longest prefix matching strategy. This strategy calculates the common prefix length of the current node and each path in the prefetch table, and then selects the path with the longest common prefix as the prefetch path. When implementing this strategy, a trie data structure can be used to efficiently perform prefix matching. After all paths are inserted into the trie, the path with the longest common prefix with the current node sequence can be quickly found. This approach provides a reasonable prefetch direction when there is no exact match, as it speculates on possible subsequent accesses based on the observed partial access patterns.
[0035] Specifically, after the prefetch path is selected, the algorithm will check whether the nodes are already in the cache one by one along this path. This checking process involves interaction with the system cache manager. For each node, the cache manager is first queried to determine whether the data of the node is already in the cache. If the node is not in the cache, a prefetch request is initiated. Prefetch requests are usually asynchronous to avoid blocking the execution of the main program. After the request is initiated, the node is added to the prefetch sequence. This prefetch sequence is a dynamic array or linked list used to store all node information that needs to be prefetched. The information of each prefetch node includes the node identifier, the position in the original path, the weight of the path to which it belongs, etc. For nodes that are already in the cache, although they do not need to be actually prefetched, they are still added to the prefetch sequence because these nodes are still important in the subsequent priority calculation. In the process of adding nodes to the prefetch sequence, the system's resource constraints, such as available cache space and network bandwidth, also need to be considered. If the prefetch operation may lead to excessive resource consumption, a corresponding restriction mechanism needs to be implemented, such as setting the maximum length of the prefetch queue or dynamically adjusting the number of prefetches according to the current system load.
[0036] Specifically, finally, the prefetch priority is calculated according to the various attributes of the nodes in the prefetch sequence, and the prefetch sequence is sorted accordingly to obtain the initial prefetch strategy. The priority calculation considers three main factors: the position of the node in the path, the path weight, and the node heat value. The position of the node in the path reflects the time order of access. Generally, the earlier the position, the higher the priority. The path weight represents the probability of the path being accessed. The nodes in the path with higher weights should be given higher priority. The node heat value directly reflects the frequency of access to the node. These three factors are combined into the final priority score through a weighted sum. The setting of weights needs to be adjusted and optimized according to the actual application scenario. After calculating the priority, an efficient sorting algorithm (such as quick sort) is used to sort the prefetch sequence. The sorted prefetch sequence is the initial prefetch strategy, which determines the execution order of the actual prefetch operation. This strategy is not static, but will be dynamically adjusted according to the actual prefetch effect and system status. For example, if it is found that some pre-fetched data is never used, the weight of the corresponding path can be reduced; if some non-pre-fetched data is frequently accessed, the heat value of the corresponding node can be increased. This dynamic adjustment mechanism ensures that the pre-fetching strategy can adapt to the changing access pattern.
[0037] 103. Dynamically adjust the initial prefetch strategy according to the current system load of the high-frequency multi-core real-time controller to obtain an optimized prefetch strategy; In one embodiment of the present invention, the initial prefetch strategy is dynamically adjusted according to the current system load of the high-frequency multi-core real-time controller to obtain an optimized prefetch strategy, including: periodically collecting the current system load of the high-frequency multi-core real-time controller, and using a weighted sum method to calculate the load score of the current system load; based on the load score, using a piecewise function to dynamically adjust the prefetch distance parameter d, and according to the adjusted prefetch distance d, pruning or extending the initial prefetch sequence; calculating the expected benefit and execution cost of each prefetch operation in the modified prefetch sequence, and based on the ratio of the expected benefit to the execution cost, dynamically adjusting the modified prefetch sequence to obtain an optimized prefetch strategy.
[0038] Specifically, the process of dynamically adjusting the initial prefetch strategy according to the current system load of the high-frequency multi-core real-time controller first involves periodically collecting system load data. This collection process is usually performed at a fixed time interval (such as every 100 milliseconds), and various load indicators are obtained through system calls or hardware performance counters. Typical load indicators include CPU utilization, memory usage, cache hit rate, I / O waiting time, etc. Each indicator is obtained through a dedicated system interface or tool. For example, CPU utilization can be obtained by parsing the / proc / stat file or using a specific system call. After obtaining the raw data, it needs to be standardized to map each indicator to a range of 0 to 1 for subsequent calculations. After standardization, the weighted summation method is used to calculate the comprehensive load score of the current system. The setting of weights reflects the degree of influence of each indicator on the prefetch performance. It is usually necessary to determine the optimal weight configuration through experiments and statistical analysis. For example, CPU utilization and cache hit rate may be given higher weights because these two factors have a greater impact on prefetch performance. The calculated load score is a value between 0 and 1, which intuitively reflects the overall load status of the system. This score will be used for subsequent prefetching strategy adjustments, so its calculation process needs to be efficient enough to ensure that it does not significantly affect system performance.
[0039] Specifically, based on the calculated load score, dynamically adjusting the prefetch distance parameter d using a piecewise function is a key step in optimizing the prefetch strategy. The piecewise function is designed to flexibly adjust the prefetch behavior under different load levels. Usually, this function divides the load score into multiple intervals, each of which corresponds to a different adjustment strategy. For example, when the load score is low (such as 0-0.3), the d value can be increased to increase the aggressiveness of prefetching; when the load is at a medium level (such as 0.3-0.7), the d value is kept unchanged; when the load is high (such as 0.7-1), the d value is reduced to reduce the additional burden of prefetching on the system. The specific interval division and adjustment range need to be determined based on system characteristics and actual operating data. In the process of adjusting the d value, the hardware limitations of the system, such as cache size, need to be considered to avoid cache pollution caused by excessive prefetching. The adjusted d value is directly used to modify the initial prefetch sequence. If the d value decreases, the nodes exceeding the new d value need to be removed from the tail of the prefetch sequence; if the d value increases, try to add prefetch nodes along the original path. This modification process needs to be handled with caution to ensure that the overall structure and effectiveness of the prefetch sequence are not destroyed. In actual implementation, a bidirectional linked list of pre-fetch nodes can be maintained to efficiently add and delete nodes. The modified pre-fetch sequence reflects a more appropriate pre-fetch strategy under the current load condition of the system.
[0040] Specifically, calculating the expected benefit and execution cost of each prefetch operation in the modified prefetch sequence is the last key step in optimizing the prefetch strategy. The expected benefit is usually estimated by predicting the future access probability, which can be calculated based on historical access statistics and current access patterns. For example, a Markov chain model can be used to predict the probability of the next node being accessed given the current access state. The expected benefit also needs to consider the size and access latency of the node, because prefetching large data or remote data may bring higher benefits. The execution cost mainly includes the CPU time, memory bandwidth usage, and possible cache pollution of the prefetch operation itself. The cost calculation needs to consider the current system load status. Under high load, the same prefetch operation will have a higher cost. When calculating the benefit and cost ratio, a normalized formula such as (benefit / (cost*system load factor)) is usually used to balance the decision under different load conditions. Based on this ratio, the modified prefetch sequence is finally adjusted dynamically. The adjustment process may include reordering, removing inefficient prefetch operations, or adding efficient prefetch operations. When implemented, a priority queue can be used to maintain the prefetch operations, and the queue order can be dynamically adjusted according to the benefit-cost ratio. The final optimized prefetch strategy not only takes the access pattern into consideration, but also fully considers the current load condition of the system, thus achieving a good balance between prefetch effect and system resource consumption.
[0041] 104. Based on the optimized prefetch strategy, a jump pointer queue is created for the target data corresponding to the data access behavior to obtain a fast access structure, and a data prefetch operation is performed on the target data using the fast access structure to obtain a preloaded data set.
[0042] In one embodiment of the present invention, based on the optimized prefetch strategy, a jump pointer queue is created for the target data corresponding to the data access behavior to obtain a fast access structure, and the fast access structure is used to perform a data prefetch operation on the target data to obtain a preloaded data set, including: according to the optimized prefetch strategy, a target data set for which a jump pointer needs to be created is identified, and for each data item in the target data set, a data access sequence in the form of a linked list is constructed; on the basis of the data access sequence, jump pointers are added according to a predefined jump interval to form a multi-level jump structure, and the constructed multi-level jump structure is organized into a jump pointer queue, the head of the jump pointer queue points to the most recently accessed data item, and a cursor is maintained for each jump pointer queue, pointing to the currently active data item; a hash table is constructed as a fast access structure, the key is a unique identifier of the data item, and the value is a corresponding jump pointer queue; the data prefetch operation is performed on the target data using the fast access structure to obtain a preloaded data set.
[0043] Specifically, the process of creating a jump pointer queue for target data based on an optimized prefetch strategy first involves identifying a target data set for which jump pointers need to be created. This step is accomplished by analyzing the prefetch sequence in the optimized prefetch strategy. Each data item in the prefetch sequence is considered as potential target data. The selection criteria include the access frequency of the data item, its position in the prefetch sequence, and the expected access pattern. Generally, data items with high access frequency and located at the front of the prefetch sequence are preferred. For each selected data item, a data access sequence in the form of a linked list is constructed. This linked list reflects the historical access order of the data item. Each node of the linked list contains the identifier of the data item, the access timestamp, and other related metadata, such as the access type (read / write). The construction process involves traversing the historical access log and organizing the access records into a linked list in chronological order. In order to optimize memory usage, a maximum linked list length can be set to retain only the most recent N access records. This N value can be dynamically adjusted based on the system memory capacity and the expected access pattern. The head of the linked list always points to the most recent access record, which facilitates the rapid location of the latest access status.
[0044] Specifically, based on the constructed data access sequence, jump pointers are added according to the predefined jump interval to form a multi-level jump structure. The setting of the jump interval is a key factor, which determines the level of the jump structure and the search efficiency. Usually, an exponentially increasing interval is used, such as a power of 2 (1, 2, 4, 8, ...). This design allows fast traversal of the access sequence at different granularities. In the specific implementation, starting from the head of the linked list, an additional pointer field is created for each level of jump. The jump pointer of the i-th level points to the 2^i-th node after the current node. If the length of the linked list is not enough to support a certain level of jump, the pointer of the level is set to null. The construction process of the multi-level jump structure needs to consider the efficiency of dynamic updates. When a new access record is added to the head of the linked list, the jump pointers at each level need to be updated accordingly. In order to reduce the update overhead, a lazy update strategy can be adopted to update the jump pointer only when necessary (such as when performing a search operation). The constructed multi-level jump structure is organized into a jump pointer queue, and the head of the queue points to the most recently accessed data item. This organization method ensures that the latest access record is always at the front of the queue, which is convenient for fast access. At the same time, a cursor is maintained for each jump pointer queue, pointing to the currently active data item. The position of the cursor reflects the current access status of the system, which plays a key role in performing prefetch operations.
[0045] Specifically, building a hash table as a fast access structure is a key step to achieve efficient data prefetching. The key of the hash table is the unique identifier of the data item, and the value is the corresponding jump pointer queue. This design allows the system to locate the access history and prediction information of any data item within O(1) time complexity. The choice of hash function needs to consider the characteristics of the data item identifier to minimize hash conflicts. In the implementation, open addressing or chained hashing can be used to handle conflicts. In order to support large-scale data sets, the hash table needs to implement a dynamic expansion mechanism. When the load factor exceeds the preset threshold, the hash table is automatically expanded and all items are rehashed. In addition, in order to deal with memory constraints, an LRU (least recently used) elimination strategy can be implemented to remove the least frequently used data items when the memory is close to the upper limit. The construction process of the hash table is incremental. As new data items are identified and jump pointer queues are created, new key-value pairs are continuously added to the hash table. This process needs to consider the problem of concurrent access. In a multi-threaded environment, fine-grained locks or lock-free algorithms may need to be used to ensure data consistency.
[0046] Specifically, the data prefetch operation is performed on the target data using the constructed fast access structure. Obtaining the preloaded data set is the last step of the whole process. The execution flow of the prefetch operation is as follows: First, according to the identifier of the data item currently being accessed, the corresponding jump pointer queue is searched in the hash table. If a match is found, the cursor position of the queue is obtained. Starting from the cursor position, the queue is quickly traversed using the multi-level jump structure to predict the data items that may be accessed in the future. The prediction process considers the level and jump distance of the jump pointer, and prioritizes the closer data items for prefetching. The number of prefetches is determined by the previously optimized prefetch distance parameter d. For each data item selected for prefetching, the system initiates an asynchronous prefetch request to load the data from slow storage (such as disk or remote memory) to the local cache. The priority of the prefetch request is determined based on the position of the data item in the jump structure and the historical access frequency. The system also needs to maintain a prefetch status table to record the status of each prefetch request (such as initiated, in progress, completed) to avoid repeated prefetching and manage resource usage. After prefetching is completed, the loaded data item set is returned as the preloaded data set, and relevant statistical information is updated at the same time, such as prefetch hit rate, prefetch accuracy, etc. These statistical information will be used for subsequent prefetch strategy optimization.
[0047] In this embodiment, access statistics are generated by performing multi-level query monitoring on the data access behavior of the controller, and the node heat is extracted based on the counter information of the tree data structure nodes to construct the node heat information. A prefetch table is established using the node heat information and access statistics, and an initial prefetch strategy is generated by a preset path prefetch algorithm. The initial prefetch strategy is dynamically adjusted according to the current system load of the controller to generate an optimized prefetch strategy. Subsequently, a jump pointer queue is created for the target data based on the optimized prefetch strategy, a fast access structure is constructed, and the target data is prefetched through the structure to generate a preloaded data set. The present invention effectively reduces invalid prefetching, improves data loading efficiency and system operating performance, and is suitable for multi-core controller application scenarios with high real-time requirements.
[0048] The above describes the data pre-fetching optimization method of the high-frequency multi-core real-time controller in the embodiment of the present invention. The following describes the data pre-fetching optimization system of the high-frequency multi-core real-time controller in the embodiment of the present invention. Figure 2 , an embodiment of a data pre-fetching optimization system for a high-frequency multi-core real-time controller in an embodiment of the present invention includes: The behavior monitoring module 201 is used to perform multi-level query monitoring on the data access behavior of the high-frequency multi-core real-time controller, obtain access statistics, and generate node heat information based on the counters of the nodes in the tree data structure used by the high-frequency multi-core real-time controller; A strategy generation module 202 is used to establish a pre-fetch table based on the node heat information and access statistics, and use a preset path pre-fetch algorithm on the pre-fetch table to obtain an initial pre-fetch strategy; A strategy adjustment module 203, configured to dynamically adjust the initial pre-fetch strategy according to the current system load of the high-frequency multi-core real-time controller to obtain an optimized pre-fetch strategy; The fast access module 204 is used to create a jump pointer queue for the target data corresponding to the data access behavior based on the optimized prefetch strategy to obtain a fast access structure, and use the fast access structure to perform a data prefetch operation on the target data to obtain a preloaded data set.
[0049] In an embodiment of the present invention, the data prefetch optimization system of the high-frequency multi-core real-time controller runs the data prefetch optimization method of the high-frequency multi-core real-time controller. The data prefetch optimization system of the high-frequency multi-core real-time controller generates access statistics by performing multi-level query monitoring on the data access behavior of the controller, and extracts node heat based on the counter information of the tree data structure node to construct node heat information. A prefetch table is established using the node heat information and access statistics, and an initial prefetch strategy is generated by a preset path prefetch algorithm. The initial prefetch strategy is dynamically adjusted according to the current system load of the controller to generate an optimized prefetch strategy. Subsequently, a jump pointer queue is created for the target data based on the optimized prefetch strategy, a fast access structure is constructed, and the target data is prefetched through the structure to generate a preloaded data set. The present invention effectively reduces invalid prefetching, improves data loading efficiency and system operation performance, and is suitable for multi-core controller application scenarios with high real-time requirements.
[0050] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the above-described system, device, or unit can refer to the corresponding process in the aforementioned method embodiment and will not be repeated here.
[0051] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art or the whole or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk and other media that can store program code.
[0052] As described above, the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features thereof may be replaced by equivalents. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A data pre-fetching optimization method for a high-frequency multi-core real-time controller, characterized in that: The data pre-fetching optimization method of the high-frequency multi-core real-time controller comprises: Perform multi-level query monitoring on the data access behavior of the high-frequency multi-core real-time controller to obtain access statistics, and generate node heat information based on the counters of the nodes in the tree data structure used by the high-frequency multi-core real-time controller; Establishing a prefetch table based on the node heat information and access statistics data, and applying a preset path prefetch algorithm to the prefetch table to obtain an initial prefetch strategy; Dynamically adjusting the initial prefetch strategy according to the current system load of the high-frequency multi-core real-time controller to obtain an optimized prefetch strategy; Based on the optimized prefetch strategy, a jump pointer queue is created for the target data corresponding to the data access behavior to obtain a fast access structure, and a data prefetch operation is performed on the target data using the fast access structure to obtain a preloaded data set.
2. The data pre-fetching optimization method of the high-frequency multi-core real-time controller according to claim 1 is characterized in that: The performing multi-level query monitoring on the data access behavior of the high-frequency multi-core real-time controller to obtain access statistics, and generating node heat information based on the counters of the nodes in the tree data structure used by the high-frequency multi-core real-time controller includes: Deploy a query monitor for each processor core of the high-frequency multi-core real-time controller to record a data access address sequence of each processor core; Performing time window segmentation on the data access address sequence to obtain access subsequences within multiple time windows, and performing hash mapping on the addresses in each access subsequence to obtain address access frequency distribution; According to the address access frequency distribution, the counter values of the nodes in the update tree data structure used by the high-frequency multi-core real-time controller are updated, and the counter values are normalized to obtain node heat information reflecting the relative access frequency.
3. The data pre-fetching optimization method of the high-frequency multi-core real-time controller according to claim 1, characterized in that: The establishing of a prefetch table based on the node heat information and access statistics data, and applying a preset path prefetch algorithm to the prefetch table to obtain an initial prefetch strategy includes: Performing threshold screening on the node heat information to obtain a hot node set, and recording the access frequency of the hot nodes in the hot node set; Arrange the hot nodes in the hot node set in descending order of access frequency, select the hot node with the highest access frequency as the root node, and traverse the access statistics data to add child nodes to obtain a frequently accessed path tree; The frequently accessed path tree is stored in a pre-fetch table, and a path pre-fetch algorithm is applied to the pre-fetch table to generate an initial pre-fetch strategy.
4. The data pre-fetching optimization method of the high-frequency multi-core real-time controller according to claim 3 is characterized in that: The hot nodes in the hot node set are arranged in descending order according to access frequency, the hot node with the highest access frequency is selected as the root node, and the access statistics data are traversed to add child nodes to obtain a frequently accessed path tree, which includes: Arrange the hot nodes in the hot node set in descending order of access frequency, and select the node with the highest access frequency as the root node; Traversing access statistics, finding a subsequent access sequence of the traversed hotspot node within a statistical period, and sequentially connecting the hotspot nodes in the subsequent access sequence that also belong to the hotspot node set to form a path starting from the traversed hotspot node; Determine whether the path overlaps with an existing path, and if so, merge the overlapping parts and increase the weight of the overlapping path segment; The hotspot nodes without subsequent access sequences are added to the tree as independent leaf nodes, and the above steps of traversing the access statistics are repeated until all hotspot nodes are processed to obtain a frequently visited path tree.
5. The data pre-fetching optimization method of the high-frequency multi-core real-time controller according to claim 3 is characterized in that: The storing the frequently accessed path tree into a prefetch table and applying a path prefetch algorithm to the prefetch table to generate an initial prefetch strategy includes: Initialize the prefetch distance parameter d, and traverse the nodes in the frequently visited path tree. Use the hash index to quickly find the matching path in the prefetch table for the current node around the traversed node. If a fully matched path is found, the next d prefetch nodes are prefetched along the fully matched path into the prefetch sequence; If no exact match is found, the longest prefix match strategy is used to calculate the common prefix of the current node and each path in the prefetch table, and the path with the longest common prefix is selected as the prefetch path; Along the selected prefetch path, check whether the node is already in the cache one by one. If not, initiate a prefetch request and add the node to the prefetch sequence; According to the position of the nodes in the prefetch sequence in the path, the path weight and the node heat value, the prefetch priority is calculated, and the prefetch sequence is sorted according to the prefetch priority to obtain the initial prefetch strategy.
6. The data pre-fetching optimization method of the high-frequency multi-core real-time controller according to claim 5, characterized in that: The dynamically adjusting the initial prefetch strategy according to the current system load of the high-frequency multi-core real-time controller to obtain an optimized prefetch strategy includes: Periodically collecting the current system load of the high-frequency multi-core real-time controller, and calculating the load score of the current system load using a weighted summation method; Based on the load score, the prefetch distance parameter d is dynamically adjusted using a piecewise function, and the initial prefetch sequence is pruned or extended according to the adjusted prefetch distance d; The expected benefit and execution cost of each prefetch operation in the modified prefetch sequence are calculated, and based on the ratio of the expected benefit to the execution cost, the modified prefetch sequence is dynamically adjusted to obtain an optimized prefetch strategy.
7. The data pre-fetching optimization method of the high-frequency multi-core real-time controller according to claim 1, characterized in that: Based on the optimized prefetch strategy, a jump pointer queue is created for the target data corresponding to the data access behavior to obtain a fast access structure, and a data prefetch operation is performed on the target data using the fast access structure to obtain a preloaded data set including: According to the optimized prefetch strategy, a target data set for which a jump pointer needs to be created is identified, and a data access sequence in the form of a linked list is constructed for each data item in the target data set; On the basis of the data access sequence, jump pointers are added according to predefined jump intervals to form a multi-level jump structure, and the constructed multi-level jump structure is organized into a jump pointer queue, the head of the jump pointer queue points to the most recently accessed data item, and a cursor is maintained for each jump pointer queue to point to the currently active data item; Build a hash table as a fast access structure, with the key being the unique identifier of the data item and the value being the corresponding jump pointer queue; The fast access structure is used to perform a data pre-fetch operation on the target data to obtain a pre-loaded data set.
8. A data pre-fetching optimization system for a high-frequency multi-core real-time controller, characterized in that: The data pre-fetching optimization system of the high-frequency multi-core real-time controller comprises: A behavior monitoring module, used to perform multi-level query monitoring on the data access behavior of the high-frequency multi-core real-time controller, obtain access statistics, and generate node heat information based on the counters of the nodes in the tree data structure used by the high-frequency multi-core real-time controller; A strategy generation module, used to establish a pre-fetch table based on the node heat information and access statistics, and use a preset path pre-fetch algorithm on the pre-fetch table to obtain an initial pre-fetch strategy; A strategy adjustment module, used for dynamically adjusting the initial pre-fetch strategy according to the current system load of the high-frequency multi-core real-time controller to obtain an optimized pre-fetch strategy; The fast access module is used to create a jump pointer queue for the target data corresponding to the data access behavior based on the optimized prefetch strategy, obtain a fast access structure, and use the fast access structure to perform a data prefetch operation on the target data to obtain a preloaded data set.
Citation Information
Cited By
ROM (Read Only Memory) reading acceleration method and system based on low-power-consumption dynamic optimization
CN121029633A