A method and system for ensuring hard real-time tasks based on multi-core heterogeneous architecture
By dividing task types and performing core mapping in a multi-core heterogeneous architecture, combined with deterministic quantization analysis and interrupt dynamic optimization, the problems of cache pollution and interrupt interference in hard real-time tasks are solved, and the time determinism and system stability of hard real-time tasks are achieved.
Patent Information
- Application Number
- CN202610733633.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-26
- Publication Date
- 2026-11-17
- Estimated Expiration
- 2046-05-26
AI Technical Summary
When handling mixed critical task loads, existing multi-core heterogeneous architectures are susceptible to cache pollution, bus contention, and sudden interrupts in hard real-time tasks, resulting in insufficient determinism in execution time. Existing scheduling schemes lack effective closed-loop feedback and dynamic adjustment mechanisms, making it difficult for the system to guarantee the timely completion of hard real-time tasks.
By classifying and dividing tasks, hard real-time tasks are bound to high-performance core clusters, while non-real-time tasks are scheduled to energy-efficient core clusters. Combined with deterministic quantization analysis and interrupt dynamic optimization, pipeline parameters are monitored in real time, and preemption order and interrupt response thresholds are dynamically adjusted to provide a deterministic execution window, isolate hardware resources, and suppress interference.
Effectively isolate hardware resources for hard real-time tasks and non-real-time tasks, reduce timing jitter, ensure the deterministic execution of hard real-time tasks, and improve the application performance of multi-core architecture in highly deterministic real-time scenarios.
Smart Images

Figure CN122711299B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of real-time embedded system technology, and more specifically, to a method and system for ensuring hard real-time tasks based on a multi-core heterogeneous architecture. Background Technology
[0002] With the continuous advancement of embedded systems and industrial control technologies, high-performance multi-core processors are increasingly being deployed in key fields such as aerospace, intelligent manufacturing, and autonomous driving. In these application scenarios, the system must simultaneously process two types of tasks with very different characteristics: one is hard real-time tasks, such as high-frequency sensor pulse signal processing and actuator control instructions, whose execution process requires strict time determinism, and any slight delay or jitter may cause system-level failures; the other is non-real-time tasks, such as network protocol stack data processing and user interaction data streams, which are characterized by strong bursts and large data throughput, and are prone to system resource fluctuations.
[0003] Current general-purpose multi-core architectures reveal several deep-seated technical bottlenecks when dealing with mixed mission-critical workloads. The deep isolation mechanism of the physical execution environment is significantly insufficient. Although symmetric multiprocessor scheduling strategies can maintain basic load balancing, in hardware resource sharing areas, such as L2 / L3 caches and the system bus, sudden memory access requests from non-real-time tasks can easily lead to cache pollution and bus resource contention in high-performance cores. This significantly increases the worst-case execution time of hard real-time tasks, severely impairing the predictability of task execution.
[0004] The ability to quantify and dynamically suppress hardware interrupt interference is also weak. In scenarios where interface data load surges, such as when encountering a network interrupt storm, traditional interrupt controllers rely on static priority configuration and cannot dynamically adjust interrupt response behavior based on the real-time execution status of hard real-time tasks. This causes a large number of interrupts generated by non-real-time tasks to frequently interrupt the instruction pipeline, resulting in uncontrollable time jitter in hard real-time tasks.
[0005] Furthermore, the real-time assurance mechanism lacks effective closed-loop feedback capabilities. Existing scheduling schemes are mostly based on preset static criteria, failing to continuously monitor the processor's underlying pipeline operation status, including key parameters such as instruction pipeline pause cycles and cache miss wait cycles. Consequently, they cannot optimize resource allocation strategies in real time based on the deterministic changes in the execution of hard real-time tasks. When hardware resource conflicts reach a critical point, the system struggles to ensure the timely completion of hard real-time tasks through precise preemption control and time window compensation mechanisms. These issues collectively limit the application performance of multi-core heterogeneous architectures in highly deterministic real-time scenarios.
[0006] To address the aforementioned issues, existing technologies urgently need improvement. Summary of the Invention
[0007] The purpose of this invention is to provide a method and system for ensuring hard real-time tasks based on a multi-core heterogeneous architecture. This method can effectively isolate the hardware resources of hard real-time tasks from those of non-real-time tasks, suppress the interference of non-real-time tasks on the execution of hard real-time tasks, reduce the time jitter of hard real-time tasks, and ensure the time determinism of hard real-time task execution.
[0008] The above-mentioned technical objective of the present invention is achieved through the following technical solution:
[0009] A method for ensuring hard real-time tasks based on a multi-core heterogeneous architecture, the method comprising the following steps:
[0010] Step S1. Task classification and division: Obtain the set of tasks to be processed, and divide the set of tasks into hard real-time tasks and non-real-time tasks according to real-time requirements; wherein, the hard real-time tasks are composed of high-frequency pulse signals, and the non-real-time tasks are composed of network data and interactive data;
[0011] Step S2. Heterogeneous core mapping: Based on the core affinity mechanism, the hard real-time task is bound to the high-performance core cluster of the processor for execution, and the non-real-time task is scheduled to the energy-efficient core cluster of the processor for execution;
[0012] Step S3. Deterministic Quantization Analysis: Monitor the instruction pipeline parameters of the processor in real time, calculate the deterministic index of each task in the task set in the current execution cycle; and based on the deterministic index, establish a task preemption priority criterion, and use the criterion to adjust the preemption order of the task ready queue in real time.
[0013] Step S4. Interrupt Dynamic Optimization: Dynamically adjust the response threshold of the interrupt controller according to the deterministic index. By adjusting the interrupt weight of the non-real-time task, provide a time window for deterministic execution of the high-performance core cluster, compensate for the time loss of the hard real-time task during execution, and ensure execution determinism.
[0014] Furthermore, the specific method for step S1 is as follows:
[0015] S11. Establish task feature vectors And logically divide the task set using preset classification operators; among which, For task trigger frequency, This represents the worst-case execution time of the task. Tolerance threshold for jitter;
[0016] S12. If the judgment condition is met If so, the task is classified as a hard real-time task and marked as high priority; among which, This is the lower limit of the high-frequency pulse frequency. The time jitter threshold;
[0017] If the above criteria are not met, and the task payload is network data or interactive data, then the task is determined to be a non-real-time task and marked as a normal priority task.
[0018] Furthermore, the specific method for step S2 is as follows:
[0019] Based on the core affinity mechanism, the hard real-time tasks and non-real-time tasks are spatially decoupled:
[0020] S21. Bind the hard real-time task to the high-performance core cluster for execution, and enable hardware-level cache partitioning to isolate the cache and ensure the cache hit rate of the hard real-time task;
[0021] S22. Restrict the execution of the non-real-time tasks to the energy-efficient core cluster and prohibit the non-real-time tasks from being scheduled to the high-performance core cluster across clusters.
[0022] Furthermore, the specific method for step S3 is as follows:
[0023] S31. Collect underlying pipeline data in real time through the processor's performance monitoring unit, and calculate the deterministic index of each hard real-time task in the current execution cycle according to the following formula;
[0024]
[0025] in, As a certainty index, The instruction pipeline pause cycle. For cache missing wait period, For bus conflict delay, The total number of clock cycles. This represents the utilization rate of the shared bus by non-real-time tasks. This represents the bus contention interference coefficient.
[0026] S32. Based on the deterministic index, establish the task preemption priority criterion according to the following formula;
[0027]
[0028] in, Priority criteria for task preemption As a timeliness weighting factor, To allow for a jitter threshold, This is a weighting factor for certainty risk.
[0029] Furthermore, the specific method for step S4 is as follows:
[0030] S41. The dynamic adjustment of the response threshold specifically includes:
[0031] When the deterministic index is detected When the threshold is lower than the preset safety threshold, the setup time is... The terminal suppression window, in which, , As a dynamic adjustment factor, Duration of the sudden interruption;
[0032] S42. The adjustment of interrupt weights for non-real-time tasks specifically includes:
[0033] Within the terminal suppression window, the interrupt requests of the non-real-time tasks are masked or downgraded in priority by the interrupt controller.
[0034] A hard real-time task assurance system based on a multi-core heterogeneous architecture includes:
[0035] Task classification module: Used to acquire the set of tasks to be processed and classify the set of tasks into hard real-time tasks and non-real-time tasks according to real-time requirements; wherein, the hard real-time tasks are composed of high-frequency pulse signals, and the non-real-time tasks are composed of network data and interactive data;
[0036] Heterogeneous core mapping module: Used to bind the hard real-time tasks to the high-performance core cluster of the processor for execution based on the core affinity mechanism, and to schedule the non-real-time tasks to the energy-efficient core cluster of the processor for execution;
[0037] Deterministic Quantization Analysis Module: Used to monitor the instruction pipeline parameters of the processor in real time, calculate the deterministic index of each task in the task set in the current execution cycle; and based on the deterministic index, establish a task preemption priority criterion, and use the criterion to adjust the preemption order of the task ready queue in real time.
[0038] Interrupt dynamic optimization module: Used to dynamically adjust the response threshold of the interrupt controller according to the deterministic index. By adjusting the interrupt weight of the non-real-time task, it provides a time window for deterministic execution of the high-performance core cluster, compensates for the time loss of the hard real-time task during execution, and ensures execution determinism.
[0039] In summary, the present invention has the following beneficial effects:
[0040] By classifying tasks into hard real-time and non-real-time categories, and then using heterogeneous core mapping to allocate the two types of tasks to different core clusters to achieve spatial decoupling, deterministic quantitative analysis is used to evaluate the execution determinism in real time and adjust the preemption order. Finally, interrupt dynamic optimization is used to reserve a deterministic execution window for hard real-time tasks. This solves the technical problem that existing multi-core architectures are prone to cache pollution, bus contention and sudden interrupt interference when handling mixed critical tasks, resulting in insufficient determinism in the execution time of hard real-time tasks. It can effectively ensure the timely completion of hard real-time tasks, improve the application performance of multi-core architecture in high deterministic real-time scenarios, and has the advantages of effectively isolating resources, suppressing interference, and ensuring the determinism of hard real-time task execution time. Attached Figure Description
[0041] Figure 1 This is a schematic diagram of the hard real-time task guarantee method based on a multi-core heterogeneous architecture according to the present invention.
[0042] Figure 2 This is a schematic diagram of the hard real-time task guarantee system based on a multi-core heterogeneous architecture according to the present invention. Detailed Implementation
[0043] To make the technical means, creative features, objectives and effects of this invention easier to understand, the invention will be further described below with reference to the figures and specific embodiments.
[0044] like Figure 1 As shown, this application proposes a hard real-time task guarantee method based on a multi-core heterogeneous architecture. The method classifies tasks into hard real-time tasks and non-real-time tasks. Based on heterogeneous core mapping, hard real-time tasks are bound to the high-performance core clusters of the processor for execution, while non-real-time tasks are scheduled to the energy-efficient core clusters. Through deterministic quantization analysis, the processor's instruction pipeline parameters are monitored in real time to calculate the deterministic index of each task in the task set within the current execution cycle, and a task preemption priority criterion is established to adjust the preemption order of the task ready queue. Finally, through interrupt dynamic optimization, the response threshold of the interrupt controller is dynamically adjusted according to the deterministic index, and the interrupt weight of non-real-time tasks is adjusted to provide a time window for deterministic execution of the high-performance core clusters, compensating for the time loss of hard real-time tasks during execution and ensuring execution determinism.
[0045] For ease of understanding, the following explains some key terms in this embodiment:
[0046] Multi-core heterogeneous architecture refers to a processor containing multiple processing cores that can work independently or collaboratively, and whose operating frequencies, power consumption modes, or scheduling strategies may differ, thus forming a heterogeneous computing environment.
[0047] Hard real-time tasks refer to tasks with strict deadlines for execution; any delay or jitter in these tasks may lead to system malfunction or serious consequences. These tasks are typically driven by high-frequency pulse signals, such as sensor data acquisition or actuator control.
[0048] Non-real-time tasks refer to tasks that do not have strict deadlines for execution, allowing for delays or fluctuations within a certain range. These tasks typically consist of network data transmission or user interaction data processing.
[0049] Core affinity refers to an operating system or hardware-level mechanism used to bind specific tasks or threads to specific processor cores or core clusters for execution, in order to reduce task migration overhead, optimize cache utilization, and achieve resource isolation.
[0050] High-performance core clusters refer to a group of cores in a processor designed specifically for computationally intensive and low-latency applications, typically featuring higher clock frequencies, larger caches, and stronger single-threaded performance.
[0051] An energy-efficient core cluster refers to a group of cores in a processor designed for low-power and high-throughput applications. They typically have lower clock frequencies and power consumption and are suitable for handling background tasks or tasks with low real-time requirements.
[0052] Instruction pipeline parameters refer to various indicators that reflect the pipeline status and performance during the execution of instructions within the processor, such as pipeline pause cycles, cache miss wait cycles, bus conflict latency, etc. These parameters directly affect the actual execution time of the task.
[0053] The determinism index is an indicator that quantifies the degree of certainty in task execution. It is calculated by comprehensively analyzing factors such as instruction pipeline parameters and is used to assess whether a task can be completed on time within the current execution cycle.
[0054] Task preemption priority criteria refer to the rules or algorithms used to determine the preemption order of tasks in the ready queue. These criteria are dynamically generated based on factors such as the task's determinism index to ensure that tasks with high deterministic requirements have priority in obtaining processor resources.
[0055] An interrupt controller is a component in a processor system responsible for managing and distributing hardware interrupt requests. It receives interrupt signals from external devices and forwards them to the corresponding processor cores according to preset priorities and policies.
[0056] The response threshold is a configurable parameter of the interrupt controller when processing interrupt requests. The interrupt will only be responded to and processed when the priority or strength of the interrupt request reaches or exceeds this threshold.
[0057] Interrupt weights refer to the priority or importance level assigned to a specific task or interrupt source. By adjusting interrupt weights, the degree of impact of different interrupt requests on the processor's execution flow can be controlled.
[0058] A deterministic execution time window refers to a continuous period of processor execution time reserved for a specific task (usually a hard real-time task). During this period, the execution of the task will not be interrupted by other low-priority tasks or interrupts, thus ensuring its deterministic execution.
[0059] This embodiment provides a method for ensuring hard real-time tasks based on a multi-core heterogeneous architecture, and the specific implementation is as follows:
[0060] In terms of task classification, after obtaining the set of tasks to be processed, the task set is divided into hard real-time tasks and non-real-time tasks according to real-time requirements. Among them, hard real-time tasks consist of high-frequency pulse signals, while non-real-time tasks consist of network data and interactive data.
[0061] Regarding heterogeneous core mapping, a core affinity mechanism is used to bind hard real-time tasks to the processor's high-performance core clusters for execution, while non-real-time tasks are scheduled to run on the processor's energy-efficient core clusters. For example, the core affinity mechanism can be implemented by statically configuring a list of allowed cores for each task at operating system startup. Hard real-time tasks are configured to run only on specific cores in the high-performance core cluster, while non-real-time tasks are restricted to cores in the energy-efficient core cluster. Once set, this binding typically remains unchanged during system operation. Alternatively, the scheduler can receive hints from applications or configuration files during task scheduling, indicating which tasks are better suited to run on the high-performance core cluster and which are better suited to run on the energy-efficient core cluster. Based on these hints, the scheduler attempts to prioritize hard real-time tasks for the high-performance core cluster and non-real-time tasks for the energy-efficient core cluster.
[0062] In deterministic quantitative analysis, processor instruction pipeline parameters are monitored in real time, and the deterministic index of each task in the task set within the current execution cycle is calculated. Based on the deterministic index, a task preemption priority criterion is established, and the preemption order of the task ready queue is adjusted in real time using the criterion. For example, monitoring instruction pipeline parameters can be achieved at the operating system level by periodically reading data related to performance counters in the processor registers. Instruction completion counts, cache access counts, etc., are obtained by reading general performance counters, and then statistical values of these parameters are calculated by software. The deterministic index can be calculated based on these statistical values, for example, by using cache miss rate or pipeline pause time as primary considerations. The task preemption priority criterion can simply raise the priority of tasks with a deterministic index below a certain fixed threshold. As another implementation method, processor pipeline parameter monitoring can be performed using a sampling method, that is, sampling key pipeline events at fixed time intervals within each task execution cycle, such as recording instruction commit rate and branch prediction failure rate. The deterministic index can be calculated based on these sampled data using methods such as weighted averaging. The task preemption priority criterion can dynamically adjust the relative position of a task in the ready queue based on the degree of deviation between the deterministic index and the preset benchmark value.
[0063] In terms of dynamic interrupt optimization, the response threshold of the interrupt controller is dynamically adjusted based on the deterministic index. By adjusting the interrupt weights of non-real-time tasks, a time window for deterministic execution is provided for the high-performance core cluster, compensating for the time loss during the execution of hard real-time tasks and ensuring execution determinism. For example, the response threshold of the interrupt controller can be dynamically adjusted according to the deterministic index of the hard real-time task. When the deterministic index of the hard real-time task decreases, the interrupt controller can be configured to increase its response threshold, thereby reducing the response to low-priority interrupts. The interrupt weights of non-real-time tasks can be implemented by modifying the priority settings in the interrupt vector table, assigning them lower priority during the execution of hard real-time tasks. As another implementation, when the deterministic index of a hard real-time task indicates that it faces risk, the system can initiate a deterministic execution time window of a preset duration. Within this window, the interrupt controller can temporarily ignore all interrupt requests from non-real-time tasks or reduce their priority to the lowest level until the window ends. This approach provides the hard real-time task with an undisturbed execution time to compensate for its potential time loss.
[0064] This application achieves physical isolation between hard real-time tasks and non-real-time tasks through task classification and heterogeneous core mapping, effectively reducing cross-core resource interference. Through deterministic quantization analysis, it monitors the underlying pipeline status in real time and dynamically adjusts task preemption order, solving the problem of lacking closed-loop feedback. Combined with dynamic interrupt optimization, it suppresses the interference of hardware interrupts on hard real-time tasks, thereby ensuring the deterministic execution of hard real-time tasks and avoiding system failures in fields such as aerospace, intelligent manufacturing, and autonomous driving.
[0065] In some of the solutions mentioned above in this application, task classification is proposed to obtain a set of tasks to be processed, and the task set is divided into hard real-time tasks and non-real-time tasks according to real-time requirements. However, in this process, only the composition of the two types of tasks is clarified, but no clear and executable classification criteria are given. This can easily lead to inaccurate task classification. Incorrect classification will cause subsequent core mapping, scheduling and safeguards to fail to work correctly on hard real-time tasks, ultimately undermining the determinism of hard real-time task execution and failing to meet the timeliness requirements of hard real-time tasks.
[0066] In this regard, this application further proposes the following steps for task classification:
[0067] S11. Establish task feature vectors And logically divide the task set using preset classification operators; among which, For task trigger frequency, This represents the worst-case execution time of the task. Tolerance threshold for jitter;
[0068] S12. If the judgment condition is met If so, the task is classified as a hard real-time task and marked as high priority; among which, This is the lower limit of the high-frequency pulse frequency. The time jitter threshold;
[0069] If the above criteria are not met, and the task payload is network data or interactive data, then the task is determined to be a non-real-time task and marked as a normal priority task.
[0070] Specifically, in step S11, the task feature vector is a set of parameters used to quantify and describe the real-time attributes of a task. Its purpose is to accurately capture the real-time requirements and behavioral patterns of the task, avoiding the limitations of classification based solely on experience or simple rules. This vector consists of the task trigger frequency, the worst-case execution time, and the permissible jitter threshold. The task trigger frequency characterizes the rate at which the task is activated; for hard real-time tasks composed of high-frequency pulse signals, this is a key indicator. The worst-case execution time refers to the maximum time required for the task to complete execution under the most unfavorable system conditions, and is an important parameter for evaluating the task's timeliness constraints. The permissible jitter threshold represents the allowable fluctuation range of the task's completion time relative to its expected deadline; hard real-time tasks typically have a very low permissible jitter threshold. These parameters can be obtained and calculated through static analysis of the task code, dynamic monitoring of task execution behavior, or in conjunction with system design specifications. For example, the worst-case execution time can be determined using static timing analysis tools or by running the task under worst-case conditions and measuring its execution time; the task trigger frequency and permissible jitter threshold are usually set by the system designer according to application requirements.
[0071] A predefined classification operator is an algorithm or model used to logically divide a task set based on task feature vectors. Its function is to assist the system in performing preliminary, structured classification of tasks, providing a basis for subsequent accurate judgment. This operator can be implemented in various ways, such as a rule-based classifier that divides tasks according to predefined logical rules (e.g., "If the task trigger frequency is greater than X and the worst-case execution time is less than Y, then classify them into one category").
[0072] In step S12, the determination condition This is a logical expression used to determine whether a task meets the stringent requirements of a hard real-time task. Its role is to serve as the core standard for identifying hard real-time tasks, ensuring that only tasks with truly high timeliness and low jitter requirements are classified as hard real-time tasks. This criterion typically includes a lower limit for the high-frequency pulse frequency and a time jitter threshold. The lower limit for the high-frequency pulse frequency defines the minimum required trigger frequency for a hard real-time task, while the time jitter threshold defines the maximum allowable time jitter for a hard real-time task. These thresholds are usually precisely set by the system designer based on specific application scenarios and security requirements. When a task meets the criterion, it is determined to be a hard real-time task and marked as high priority. The task priority label is an attribute assigned to a task to indicate its importance in system resource contention, providing clear guidance for the scheduler and ensuring that hard real-time tasks receive priority resource allocation and execution opportunities. If the above criterion is not met, and the task payload is network data or interactive data, the task is determined to be a non-real-time task and marked as ordinary priority. Task payload refers to the data type or source of the data processed by a task. It serves as an auxiliary condition for determining non-real-time tasks because network data and interactive data are typically characterized by burstiness, large data volumes, and relatively low real-time requirements, contrasting with the characteristics of hard real-time tasks. The system can identify the payload type by examining the task's data source, packet type, or the task's business logic.
[0073] By addressing the lack of clear and executable judgment criteria in task classification, this application proposes a classification method based on task feature vectors and explicit judgment conditions. Specifically, by establishing task feature vectors that include task trigger frequency, worst-case execution time, and permissible jitter thresholds, the real-time attributes of tasks can be comprehensively and quantitatively characterized, avoiding the drawbacks of classification based solely on experience or fuzzy rules. Based on this, a pre-defined classification operator is used to perform preliminary logical division of the task set, laying the foundation for subsequent accurate judgment. Furthermore, by setting explicit judgment conditions, combined with the lower limit of high-frequency pulse frequency and time jitter threshold, hard real-time tasks can be accurately identified and marked as high priority. This ensures that hard real-time tasks are correctly identified and prioritized in subsequent safeguards such as heterogeneous core mapping, deterministic quantization analysis, and interrupt dynamic optimization. Simultaneously, tasks that do not meet the hard real-time judgment conditions and whose payload is network data or interactive data are classified as non-real-time tasks and marked as ordinary priority, further improving classification accuracy and avoiding the negative impact of misclassification on system real-time performance. This refined task classification mechanism provides an accurate basis for subsequent resource isolation, scheduling optimization, and interrupt management, enabling the entire system to more effectively guarantee the deterministic execution of hard real-time tasks, thereby meeting their strict timeliness requirements and effectively solving the problem of hard real-time task guarantee failure caused by inaccurate task classification.
[0074] In some of the embodiments described above in this application, heterogeneous core mapping is proposed to bind hard real-time tasks to high-performance processor core clusters and schedule non-real-time tasks to energy-efficient core clusters for execution. However, in its implementation, only the initial allocation of tasks is completed, without achieving deep spatial isolation between the two types of task execution environments. The two types of tasks will still compete and interfere with each other at the level of shared hardware resources such as caches. At the same time, the original scheduling mechanism cannot restrict non-real-time tasks from entering high-performance core clusters across clusters, which will still cause non-real-time tasks to interfere with the execution of hard real-time tasks, destroy the deterministic execution of hard real-time tasks, and fail to meet the real-time guarantee requirements of hard real-time tasks.
[0075] In response, this application further proposes a specific method for spatially decoupling the hard real-time task from the non-real-time task based on a core affinity mask, including:
[0076] S21. Bind the hard real-time task to the high-performance core cluster for execution, and enable hardware-level cache partitioning to isolate the cache and ensure the cache hit rate of the hard real-time task;
[0077] S22. Restrict the execution of the non-real-time tasks to the energy-efficient core cluster and prohibit the non-real-time tasks from being scheduled to the high-performance core cluster across clusters.
[0078] Core affinity masking is an operating system or hardware-level mechanism used to specify which processor cores one or more tasks can execute on. It is typically represented as a bitmask, where each bit corresponds to a processor core. When a task is assigned a specific core affinity mask, the scheduler ensures that the task runs only on the available cores specified in the mask. For example, core affinity can be set using APIs provided by the operating system, or CPU affinity can be specified in a real-time operating system (RTOS) through task creation or configuration functions. Spatial decoupling refers to isolating different types of tasks or their execution environments at a physical or logical level to reduce or eliminate mutual interference. This can be reflected in processor core allocation, cache resource partitioning, and memory region protection. For example, in addition to core-level decoupling through core affinity masks, independent address spaces can be set through the Memory Management Unit (MMU), or independent virtual machine environments can be provided for different tasks through virtualization technology.
[0079] Binding hard real-time tasks to high-performance core clusters aims to fully utilize their powerful processing capabilities to meet the stringent timing requirements of these tasks. High-performance core clusters typically consist of processor cores with higher clock speeds, greater computing power, and larger caches. This binding can be achieved by specifying a core affinity mask during task creation or by configuring a scheduler policy at system startup to assign specific task groups to high-performance core clusters. Enabling hardware-level cache partitioning for cache isolation involves using processor hardware features to divide shared caches (such as L2 / L3 caches) into multiple independent regions and assigning dedicated cache regions to different tasks or core clusters. For example, some modern processors support Memory Partitioning and Monitoring (MPAM) or cache allocation techniques, allowing software to configure cache allocation policies to ensure that hard real-time tasks have independent cache space, preventing cache access by non-real-time tasks from polluting them. Another approach is to configure a cache controller to force data within a specific address range to be mapped to a specific cache region, or in multi-core processors, to configure an independent cache for each core cluster, thereby achieving physical isolation. Ensuring a cache hit rate for hard real-time tasks means using the aforementioned cache isolation measures to stabilize and increase the probability that the data required by a hard real-time task is already in the cache when accessing data, thereby reducing memory access latency and improving execution efficiency and determinism.
[0080] Restricting non-real-time tasks to energy-efficient core clusters aims to effectively utilize the heterogeneity of processors, reducing overall system power consumption while meeting the processing needs of non-real-time tasks and preventing them from consuming high-performance core resources. Energy-efficient core clusters typically consist of processor cores with lower power consumption and lower clock speeds, yet still providing sufficient computing power. This restriction can be achieved through core affinity masks or scheduler configuration, limiting the scheduling scope of all non-real-time tasks to energy-efficient core clusters. Prohibiting non-real-time tasks from being scheduled across clusters to high-performance core clusters refers to strictly preventing non-real-time tasks from migrating from their assigned energy-efficient core clusters to high-performance core clusters through scheduling policies or hardware configuration. This can be achieved by setting strict affinity rules in the operating system scheduler, for example, setting the affinity mask of high-performance core clusters to allow only hard real-time tasks to access them, or at the hardware level, ensuring that non-real-time tasks cannot cross boundaries by configuring task migration permissions between cores.
[0081] Through the above technical solution, this application further achieves deep spatial isolation between the runtime environments of hard real-time tasks and non-real-time tasks based on heterogeneous core mapping. Specifically, by spatial decoupling based on core affinity masks, the processor's existing core affinity control mechanism can be leveraged to achieve fine-grained management of the task execution scope at a relatively low additional cost. Binding hard real-time tasks to high-performance core clusters for execution and enabling hardware-level cache partitioning to isolate the cache effectively prevents non-real-time task memory access operations from polluting the hard real-time task cache space at the hardware level, thereby stabilizing the cache hit rate of hard real-time tasks, significantly reducing additional execution latency caused by cache misses, and thus ensuring the deterministic execution of hard real-time tasks. At the same time, restricting non-real-time tasks to energy-efficient core clusters for execution and strictly prohibiting their cross-cluster scheduling to high-performance core clusters completely eliminates the possibility of non-real-time tasks occupying high-performance core resources at the scheduling rule level. This not only ensures that all computing resources of the high-performance core cluster can be dedicated to hard real-time tasks, avoiding the situation where the original scheduling mechanism might schedule non-real-time tasks to the high-performance core due to load balancing, but also achieves complete isolation between the two types of tasks at the core runtime space level, further ensuring the stability of the hard real-time task runtime environment. This effectively solves the problem of resource interference from non-real-time tasks to hard real-time tasks and meets the real-time guarantee requirements of hard real-time tasks.
[0082] In some of the solutions mentioned above in this application, deterministic quantization analysis is proposed to monitor the processor's instruction pipeline parameters in real time, calculate the deterministic index of each task in the current execution cycle, and adjust the preemption order of the task ready queue to ensure the deterministic execution of hard real-time tasks. However, in this process, there is a lack of a quantization calculation scheme that combines various interference factors in the actual operation of the processor at the underlying level, and it is also impossible to establish an accurate and executable preemption priority criterion by combining the actual execution state of the task with its own attributes. It cannot provide an accurate and reliable basis for the dynamic adjustment of the preemption order, and it is still easy for the scheduling priority of hard real-time tasks to be unreasonable, resulting in insufficient execution determinism.
[0083] In this regard, this application further proposes a specific method for deterministic quantitative analysis, including the following steps:
[0084] S31. Collect underlying pipeline data in real time through the processor's performance monitoring unit, and calculate the deterministic index of each hard real-time task in the current execution cycle according to the following formula;
[0085]
[0086] in, As a certainty index, The instruction pipeline pause cycle. For cache missing wait period, For bus conflict delay, The total number of clock cycles. This represents the utilization rate of the shared bus by non-real-time tasks. This represents the bus contention interference coefficient.
[0087] S32. Based on the deterministic index, establish the task preemption priority criterion according to the following formula;
[0088]
[0089] in, Priority criteria for task preemption As a timeliness weighting factor, To allow for a jitter threshold, This is a weighting factor for certainty risk.
[0090] In step S31, the processor's performance monitoring unit (PMU) collects low-level pipeline data in real time. The PMU is a hardware module commonly integrated in modern multi-core processors, capable of monitoring various performance events within the processor in real time with minimal overhead. For example, it can obtain data such as instruction execution cycles, cache access statistics, and bus transactions by reading specific hardware registers (such as PMCCNTR and PMCR in the ARM architecture). This real-time acquisition method ensures that the acquired data accurately reflects the actual running status of the current hard real-time task on the processor, rather than a static or estimated value. The low-level pipeline data includes key indicators such as instruction pipeline pause cycles, cache miss wait cycles, and bus conflict latency. These indicators directly quantify the latency caused by hardware resource contention or internal bottlenecks during the execution of hard real-time tasks.
[0091] Based on this, the deterministic index of each hard real-time task within the current execution cycle is calculated using the following formula. The deterministic index is a comprehensive quantitative indicator used to assess the degree of uncertainty interference experienced by the hard real-time task within the current execution cycle. This formula not only considers the instruction pipeline pause cycle, cache miss wait cycle, and bus conflict latency of the hard real-time task itself—key factors reflecting the task's execution efficiency and local resource contention—but also innovatively introduces the shared bus occupancy rate of non-real-time tasks and the bus contention interference coefficient. The shared bus occupancy rate of non-real-time tasks measures the intensity and duration of their access to shared bus resources within the current cycle, while the bus contention interference coefficient is an empirical or model parameter used to quantify the degree of interference caused by this occupancy to the hard real-time task. By incorporating these factors into the calculation, the deterministic index can more comprehensively and accurately reflect the actual execution determinism of hard real-time tasks in a multi-core heterogeneous architecture, especially when subjected to cross-core interference from non-real-time tasks.
[0092] Further, in step S32, a task preemption priority criterion is established based on the deterministic index calculated above. The task preemption priority criterion... This is a dynamically generated value used to guide the preemption order adjustment of the task ready queue. The criterion fully considers the timeliness requirements of the tasks and the current deterministic risks. Among them, the timeliness weight factor... This is a preset parameter used to characterize the time sensitivity of a task. Tolerance jitter threshold. This is the maximum tolerable time deviation during task execution. This value is typically determined during the task design phase and is closely related to the task's real-time requirements. (Deterministic risk weighting factor) This is also a preset parameter used to adjust the degree of influence of the certainty index on the preemption priority criterion, reflecting the system's sensitivity to current certainty risks. For example, when the system has extremely high certainty requirements, a higher certainty risk weight factor can be set so that even small changes in the certainty index can significantly affect the preemption priority.
[0093] Through the above technical solution, this application effectively addresses the problem in existing technologies of lacking a quantitative calculation scheme that incorporates various interference factors during the actual operation of the processor at the underlying level. By collecting underlying pipeline data in real time through the processor performance monitoring unit, and combining this data with instruction pipeline pause cycles, cache miss wait cycles, bus conflict latency, and the occupancy rate and bus contention interference coefficient of non-real-time tasks on the shared bus, a deterministic index that truly and accurately reflects the degree of determinism in the current execution of hard real-time tasks can be obtained. This enables the system to perceive and quantify various uncertainties faced by hard real-time tasks at the underlying hardware level, including cross-core interference from non-real-time tasks, thus providing a solid data foundation for subsequent scheduling decisions.
[0094] Building upon this foundation, this application further addresses the problem of not being able to establish accurate and executable preemption priority criteria by combining the actual execution status of a task with its own attributes. By combining a real-time calculated deterministic index with the task's own timeliness weight factor, jitter tolerance threshold, and deterministic risk weight factor, a task preemption priority criterion is dynamically established. This criterion not only considers the task's pre-set real-time requirements and importance, but more importantly, it can adaptively adjust based on the task's current actual execution deterministic risk. For example, when the deterministic index of a hard real-time task significantly decreases, indicating a high degree of uncertainty risk, even if its static priority is not high, this criterion can dynamically increase its preemption priority to ensure it can obtain processor resources in a timely manner. This avoids the problem of unreasonable scheduling priorities for hard real-time tasks that may be caused by traditional static priority scheduling, thus providing an accurate and reliable basis for adjusting the preemption order of the task ready queue.
[0095] Combining the aforementioned task classification and heterogeneous core mapping implementation methods, the deterministic quantification analysis and preemption priority criteria established in this application form a closed-loop real-time guarantee mechanism. First, by spatially decoupling hard real-time tasks and non-real-time tasks and binding them to different core clusters for execution, initial cross-core interference is effectively reduced. Based on this, the deterministic quantification analysis mechanism of this application can monitor and quantify residual, dynamic interference (such as bus contention) in real time and dynamically adjust the preemption priority of tasks accordingly. This enables the system to achieve isolation not only at the macro level but also, at the micro level, further guarantee the determinism of hard real-time task execution through real-time feedback and dynamic adjustment, effectively compensating for the time loss that hard real-time tasks may encounter during execution, thereby significantly improving the guarantee capability of hard real-time tasks under a multi-core heterogeneous architecture.
[0096] In some of the solutions mentioned above in this application, interrupt dynamic optimization is proposed to dynamically adjust the response threshold of the interrupt controller according to the deterministic index, adjust the interrupt weight of non-real-time tasks, provide a time window for deterministic execution of hard real-time tasks, and ensure the deterministic execution of hard real-time tasks. However, existing interrupt optimization methods lack a dynamic adjustment mechanism that combines the current deterministic state of hard real-time task execution, and cannot accurately determine the timing and duration of suppressing non-real-time interrupts. Either excessive suppression of interrupts affects the processing of non-real-time tasks, or insufficient suppression fails to eliminate the interference of non-real-time interrupts on hard real-time tasks, which still leads to unpredictable time loss of hard real-time tasks and cannot reliably guarantee the deterministic execution of hard real-time tasks.
[0097] In this regard, this application further proposes a specific method for step S4, including:
[0098] S41. The dynamic adjustment of the response threshold specifically includes:
[0099] When the deterministic index is detected When the threshold is lower than the preset safety threshold, the setup time is... The terminal suppression window, in which, , As a dynamic adjustment factor, Duration of the sudden interruption;
[0100] S42. The adjustment of interrupt weights for non-real-time tasks specifically includes:
[0101] Within the terminal suppression window, the interrupt requests of the non-real-time tasks are masked or downgraded in priority by the interrupt controller.
[0102] Specifically, when the determinism index is detected to be below a preset safety threshold, it means that the system has assessed in real-time that the determinism of the hard real-time task's execution is under threat. The determinism index is calculated in real-time based on processor instruction pipeline parameters (such as instruction pipeline pause cycles, cache miss wait cycles, bus conflict latency, etc.), quantifying the determinism level of the hard real-time task within the current execution cycle. The preset safety threshold is a minimum acceptable level of determinism pre-set by the system; below this threshold, the real-time performance guarantee of the hard real-time task is considered to be at risk. The monitoring process can be carried out by the processor's internal performance monitoring unit (PMU) continuously collecting low-level pipeline data and calculating the determinism index, or by the operating system-level real-time monitoring module periodically acquiring and comparing it with the preset safety threshold. Once the determinism index falls below this threshold, the subsequent interrupt suppression mechanism is triggered.
[0103] Based on this, establish a duration of The system defines a terminal suppression window. This window is a preset time period during which the system will specially handle interruption requests from non-real-time tasks to reduce interference with hard real-time tasks. The dynamic adjustment factor is a configurable or adaptive parameter used to dynamically adjust the length of the suppression window based on the current system load, the urgency of the hard real-time task, or the degree to which the deterministic index deviates from a safe threshold. For example, when the deterministic index deviates significantly from the threshold, the dynamic adjustment factor can be set to a larger value to provide a longer suppression time. The burst interruption duration refers to the typical duration of a series of intensive interruptions that may be generated by non-real-time tasks, such as the duration of an interruption storm that may be caused by network packet processing or user interaction events. This value can be obtained through historical data analysis, statistical modeling, or real-time measurement. This dynamic calculation method ensures that the length of the terminal suppression window effectively compensates for the time consumption of hard real-time tasks while avoiding unnecessary excessive suppression, thus balancing the deterministic guarantees of hard real-time tasks with the response requirements of non-real-time tasks.
[0104] Within the terminal suppression window, interrupt requests from non-real-time tasks are masked or downgraded in priority by the interrupt controller. The interrupt controller is a hardware module in the processor system responsible for managing and distributing interrupt requests; it can configure interrupt priorities and enable / disable specific interrupt sources. Masking means the interrupt controller temporarily blocks or ignores interrupt requests from non-real-time tasks, preventing them from interrupting the currently executing hard real-time task. This can be achieved by setting specific mask bits in the interrupt controller or disabling interrupts at the CPU level. Downgrading in priority means the interrupt controller temporarily lowers the interrupt priority of non-real-time tasks to a level below the execution priority of hard real-time tasks. Thus, even if a non-real-time task generates an interrupt request, as long as the hard real-time task is executing, the interrupt will not be responded to immediately, thereby avoiding preemption of the hard real-time task. Both methods effectively reduce the interference of non-real-time task interrupts on hard real-time tasks on high-performance core clusters, ensuring that hard real-time tasks execute undisturbed within critical time windows.
[0105] Through the above technical solution, this application can precisely adjust interrupt behavior based on the current deterministic state of hard real-time tasks, ensuring the deterministic execution of hard real-time tasks while minimizing the impact on non-real-time task processing. Specifically, by using a deterministic index below a preset safety threshold as the trigger condition for suppression, it can accurately identify the state where hard real-time tasks are currently interfered with and lack sufficient deterministic execution, avoiding enabling interrupt suppression when hard real-time tasks are running normally, and reducing unnecessary impact on the normal processing of non-real-time tasks. Based on the actual interference situation, the duration of the terminal suppression window is determined by combining a dynamic adjustment factor and the duration of the sudden interruption. This allows the window length to be adapted to the actual level of interference, providing sufficient time for hard real-time tasks to compensate for execution losses without excessively extending the suppression time and affecting the overall task processing efficiency of the system. The adjustment operation is restricted to the terminal suppression window that has been identified as needing protection. Only within this window are interrupt requests from non-real-time tasks masked or downgraded in priority. This effectively prevents interrupts from non-real-time tasks from preempting resources and disrupting the instruction pipeline of hard real-time tasks when they need deterministic execution, thus eliminating the jitter caused by non-real-time interrupts. At the same time, it does not affect the interrupt response of non-real-time tasks in the long term. This is in line with the characteristic that non-real-time tasks have lower requirements for response timeliness, and balances the deterministic protection of hard real-time tasks with the overall task processing capacity of the system.
[0106] In some of the solutions mentioned above in this application, a hard real-time task guarantee method based on a multi-core heterogeneous architecture is proposed to solve the problems of hard real-time task execution being easily interfered with by non-real-time tasks and insufficient execution determinism in existing multi-core architectures. However, in this process, only the execution steps of the method are disclosed, without proposing a corresponding functional module architecture that can be implemented in an engineering manner. It is impossible to solidify each step of the method into an independent functional unit, which is not conducive to the deployment and implementation of the method in actual hardware systems, nor is it convenient for the debugging and maintenance of each functional step, and cannot meet the needs of actual product development.
[0107] For this, see Figure 2 This application proposes a hard real-time task guarantee system based on a multi-core heterogeneous architecture to implement the aforementioned hard real-time task method. It includes a task classification and partitioning module, a heterogeneous core mapping module, a deterministic quantization analysis module, and an interrupt dynamic optimization module. The task classification and partitioning module acquires a set of tasks to be processed and divides it into hard real-time tasks and non-real-time tasks according to real-time requirements. The hard real-time tasks consist of high-frequency pulse signals, while the non-real-time tasks consist of network data and interactive data. The heterogeneous core mapping module binds the hard real-time tasks to the high-performance core cluster of the processor for execution based on a core affinity mechanism, and schedules the non-real-time tasks to the energy-efficient core cluster of the processor for execution. The deterministic quantization analysis module monitors the processor's instruction pipeline parameters in real time, calculates the deterministic index of each task in the task set within the current execution cycle, and establishes a task preemption priority criterion based on the deterministic index, using the criterion to adjust the preemption order of the task ready queue in real time. The interrupt dynamic optimization module is used to dynamically adjust the response threshold of the interrupt controller according to the deterministic index. By adjusting the interrupt weight of the non-real-time task, it provides a time window for deterministic execution of the high-performance core cluster, compensates for the time loss of the hard real-time task during execution, and ensures execution determinism.
[0108] The task classification module is a fundamental component of this assurance solution. Its core function is to perform preliminary identification and classification of the input task set. This module is responsible for acquiring all tasks to be processed in the system and, based on preset real-time standards, clearly distinguishing them into hard real-time tasks with extremely high time determinism requirements and relatively lenient non-real-time tasks. Hard real-time tasks typically manifest as high-frequency pulse signals, such as sensor data acquisition or actuator control commands, and their execution must be completed within a strict time window. Non-real-time tasks, on the other hand, may consist of network data transmission or user interaction data streams, and have a higher tolerance for latency. This module can be implemented in various ways. For example, it can be implemented by a software component, such as a task manager service, which classifies tasks by analyzing their metadata (such as trigger frequency, worst-case execution time, and permissible jitter threshold) and applying preset classification rules or machine learning models. Alternatively, it can be implemented by a hardware acceleration unit, for example, by preprocessing and classifying task descriptors through firmware or programmable logic during system startup to improve classification efficiency.
[0109] The heterogeneous core mapping module, building upon the task classification and partitioning module, further refines the matching of tasks with processor core resources. Utilizing core affinity mechanisms, this module exclusively binds classified hard real-time tasks to high-performance core clusters of the processor for execution, ensuring they receive sufficient and stable computing resources. Simultaneously, it schedules non-real-time tasks to energy-efficient core clusters, thus achieving spatial decoupling of the two types of tasks at the physical level. This isolation strategy aims to minimize interference from non-real-time tasks to hard real-time tasks, such as cache pollution and bus contention. This module can be implemented through a core affinity management component within the operating system scheduler, setting CPU affinity masks to fix hard real-time tasks to high-performance core clusters and restrict non-real-time tasks to energy-efficient core clusters. Another implementation approach is through a hardware-assisted scheduling unit, such as integrating a hardware scheduler within the processor, which dynamically or statically maps tasks based on their real-time flags and the available resources of the core clusters.
[0110] The deterministic quantization analysis module is crucial for achieving closed-loop feedback control in this assurance scheme. This module monitors processor instruction pipeline parameters in real time, such as instruction pipeline pause cycles, cache miss wait cycles, bus conflict latency, and other low-level performance data. Based on this real-time data, the module calculates the deterministic index of each task in the task set within the current execution cycle. This index directly reflects the deterministic level of task execution. Subsequently, based on the calculated deterministic index, the module establishes a task preemption priority criterion and uses this criterion to adjust the preemption order of the task ready queue in real time, ensuring that tasks with high deterministic requirements are given priority for execution. This module can be implemented in several ways. First, it can be implemented by a software monitoring agent, which periodically reads register data from the processor performance monitoring unit (PMU), calculates the deterministic index, generates or updates the task preemption priority criterion according to a preset algorithm, and then transmits the criterion to the scheduler. Alternatively, it can be implemented by a dedicated hardware monitoring and analysis unit, which directly captures performance events from the processor pipeline, calculates the deterministic index and priority criterion in real time, and directly influences the scheduler's behavior through a hardware interface.
[0111] The interrupt dynamic optimization module is a crucial component of this protection scheme for handling sudden interference. This module dynamically adjusts the interrupt controller's response threshold based on the deterministic index provided by the deterministic quantization analysis module. By adjusting the interrupt weights of non-real-time tasks, such as implementing interrupt masking or priority downgrading, this module provides a deterministic execution time window for hard real-time tasks in the high-performance core cluster. This aims to compensate for the time loss that may occur during the execution of hard real-time tasks due to external interrupts, thereby ensuring their deterministic execution. This module can be implemented by an interrupt management service, which dynamically configures the priority register or mask register of the interrupt controller (such as an Advanced Programmable Interrupt Controller (APIC) or a General Purpose Interrupt Controller (GIC) based on the deterministic index output by the deterministic quantization analysis module to adjust the interrupt response behavior of non-real-time tasks. Another implementation method is by a programmable interrupt controller (PIC) or hardware configurable logic, which can automatically adjust the interrupt response threshold or temporarily mask or downgrade specific interrupt sources based on the externally input deterministic index signal.
[0112] Through the modular design described above, this application not only clarifies the responsibilities of each functional component, facilitating engineering development, debugging, and maintenance, but also enables the modules to collaborate and jointly address the issues of insufficient determinism and susceptibility to interference in hard real-time task execution, thereby meeting the needs of actual product development for convenient deployment and maintenance. Specifically, the task classification module is independently responsible for acquiring and classifying task sets, providing a clear decision-making basis for subsequent resource allocation. Its independence allows for flexible adjustment of classification rules, enhancing the scenario adaptability of the solution. The heterogeneous core mapping module binds hard real-time tasks to high-performance core clusters through a core affinity mechanism, while restricting non-real-time tasks to energy-efficient core clusters, achieving spatial decoupling between the two types of tasks and effectively reducing cross-core resource interference. Its independent configuration facilitates optimization of core binding and isolation strategies, improving the scalability of the solution. The deterministic quantification analysis module monitors the processor's underlying pipeline operating parameters in real time, calculates the deterministic index, and establishes preemption priority criteria, thereby dynamically adjusting the preemption order of the task ready queue. The independence of this module enables the system to perform real-time closed-loop monitoring of the execution status of hard real-time tasks, solving the problem of the lack of real-time runtime status feedback in the original static scheduling. It also facilitates adjustments to calculation rules and decision logic based on different hardware platforms, improving adaptability. The interrupt dynamic optimization module dynamically adjusts the response threshold of the interrupt controller based on the deterministic index. By adjusting the interrupt weights of non-real-time tasks, it provides a time window for deterministic execution of the high-performance core cluster, compensating for the time loss of hard real-time tasks. The independent implementation of this module solves the problem that the original static interrupt priority cannot dynamically suppress interference from non-real-time task interrupts, effectively ensuring the deterministic execution of hard real-time tasks.
[0113] The following example will provide a more detailed explanation of the above technical solution:
[0114] In an industrial control system, such as a robot arm controller, multiple tasks need to be managed simultaneously on a multi-core processor. The challenge of this system is to ensure that control tasks, which are crucial to the robot's motion, are executed on time in a highly predictable manner, while also effectively handling network communication and user interaction tasks with large data volumes but relatively low timeliness requirements.
[0115] The system performs task classification. It acquires a set of tasks to be processed and distinguishes them based on their real-time requirements. For example, high-frequency pulse signals from robot joint encoders, used for precise control of motor position and speed, are identified as hard real-time tasks. Meanwhile, network data transmission for remote diagnostics and interactive data updates for the operator interface are identified as non-real-time tasks. During this process, the system establishes a task feature vector, which includes parameters such as task trigger frequency, worst-case execution time, and permissible jitter threshold. Using a preset classification operator, if a task's trigger frequency is higher than the lower limit of the high-frequency pulse frequency and its permissible jitter threshold is lower than the time jitter threshold, the task is determined to be a hard real-time task and marked as high priority. Otherwise, if the task payload is network data or interactive data, it is determined to be a non-real-time task and marked as ordinary priority. This explicit task classification lays the foundation for subsequent resource allocation and scheduling. Unlike traditional systems that indiscriminately process all tasks, this method provides refined task management from the source.
[0116] The system employs heterogeneous core mapping. The processor utilizes a heterogeneous architecture, comprising a high-performance core cluster and an energy-efficient core cluster. Based on a core affinity mechanism, the system binds hard real-time tasks, such as motion control algorithms for robotic arms, to the high-performance core cluster for execution. Simultaneously, the system enables hardware-level cache partitioning, providing independent cache space for hard real-time tasks on the high-performance core cluster. This isolates cache pollution that may be caused by other tasks, ensuring cache hit rates and execution efficiency for hard real-time tasks. Non-real-time tasks, such as network protocol stack processing and logging, are restricted to execution on the energy-efficient core cluster, and cross-cluster scheduling of these non-real-time tasks to the high-performance core cluster is prohibited. This physical isolation, achieved through core affinity masking and hardware-level cache partitioning, effectively avoids resource contention and interference from non-real-time tasks to hard real-time tasks, solving the problem of insufficient deep physical execution environment isolation in existing technologies.
[0117] The system performs deterministic quantitative analysis. During the operation of the robotic arm, the system monitors the processor's instruction pipeline parameters in real time. Through the processor's performance monitoring unit, it collects low-level pipeline data in real time and calculates the deterministic index of each hard real-time task within the current execution cycle. This index comprehensively considers factors such as instruction pipeline pause cycles, cache miss wait cycles, bus conflict latency, total clock cycles, non-real-time task occupancy of the shared bus, and bus contention interference coefficients, quantifying the deterministic level of task execution. Based on this deterministic index, the system establishes a task preemption priority criterion, which combines a timeliness weight factor, a jitter tolerance threshold, and a deterministic risk weight factor. Using this criterion, the system adjusts the preemption order of the task ready queue in real time. For example, when the deterministic index of a hard real-time task decreases due to some interference, its preemption priority criterion value will be adjusted accordingly, giving it a higher preemption order in the ready queue and thus priority in obtaining execution opportunities. This dynamic and quantitative feedback mechanism compensates for the lack of real-time monitoring of the underlying pipeline's operating status in existing scheduling methods, and enables closed-loop adjustment of system resources.
[0118] The system performs dynamic interrupt optimization. Suppose that during high-speed robotic arm movement, the network interface suddenly receives a large amount of data, causing frequent network interruption requests from non-real-time tasks. If these interruptions directly disrupt the hard real-time tasks executing on the high-performance core cluster, it will severely impact their determinism. In this case, the system dynamically adjusts the interrupt controller's response threshold based on the determinism index of the hard real-time tasks. When the determinism index of a hard real-time task is detected to be lower than a preset safety threshold, the system immediately establishes an interrupt suppression window with a duration equal to the interrupt suppression window. The window duration is calculated based on a dynamic adjustment factor and the duration of the sudden interruption. Within the interrupt suppression window, the interrupt controller masks or downgrades the priority of interrupt requests from non-real-time tasks. This means that network data interruptions will not immediately disrupt the hard real-time tasks on the high-performance core cluster, or their response priority will be significantly reduced. In this way, the system provides a deterministic execution time window for the high-performance core cluster, compensating for the time loss that may occur due to interruptions during the execution of hard real-time tasks, thereby ensuring their deterministic execution. Compared with the traditional static interrupt priority mechanism, this method can dynamically adjust interrupt behavior according to the actual running status, effectively suppressing the interference of non-real-time task interrupts on hard real-time tasks and ensuring the timely delivery of critical tasks.
[0119] In this document, the terms "upper," "lower," "front," "back," "left," "right," "top," "bottom," "inner," "outer," "vertical," and "horizontal," etc., indicate the orientation or positional relationship based on the orientation or positional relationship shown in the accompanying drawings. They are only used for the clarity of expressing the technical solution and for the convenience of description, and therefore should not be construed as limiting the present invention.
[0120] In this document, the terms “comprising,” “including,” or any other variations thereof are intended to cover non-exclusive inclusion, which includes not only the elements listed but also other elements not expressly listed.
[0121] The foregoing has shown and described the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the present invention is not limited to the above embodiments. The embodiments and descriptions in the specification are merely illustrative of the principles of the invention. Various changes and modifications can be made to the invention without departing from its spirit and scope, and all such changes and modifications fall within the scope of the present invention as claimed. The scope of protection of this invention is defined by the appended claims and their equivalents.
Claims
1. A method for guaranteeing hard real-time tasks based on a multi-core heterogeneous architecture, characterized in that, The method includes the following steps: Step S1. Task classification and division: Obtain the set of tasks to be processed, and divide the set of tasks into hard real-time tasks and non-real-time tasks according to real-time requirements; wherein, the hard real-time tasks are composed of high-frequency pulse signals, and the non-real-time tasks are composed of network data and interactive data; Step S2. Heterogeneous core mapping: Based on the core affinity mechanism, the hard real-time task is bound to the high-performance core cluster of the processor for execution, and the non-real-time task is scheduled to the energy-efficient core cluster of the processor for execution; Step S3. Deterministic Quantization Analysis: Monitor the instruction pipeline parameters of the processor in real time, calculate the deterministic index of each task in the task set in the current execution cycle; and based on the deterministic index, establish a task preemption priority criterion, and use the criterion to adjust the preemption order of the task ready queue in real time. Step S4. Interrupt Dynamic Optimization: Dynamically adjust the response threshold of the interrupt controller according to the deterministic index. By adjusting the interrupt weight of the non-real-time task, provide a time window for deterministic execution of the high-performance core cluster, compensate for the time loss of the hard real-time task during execution, and ensure execution determinism. The specific method for step S1 is as follows: S11. Establish task feature vectors And logically divide the task set using preset classification operators; among which, For task trigger frequency, This represents the worst-case execution time of the task. Tolerance threshold for jitter; S12. If the judgment condition is met If so, the task is classified as a hard real-time task and marked as high priority; among which, This is the lower limit of the high-frequency pulse frequency. The time jitter threshold; If the above judgment conditions are not met, and the task payload is network data or interactive data, then the task is judged as a non-real-time task and marked as ordinary priority. The specific method for step S2 is as follows: Based on the core affinity mechanism, the hard real-time tasks and non-real-time tasks are spatially decoupled: S21. Bind the hard real-time task to the high-performance core cluster for execution, and enable hardware-level cache partitioning to isolate the cache and ensure the cache hit rate of the hard real-time task; S22. Restrict the execution of the non-real-time tasks to energy-efficient core clusters and prohibit the scheduling of the non-real-time tasks to high-performance core clusters across clusters; The specific method for step S3 is as follows: S31. Collect underlying pipeline data in real time through the processor's performance monitoring unit, and calculate the deterministic index of each hard real-time task in the current execution cycle according to the following formula; in, As a certainty index, The instruction pipeline pause cycle. For cache missing wait period, For bus conflict delay, The total number of clock cycles. This represents the utilization rate of the shared bus by non-real-time tasks. This represents the bus contention interference coefficient. S32. Based on the deterministic index, establish the task preemption priority criterion according to the following formula; in, Priority criteria for task preemption As a timeliness weighting factor, To allow for a jitter threshold, For certainty risk weighting factors; The specific method for step S4 is as follows: S41. The dynamic adjustment of the response threshold specifically includes: When the deterministic index is detected When the threshold is lower than the preset safety threshold, the setup time is... The terminal suppression window, in which, , As a dynamic adjustment factor, Duration of the sudden interruption; S42. Adjusting the interrupt weights for non-real-time tasks specifically includes: Within the terminal suppression window, the interrupt requests of the non-real-time tasks are masked or downgraded in priority by the interrupt controller.
2. A hard real-time task assurance system based on a multi-core heterogeneous architecture, used to implement the hard real-time task assurance method based on a multi-core heterogeneous architecture as described in claim 1, characterized in that, include: Task classification module: Used to acquire the set of tasks to be processed and classify the set of tasks into hard real-time tasks and non-real-time tasks according to real-time requirements; wherein, the hard real-time tasks are composed of high-frequency pulse signals, and the non-real-time tasks are composed of network data and interactive data; Heterogeneous core mapping module: Used to bind the hard real-time tasks to the high-performance core cluster of the processor for execution based on the core affinity mechanism, and to schedule the non-real-time tasks to the energy-efficient core cluster of the processor for execution; Deterministic Quantization Analysis Module: Used to monitor the instruction pipeline parameters of the processor in real time, calculate the deterministic index of each task in the task set in the current execution cycle; and based on the deterministic index, establish a task preemption priority criterion, and use the criterion to adjust the preemption order of the task ready queue in real time. Interrupt dynamic optimization module: Used to dynamically adjust the response threshold of the interrupt controller according to the deterministic index. By adjusting the interrupt weight of the non-real-time task, it provides a time window for deterministic execution of the high-performance core cluster, compensates for the time loss of the hard real-time task during execution, and ensures execution determinism.
Citation Information
Patent Citations
Method and device for processing tasks by distinguishing master core and slave core, system and storage medium
CN113971085A
