A multi-task adaptive scheduling method based on an embedded system

By combining a hierarchical closed-loop scheduling architecture with MIP and DRL, resource awareness and fine-grained control of embedded systems are achieved, solving the problems of insufficient resource awareness and weak emergency response capability in existing technologies, and improving the robustness and real-time performance of the system.

CN122173254BActive Publication Date: 2026-07-14HUNAN UNIV OF SCI & TECH

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
HUNAN UNIV OF SCI & TECH
Filing Date
2026-05-12
Publication Date
2026-07-14

AI Technical Summary

Technical Problem

Existing embedded systems lack resource awareness, fine-grained control, and have weak emergency response capabilities in multi-task scheduling, making it difficult to meet the real-time and reliability requirements in safety-critical scenarios.

Method used

A hierarchical closed-loop scheduling architecture is adopted, which combines mixed integer programming (MIP) and deep reinforcement learning (DRL) to achieve global optimization and real-time response. The MIP layer provides resource constraints and pricing signals, while the DRL layer performs dynamic adjustments, supporting fine-grained resource control and emergency task handling.

Benefits of technology

It enhances the robustness and fault tolerance of embedded systems, balances energy efficiency and service quality, and ensures real-time response and system stability for critical tasks.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122173254B_ABST
    Figure CN122173254B_ABST
Patent Text Reader

Abstract

The application discloses a multi-task adaptive scheduling method based on an embedded system and belongs to the technical field of embedded system scheduling, constructs a hierarchical closed-loop scheduling architecture, generates a benchmark solution and a resource shadow price through mixed integer programming for global optimization at a second level, makes a real-time decision at a millisecond level through deep reinforcement learning to output a six-dimensional structured scheduling action, and combines a double-scale collaborative optimization mechanism to support emergency task scheduling, abnormal emergency repair and dynamic task priority management strategies. The application realizes active sensing of resource scarcity, takes into account global optimization and rapid response, supports fine-grained resource control, improves system robustness and emergency fault tolerance, and balances energy efficiency and service quality.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of embedded system scheduling technology, specifically relating to a multi-task adaptive scheduling method based on embedded systems, which is applicable to safety-critical embedded application scenarios with strict requirements for real-time performance, reliability, and resource utilization, such as autonomous driving domain controllers and industrial edge AI servers. Background Technology

[0002] In embedded systems, task scheduling requires the rational allocation of execution order and quotas within limited computing resources to meet real-time requirements and improve efficiency. Existing technologies have attempted to combine optimization models with reinforcement learning methods, but typically employ a post-processing approach: a deep reinforcement learning module makes the scheduling decision first, and then a mixed-integer programming module checks the results for compliance; if a violation of resource constraints or deadline requirements is detected, the scheduling scheme is forcibly corrected.

[0003] This design prevents the reinforcement learning module from perceiving the resource constraints of the system during the decision-making process, making it difficult to proactively avoid potential risks. Its behavior is akin to running a system without real-time status feedback, often reacting passively only after problems occur. Furthermore, existing methods generally do not adequately consider the fine-grained control requirements of embedded platforms in task scheduling, such as binding tasks to specific CPU cores or dynamically adjusting processor frequencies. Simultaneously, emergency response mechanisms for sudden high-priority events or abnormal system states are lacking, failing to meet the stringent reliability and real-time requirements of safety-critical scenarios. Moreover, existing general solutions often neglect the unique fine-grained control of heterogeneous resources and emergency repair mechanisms under extreme conditions specific to embedded systems. Summary of the Invention

[0004] To address the above problems, this invention provides a multi-task adaptive scheduling method based on embedded systems. This method solves the technical problems of existing embedded system multi-task scheduling, such as lack of resource awareness in decision-making, lack of fine-grained resource control, weak emergency fault tolerance, imbalance between energy efficiency and service quality, and rigid task priority management. It achieves proactive awareness of resource scarcity, balances global optimization and rapid response, supports fine-grained resource control, improves system robustness and emergency fault tolerance, and balances energy efficiency and service quality.

[0005] To achieve the above objectives, the technical solution adopted by the present invention is as follows:

[0006] A multi-task adaptive scheduling method based on embedded systems adopts a hierarchical closed-loop scheduling architecture to achieve adaptive scheduling of multiple tasks. The core steps include:

[0007] S1. Global Optimization of Mixed Integer Programming (MIP) Algorithm: Using Periodicity The MIP solver runs in seconds, solving global optimization problems with resource capacity and time deadline constraints, and generating a baseline solution. and its corresponding dual variables ,in , , These are the shadow prices for CPU cores, GPU computing units, and memory bandwidth resources, respectively.

[0008] S2. Deep Reinforcement Learning (DRL) Real-time Decision Making: With short cycles The system state is collected in milliseconds and the state input vector of the DRL agent is constructed. The state input vector Including MIP global benchmark solution Dual variables The system provides real-time system status and load information for each task queue, including CPU utilization, GPU utilization, memory usage, and chip temperature. The DRL agent is based on the current status... Output a structured scheduling action independently for each task to be scheduled. ;

[0009] S3. Dual-scale collaborative optimization: The MIP layer provides a globally feasible solution that satisfies hard constraints and resource pricing signals, while the DRL layer performs local dynamic adjustments on a fast time scale. The two achieve closed-loop collaboration by sharing a state space, action feedback, and queue state.

[0010] The beneficial effects of the above technical solution are as follows: This invention breaks through the limitations of the prior art's passive post-event correction scheduling, and builds a hierarchical closed-loop architecture that combines fast and slow scheduling. It ensures that the global scheduling meets the hard constraint requirements through mixed integer programming, and achieves millisecond-level real-time response through deep reinforcement learning. It takes into account the security, efficiency and low latency characteristics of embedded system scheduling, and solves the problem of traditional scheduling being unable to perceive the resource status in real time from the root.

[0011] As a further improvement to the above scheme, the objective function of the MIP model is to minimize the weighted sum of the total system energy consumption and task latency, specifically: ;

[0012] Where N is the total number of tasks. For the task The estimated energy consumption Indicates task Whether it is scheduled For the task The urgency of the deadline , These are non-negative weighting coefficients.

[0013] The beneficial effects of the above technical solution are as follows: abandoning the single scheduling optimization goal, energy consumption and task latency are taken into the core consideration simultaneously, and the weight coefficients are flexibly adapted to the needs of different embedded scenarios. This avoids both the pursuit of low latency leading to excessive energy consumption and the excessive control of energy consumption causing task delays, thus achieving two-way optimization of energy efficiency and task real-time performance.

[0014] As a further improvement to the above scheme, the hard constraints of the MIP model include resource capacity constraints, which are specifically as follows: ;

[0015] in, The total number of tasks to be scheduled. , , Tasks Resource requirements for CPU core count, GPU computing unit count, and memory bandwidth. , , This represents the total available resources for the embedded platform.

[0016] The beneficial effects of the above technical solution are as follows: it defines clear red lines for resource usage to address the core characteristic of limited resources in embedded systems, completely avoids resource overload and resource preemption conflicts during concurrent task execution, ensures the feasibility of the scheduling scheme at the global level, and eliminates system operation failures caused by resource overuse.

[0017] As a further improvement to the above scheme, the DRL agent adopts an Actor-Critic network architecture, wherein the input of the Critic network includes the state vector. With the dual variable It is used to evaluate the value of scheduling strategies guided by resource pricing.

[0018] The beneficial effects of the above technical solution are: enabling reinforcement learning agents to actively perceive the scarcity of resources during the decision-making process, rather than simply executing scheduling actions; the accurate value assessment of the critic network can continuously optimize the agent's decision-making logic, making scheduling instructions more in line with the actual resource occupancy of the embedded system, and improving the rationality of the scheduling strategy.

[0019] As a further improvement to the above scheme, the structured scheduling action It includes execution status, CPU core binding, CPU frequency adjustment, GPU computing unit allocation, memory bandwidth quality of service weight, and task delivery micro-latency; the execution status is selected from execution, skip, preload, and pause. When the execution status is preload, only task data is preloaded and resource context is configured, and the computing process is not started.

[0020] The beneficial effects of the above technical solution are as follows: it enables fine-grained and precise control of embedded system resources, which is in line with the exclusive characteristics of embedded hardware, such as core binding and frequency adjustment, and fully taps the performance potential of the hardware; the preloading mechanism can significantly shorten the startup delay of high-priority tasks, prepare for execution in advance, and further improve the system's response speed to sudden tasks.

[0021] As a further improvement to the above scheme, the reward function of the DRL agent is designed as follows: ;in, For a moment The reward value, The task deadline fulfillment rate This represents the total system energy consumption during the current scheduling cycle. Penalty for motion fluctuations , , , The weighting coefficients are adjustable and satisfy the following conditions: ; For the degree of violation of hard constraints, For chip junction temperature, For temperature safety threshold, For memory usage, This is a safe threshold for memory usage.

[0022] The beneficial effects of the above technical solution are as follows: through a multi-dimensional reward mechanism, it guides intelligent agents to actively avoid problems such as resource constraint violations and excessive action range, and incorporates task completion quality, energy consumption control, system security, and scheduling stability into the assessment, so that intelligent agents can continuously iterate towards the optimal scheduling direction and actively reduce illegal and ineffective scheduling.

[0023] As a further improvement to the above scheme, an emergency task scheduling mechanism is also included. Specifically, when a high-urgency task is detected, the current non-critical task is frozen and its resources are released. Resources are allocated to the high-urgency task first and it is executed. After the high-urgency task is completed, the execution context of the frozen non-critical task is restored.

[0024] The beneficial effects of the above technical solution are: it perfectly adapts to safety-critical embedded scenarios such as autonomous driving and industrial control, prioritizes the real-time execution of emergency tasks, and minimizes the response time of emergency tasks; at the same time, it preserves the execution context of non-critical tasks, eliminating the need to reload data and avoiding efficiency losses and data loss caused by task interruptions.

[0025] As a further improvement to the above solution, an emergency repair mechanism is also included. Specifically, when the chip temperature exceeds the limit or the memory is overloaded, a simplified version of MIP solution is triggered. MIP models are built and solved quickly only for high-priority tasks to generate a safe and feasible scheduling solution to restore system stability.

[0026] The beneficial effects of the above technical solution are: it makes up for the shortcomings of the existing technology in terms of emergency fault tolerance, and can quickly start the emergency repair process in the face of extreme abnormal conditions such as temperature exceeding the limit and memory overload, so as to prevent small faults from evolving into system crashes and downtime, and greatly improve the operational stability and reliability of embedded systems under harsh conditions.

[0027] As a further improvement to the above solution, a multi-level task queue and dynamic priority management step is also included. Specifically, three levels of task queues are created: high, medium, and low, corresponding to critical tasks, regular tasks, and background tasks, respectively, and an initial priority is configured for each task. Furthermore, the larger the value, the higher the priority; the system scans each queue every 100ms to determine the waiting time. Tasks according to exponential rules Increase dynamic priority, among which The dynamic priority of the task in the current scheduling cycle. It is the base of the natural logarithm.

[0028] The beneficial effects of the above technical solution are: to achieve hierarchical and classified management of tasks, to prioritize the execution of critical tasks, and to avoid the "starvation" phenomenon of long-waiting background tasks through a dynamic priority adjustment mechanism, while taking into account the rationality and fairness of scheduling priorities and adapting to complex embedded scenarios with multiple types of concurrent tasks.

[0029] As a further improvement to the above scheme, the closed-loop collaboration of the dual-scale collaboration is specifically as follows: the actual resource consumption and task queue status after the DRL layer executes the scheduling action are fed back to the MIP layer as input for the next round of global optimization of MIP, forming an optimization loop of "planning-execution-feedback-replanning"; the scheduling instructions of the DRL agent are issued through the standard POSIX interface to realize fine-grained resource control of CPU core binding, CPU frequency adjustment, GPU computing unit allocation, and memory bandwidth limitation, and the MIP layer and DRL layer run alternately in time sequence, with the DRL layer generating scheduling actions based on the latest solution results of the MIP layer.

[0030] The beneficial effects of the above technical solution are as follows: it enables the fast and slow cycle scheduling modules to form a two-way linkage rather than operate independently, and each round of global planning can be optimized and adjusted based on the actual execution situation of the previous round, ensuring that the scheduling scheme continuously matches the real-time status of the system; it enables fine-grained control to be implemented through standard interfaces, allowing theoretical scheduling schemes to be accurately transformed into actual hardware operations, thereby improving the overall scheduling coherence and execution efficiency.

[0031] Compared with the prior art, the beneficial effects of the present invention are as follows:

[0032] 1. It realizes the transformation from passive constraint to active economic perception: by introducing the shadow price of MIP solution as an economic signal, the DRL agent can actively perceive resource scarcity when making decisions, thereby proactively avoiding resource conflicts and constraint violation risks.

[0033] 2. Significantly improves the deadline fulfillment rate of critical tasks and system robustness: The dual-scale collaborative architecture combines the global optimality of MIP with the rapid response capability of DRL, which can still guarantee the deadline fulfillment rate of critical tasks under continuous overload or sudden high-priority task scenarios.

[0034] 3. Supports fine-grained resource control for embedded platforms: The six-dimensional structured actions output by DRL can precisely control the CPU core binding, frequency adjustment, GPU share allocation, etc. of tasks, giving full play to the performance of embedded hardware.

[0035] 4. Possesses strong emergency response and fault tolerance capabilities: Through emergency task processing mechanisms and MIP emergency repair mechanisms, the system can effectively respond to sudden high-priority events and abnormal system states, ensuring operational stability under extreme conditions.

[0036] Balancing energy efficiency and service quality: The objective function of MIP is designed to minimize the weighted sum of total system energy consumption and task delay, while the reward function of DRL also takes into account the deadline satisfaction rate, energy consumption, and constraint violation degree, thereby optimizing the system energy efficiency ratio while ensuring real-time performance. Attached Figure Description

[0037] Figure 1 : Flowchart of a multi-task adaptive scheduling algorithm based on embedded systems.

[0038] Figure 2 : Flowchart of dual-scale collaborative optimization operation.

[0039] Figure 3 : DRL agent structure diagram.

[0040] Figure 4 : Flowchart of DRL agent operation.

[0041] Figure 5 : Flowchart of a single task.

[0042] Figure 6 Runtime sequence diagram of a multi-task scheduling algorithm based on the fusion of MIP and DRL. Detailed Implementation

[0043] To enable those skilled in the art to better understand the technical solution, the present invention will be described in detail below with reference to embodiments. The description in this part is only exemplary and explanatory, and should not be used to limit the scope of protection of the present invention in any way.

[0044] This embodiment is implemented based on the NVIDIA Jetson OrinNX development board, and the hardware and system configuration is as follows:

[0045] 1. Processor: 8-core ARM Cortex-A78AE CPU, with a maximum clock speed of 2.0GHz;

[0046] 2. GPU: 1024-core NVIDIA Ampere architecture GPU, including 32 Tensor Cores;

[0047] 3. Memory: 16GB LPDDR5 (bandwidth 102.4GB / s);

[0048] 4. Operating System: Ubuntu 18.04 + Linux Kernel 5.10, with cgroupsv1, CPU affinity, and NVIDIA MPS support enabled;

[0049] 5. Control Interface: The system issues scheduling commands through the standard POSIX interface to achieve CPU core binding, frequency adjustment, and fine-grained resource control of GPU / memory.

[0050] This platform is typically used in high-reliability scenarios such as autonomous driving domain controllers and industrial edge AI servers, and usually needs to perform multiple tasks such as object detection, speech recognition, and communication concurrently.

[0051] I. Multi-level task queue initialization and dynamic priority management

[0052] Figure 1 The overall flowchart of the multi-task adaptive scheduling algorithm is presented in a closed-loop iterative manner, showing the entire process of issuing new tasks → multi-level task queue management → priority adjustment → urgency judgment → scheduling execution → cyclic iteration, as follows:

[0053] First, the system receives new tasks from external sources, and the new tasks are directly put into a preset multi-level task queue for management. The system monitors the waiting time of tasks in each queue in real time. If the waiting time of a task exceeds a set threshold, the importance level (i.e. priority) of the task will be automatically increased.

[0054] Subsequently, the system initiates scheduling decisions for the tasks at the forefront of each queue. First, it determines whether the task is an urgent task: if it is an urgent task, it is immediately placed at the forefront of the process, while currently executing non-critical temporary tasks are frozen, and system resources are allocated to the urgent task first and it is started for execution; if it is a non-urgent task, it proceeds normally to the subsequent scheduling decision process. In the scheduling decision phase, the system first obtains the current hardware resource utilization rates of the device, such as CPU, GPU, and memory. The MIP module generates a global benchmark solution, the Critic network evaluates the value of candidate scheduling actions, and the Actor network integrates the MIP benchmark solution and the evaluation results of the Critic network to generate the final scheduling action.

[0055] Finally, the system executes the scheduling action. If there are any previously frozen temporary tasks, their execution status will be restored after the emergency task is completed. The entire process then enters the next scheduling cycle, forming a complete closed-loop operation logic.

[0056] For easier understanding Figure 1 The operational process is broken down into 7 key steps:

[0057] 1. Issue new tasks: External tasks are submitted to the system and enter a multi-level task queue;

[0058] 2. Multi-level task queue management: The system maintains three levels of task queues: high, medium, and low, corresponding to critical tasks, regular tasks, and background tasks, respectively;

[0059] 3. Waiting timeout detection: Real-time monitoring of task waiting time; if the waiting time exceeds the threshold, the task priority is automatically increased.

[0060] 4. Scheduling decision trigger: Initiate scheduling for the task at the front of the queue and enter the emergency task judgment branch;

[0061] 5. Emergency Task Handling:

[0062] For urgent tasks: place them directly at the top of the process list, freeze current non-critical temporary tasks, and prioritize resource allocation for execution;

[0063] Non-urgent tasks: proceed with the normal scheduling decision-making process;

[0064] 6. Status Acquisition and Decision Making: Acquire device CPU / GPU / memory hardware utilization, generate benchmark solutions using MIP, evaluate actions using the Critic network, and fuse benchmark solutions using the Actor network to generate scheduling actions;

[0065] 7. Execution and Recovery: Execute scheduling actions, restore frozen tasks after emergency tasks are completed, and enter the next scheduling cycle.

[0066] This embodiment is based on Figure 1 The process completes queue initialization:

[0067] Configure initial priority for each task The larger the value, the higher the priority;

[0068] The system scans the queue every 100ms and calculates the waiting time. The task, according to the exponential rule Increase dynamic priority to prevent low-priority tasks from "starving"; among which: Indicates the dynamic priority of the task in the current scheduling cycle; Indicates the initial priority of the task; It is the base of the natural logarithm; The task waiting time is in milliseconds.

[0069] II. Slow-scale MIP global optimization

[0070] Figure 2 The flowchart for dual-scale collaborative optimization is presented, dividing the decision cycle into MIP (Minimum Injection Process) at the second level and DRL (Deadly Reduction Process) at the sub-second level. The complete logic of dual-scale collaboration, constraint detection, and emergency repair, as well as the connections between each stage, are clearly defined. Details are as follows:

[0071] The diagram shows two parallel decision cycles: the upper cycle is the MIP (Medium Injection Processing) second-level decision cycle, and the lower cycle is the DRL (Digital Reduction Processing) sub-second-level decision cycle. The MIP module is triggered to start at a set interval (0.5–2 seconds). First, it collects real-time monitoring information of the device, including core status parameters such as CPU utilization, GPU utilization, memory usage, and chip temperature. Then, it executes the MIP global solution, constructs a global optimization model with resource capacity and time deadline constraints, and solves to obtain the global baseline solution. With resource shadow prices The system updates the DRL layer to serve as a global guide for real-time DRL decision-making. The DRL module is triggered at sub-second intervals (20-100 milliseconds), generating and executing scheduling actions based on the baseline solution, shadow price, and real-time device status issued by MIP. Simultaneously, the system continuously performs safety constraint checks to determine whether the system is in a safe or dangerous state in real time. If it is in a safe state, the dual-scale collaborative decision-making process continues. If dangerous states such as chip temperature exceeding limits or memory overload are detected, the MIP emergency repair mechanism is immediately triggered. By simplifying the MIP solution, a safe and feasible scheduling scheme is generated to ensure that the system quickly recovers stability.

[0072] Combination Figure 2 The process logic is as follows: the core components of dual-scale collaborative optimization are broken down into 6 steps, and the specific execution content of each step is clarified:

[0073] 1. Periodic Trigger: MIP starts the global solution with a period of 0.5 to 2 seconds; in this embodiment, it is set to 1.0 second.

[0074] 2. Monitoring Information Acquisition: Read real-time status data such as device CPU utilization, GPU utilization, memory usage, and chip temperature;

[0075] 3. MIP Global Solution: Construct an optimization model with resource capacity and deadline constraints, and solve it to obtain the global benchmark solution. With resource shadow prices ;

[0076] 4. Baseline solution update: and Synchronize to the DRL layer as a global guide for real-time decision-making;

[0077] 5. Constraint Detection: Continuously monitor whether the system is in a safe / dangerous state;

[0078] 6. Emergency Repair Trigger: If dangerous conditions such as excessive temperature or memory overload are detected, MIP emergency repair will be initiated immediately to generate a safety scheduling plan.

[0079] In this embodiment, MIP aims to minimize the weighted sum of total system energy consumption and task latency, applies hard constraints on CPU / GPU / memory resources, and calls the Gurobi solver to output a globally feasible solution, thus ensuring that the scheduling scheme does not exceed the resource limit from the root.

[0080] like Figure 2 As shown, the system operates periodically. Instantly invoke the solver Gurobi and perform the following steps:

[0081] (1) Collect the set of tasks to be scheduled within the next 1.5 seconds, totaling... One task.

[0082] (2) Constructing the MIP model: ;in:

[0083] The function value for the global scheduling target;

[0084] This is the task scheduling decision vector;

[0085] For the task Estimated energy consumption, in units of Acquired through offline training;

[0086] For the task The urgency of the deadline is defined as: ;

[0087] in:

[0088] Indicates the absolute deadline for the task;

[0089] Indicates the current system time.

[0090] (3) Imposing hard resource constraints: ;

[0091] in:

[0092] Indicates task Whether it is scheduled;

[0093] Indicates task Resource requirements for the number of CPU cores;

[0094] Indicates task Resource requirements for the number of GPU computing units;

[0095] Indicates task Resource requirements for memory bandwidth.

[0096] (4) Solve and output the benchmark solution and shadow prices It is used to guide DRL in making rapid decisions.

[0097] III. Fast-scale DRL Real-time Decision Making

[0098] 3.1 DRL Agent Structure

[0099] Figure 3 The diagram below shows the DRL agent network architecture, illustrating the composition of the Actor-Critic dual network architecture and the data flow between its components. Details are as follows:

[0100] The core of the diagram comprises three main components: the Action Network (Actor), the Evaluation Network (Critic), and the Task Scheduling Dynamic Environment. It also involves key elements such as device operational observations, scheduling actions, reward functions, and optimization gradient information. Device operational observations (including resource utilization, task queue status, and chip temperature) serve as input to the Action Network (Actor). The Actor network generates scheduling action probabilities based on the input states, outputting continuous scheduling actions that are then applied to the Task Scheduling Dynamic Environment. After executing the scheduling actions, the Task Scheduling Dynamic Environment generates the next system state. and reward function reward function With the next state The evaluation network Critic is synchronously fed into the system; the Critic network combines the current state, the action to be performed, and the reward function to calculate the value of the scheduling strategy. The optimized gradient information is fed back to the Actor network, and the value supervision learning target value is also output. The Actor network continuously optimizes the scheduling action generation logic based on the received gradient information, forming a closed-loop iteration of "input → action → feedback → optimization", realizing the autonomous learning and decision optimization of the DRL agent.

[0101] 3.2 DRL Decision Execution Process

[0102] Figure 4 The flowchart for the DRL agent's decision-making process is provided, detailing the entire process from state input to Actor network, action output, Critic network, and reward design. The complete descriptions of each node and its logic are shown in the attached diagram, broken down in chronological order.

[0103] 1. Status Input: The process begins with the status input stage, which includes four parts: real-time resource utilization, MIP baseline solution, etc. Shadow prices The degree of constraint violation; after integrating these four parts of information, a state vector of the DRL agent is formed. .

[0104] 2. Actor Network: This network converts the state vector... The input is fed into the Actor network, which uses two fully connected layers with 64 neurons each. After processing by the tanh activation function, the action generation calculation is completed.

[0105] 3. Action Output: The Actor network outputs a six-dimensional structured scheduling action within a continuous action space, which specifically includes six dimensions: execution state (optional: execute, skip, preload, pause), CPU core binding, CPU frequency adjustment, GPU computing unit allocation, memory bandwidth quality of service weight, and task delivery micro-latency.

[0106] 4. Critic Network: This network converts the state vector... Actions output by the Actor network Both are fed into the Critic network, which calculates the policy evaluation value of the state-action combination. Complete the value assessment.

[0107] 5. Reward Design: Enter the reward design stage, according to the preset formula. Generate reward values, where, For a moment The reward value, The task deadline fulfillment rate This represents the total system energy consumption during the current scheduling cycle. Penalty for motion fluctuations , , , The weighting coefficients are adjustable and satisfy the following conditions: ; For the degree of violation of hard constraints, For chip junction temperature, For temperature safety threshold, For memory usage, The memory usage safety threshold is defined, where task completion corresponds to a positive reward (+1 task), while system energy consumption, constraint violation, and action fluctuation correspond to negative penalties. The reward value is fed back to the Actor network to guide the network to continuously optimize scheduling actions. Finally, through the instruction issuance stage, the scheduling actions are transformed into hardware-executable instructions to complete real-time DRL decision-making.

[0108] In this embodiment, the DRL decision period is set to 50ms, achieving millisecond-level real-time response. The specific execution process is as follows:

[0109] (1) Status acquisition: The DRL agent reads the core status parameters of the system in real time with a period of 50ms, including CPU utilization of 80%, GPU utilization of 70%, memory usage of 2.8GB, and chip temperature of 62℃. At the same time, it acquires the global benchmark solution output by the MIP layer. With resource shadow prices The above parameters are integrated into a complete state vector. This provides data support for action generation.

[0110] Action Generation: The lightweight Actor network employs a two-layer fully connected structure, with 64 neurons in each layer. After processing by the tanh activation function, it outputs a six-dimensional structured scheduling action. Taking task i=2 as an example, the specific output action is as follows: =RUN, 1, 2, 0.9, 0.7, 0.8, 3ms; the meanings of each dimension are as follows:

[0111] RUN: Task execution status, indicating that the task has been started;

[0112] 1,2: The CPU core numbers to which this task is bound, i.e., task i=2 is bound to CPU core 1 and core 2;

[0113] 0.9: CPU frequency adjustment ratio, with a value range of [0.5, 1.0], corresponding to adjusting the CPU frequency to 90% of the base frequency;

[0114] 0.7: GPU computing share allocation ratio, with a value range of [0.0, 1.0], corresponding to 70% of the GPU computing units allocated to this task;

[0115] 0.8: Memory bandwidth quality of service weight, with a value range of [0.0, 1.0], used to guarantee the memory bandwidth priority of this task;

[0116] 3ms: Task micro-delay start time, that is, after the scheduling instruction is generated, the task process starts after a delay of 3ms.

[0117] (2) Instruction issuance: Based on the above six-dimensional structured actions, instructions are issued to the hardware through the standard POSIX interface and system instructions. The specific operations are as follows:

[0118] CPU core binding: Call the function "sched_setaffinity(pid,cpu_set={1,2})" to bind the process pid of task i=2 to CPU core 1 and core 2, ensuring that the task is executed on the specified core;

[0119] CPU frequency adjustment: Write to the file " / sys / devices / system / cpu / cpu2 / cpufreq / scaling_setspeed" to set the operating frequency of CPU core 2 to 1.8GHz (corresponding to a frequency adjustment ratio of 0.9).

[0120] GPU compute unit allocation: Start NVIDIAMPS (Multi-Process Service) and allocate 70% of the GPU compute unit share to this task by setting "CUDA_MPS_ACTIVE_THREAD_PERCENTAGE=70";

[0121] GPU memory limit: Using the "nvidia-smi-i0-m1200" command, the task is limited to a maximum of 1.2GB of GPU memory to avoid memory overload;

[0122] Memory bandwidth configuration: Configure "memory.low=800MB" through cgroupsv2 to ensure the minimum memory bandwidth requirements of this task;

[0123] Micro-delay start: Register a 3ms micro-delay timer. The task process will start after the timer expires, ensuring that the micro-delay start requirement is met.

[0124] IV. Emergency Task Scheduling and Single Task Lifecycle Management

[0125] 4.1 Emergency Task Dispatch

[0126] according to Figure 1 Emergency mission branch execution:

[0127] 4.1.1 Upon detecting a high-urgency task, immediately freeze the current non-critical tasks and save their execution context;

[0128] 4.1.2 Release the CPU and memory resources occupied by frozen tasks and allocate them to urgent tasks first;

[0129] 4.1.3 After the emergency task is completed, the context and execution status of the frozen task are restored, with no data loss and no duplicate loading.

[0130] 4.2 Single Task Full Lifecycle

[0131] Figure 5 This is a flowchart illustrating the lifecycle and exception handling of a single task, fully presenting the entire lifecycle of a single task from arrival → waiting → execution → completion / exception → resource release. The details and logical connections of each stage are as follows:

[0132] The process begins with the arrival of a task. Once a single task submitted externally enters the system, it first enters a waiting queue, where it is sorted by priority and awaits scheduling. When the system schedules the task, the agent generates a targeted scheduling decision, allocating appropriate CPU, GPU, and memory resources to the task and initiating its execution. During task execution, the system continuously monitors execution, updates resource utilization in real time, and simultaneously assesses the task status. If the task completes normally, it enters the completion queue, releasing all system resources it occupies, and the task's lifecycle officially ends. If an anomaly occurs during task execution (such as insufficient resources or hardware failure), the task process is immediately terminated, releasing all resources it occupies, and the task is then returned to the waiting queue for the next scheduling. Throughout the entire process, regardless of whether the task completes normally or terminates abnormally, resource reclamation is performed to ensure efficient reuse of system resources and avoid resource waste.

[0133] V. System Anomaly Emergency Repair Mechanism

[0134] according to Figure 2 Constraint detection → Hazard → MIP emergency repair process, combined with Figure 5 Exception handling logic implements emergency fault tolerance:

[0135] 1. Abnormal Trigger: DRL detects warnings of hard constraint violations such as chip temperature exceeding limits and memory overload;

[0136] 2. Emergency Resource Recovery: Terminate all low-priority tasks and release non-critical resources;

[0137] 3. Simplified MIP solution: Quickly construct a simplified model containing only high-priority tasks within 100ms and solve for a safe scheduling solution;

[0138] 4. System Recovery: Execute a repair plan within 250ms to restore the system to a stable state and prevent crashes;

[0139] 5. Status Feedback: The repaired system status is fed back to the MIP layer as input for the next round of global optimization.

[0140] VI. Dual-scale closed-loop synergy of MIP and DRL

[0141] Figure 6 The dual-scale time-series collaborative operation diagram of MIP and DRL intuitively illustrates the four-way collaborative relationship and temporal logic of the four core modules: dynamic environment, MIP solver, DRL agent, and execution module, forming a complete closed loop of "planning-execution-feedback-replanning". Details are as follows:

[0142] The four modules in the diagram form a two-way interactive closed loop. The dynamic environment collects the system hardware status and task queue status in real time, providing input for the MIP solver and DRL agent. The MIP solver is triggered every second to perform global optimization and output the baseline solution. With shadow price On the one hand, it provides global optimal constraints, and on the other hand, it feeds the result into the DRL agent; the DRL agent receives the output of the MIP solver and the real-time state of the dynamic environment. Generate millisecond-level scheduling actions The task is then sent to the execution module; after the execution module performs the scheduled action, it converts the execution result into a reward. With the new system state The results are fed back to the dynamic environment and the DRL agent. At the same time, the system sets up a constraint detection link to monitor in real time whether hard constraints (temperature, memory, etc.) are violated. If a hard constraint violation warning is triggered, the MIP solver is immediately notified to start an emergency repair mechanism, generate an emergency repair plan and send it to the execution module to ensure system stability. The execution results of the DRL agent are continuously fed back to the MIP solver. The next round of global optimization of the MIP solver will be adjusted based on the actual execution state, realizing bidirectional collaboration and closed-loop iteration between MIP slow-scale planning and DRL fast-scale decision-making.

[0143] To clarify the core logic of dual-scale coordination, Figure 6 The closed-loop collaborative process can be broken down into 5 key steps, illustrating the interaction relationships between the modules:

[0144] 1. MIP layer: Triggered once per second, outputting a baseline solution. With shadow price It provides globally optimal constraints;

[0145] 2. DRL Layer: Receives MIP output and real-time system status. Generate millisecond-level scheduling actions ;

[0146] 3. Execution Module: Executes scheduling actions and returns rewards. With the new state ;

[0147] 4. Constraint Detection: Real-time monitoring of hard constraints; when a violation warning is triggered, MIP is notified to initiate emergency repair.

[0148] 5. Closed-loop iteration: The execution results of DRL are continuously fed back to MIP. The next round of optimization in MIP combines the actual execution status to achieve dual-scale collaborative optimization.

[0149] VII. Runtime Verification of the Algorithm

[0150] by For example, according to Figure 6 Timing verification process:

[0151] 1. MIP completes the solution and outputs the results. and ;

[0152] 2. DRL is based on the latest Generate and execute the scheduling policy;

[0153] 3. A new emergency mission has arrived; background missions are frozen.

[0154] 4. Emergency task completed, background tasks resumed;

[0155] 5. MIP enters the next cycle, update Compared with the benchmark solution;

[0156] 6. DRL schedules ResNet tasks based on a new benchmark solution;

[0157] 7. The execution module allocates resources and starts the task;

[0158] 8. DRL reschedules ResNet tasks based on system status;

[0159] 9. MIP is solved periodically again to complete the dual-scale closed-loop iteration.

[0160] Eighty rounds of simulation experiments were conducted during the experiment, with each group consisting of 10 participants. The operational data for each group is shown in Table 1.

[0161] Table 1:

[0162]

[0163] The system's average task completion rate remained stable between 92.5% and 97.5%, with good control over average turnaround time and waiting time, and no resource bottlenecks were observed. Therefore, the scheduling strategy effectively avoided resource contention. The average scores of each group after the following weighted averaging are shown in Table 2.

[0164] Table 2:

[0165]

[0166] It should be noted that, in this document, the terms "comprising," "including," and any other variations are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Specific examples have been used in this document to illustrate the principles and implementation methods of the present invention. These examples are merely for the purpose of helping to understand the method and core ideas of the present invention. The above descriptions are only preferred embodiments of the present invention. It should be pointed out that, due to the limitations of written expression and the objective existence of infinite specific structures, those skilled in the art can make several improvements, modifications, or variations without departing from the principles of the present invention, and can also combine the above technical features in an appropriate manner. These improvements, modifications, variations, or combinations, or the direct application of the concept and technical solution of the present invention to other situations without modification, should all be considered within the scope of protection of the present invention.

Claims

1. A multi-task adaptive scheduling method based on embedded systems, characterized in that, A hierarchical closed-loop scheduling architecture is adopted to achieve adaptive scheduling of multiple tasks. The core steps include: S1. Global Optimization of Mixed Integer Programming (MIP) Algorithm: Using Periodicity The MIP solver runs in seconds, solving global optimization problems with resource capacity and time deadline constraints, and generating a baseline solution. and its corresponding dual variables ,in , , These are the shadow prices of CPU cores, GPU computing units, and memory bandwidth resources, respectively; the objective function of the mixed integer programming (MIP) algorithm is to minimize the weighted sum of total system energy consumption and task latency. S2. Deep Reinforcement Learning (DRL) Real-time Decision Making: With short cycles The system state is collected in milliseconds and the state input vector of the DRL agent is constructed. The state input vector Including MIP global benchmark solution Dual variables The system provides real-time system status and load information for each task queue, including CPU utilization, GPU utilization, memory usage, and chip temperature. The DRL agent then uses this information based on the current system status. Output a structured scheduling action independently for each task to be scheduled. ; The structured scheduling action It includes execution status, CPU core binding, CPU frequency adjustment, GPU computing unit allocation, memory bandwidth quality of service weight, and task delivery micro-latency; the execution status is selected from execution, skip, preload, and pause. When the execution status is preload, only task data is preloaded and resource context is configured, and the computing process is not started. S3. Dual-scale collaborative optimization: The MIP layer provides a globally feasible solution that satisfies hard constraints and resource pricing signals, while the DRL layer performs local dynamic adjustments on a fast time scale. The two achieve closed-loop collaboration by sharing a state space, action feedback, and queue state. The closed-loop collaboration of the dual-scale collaboration is as follows: the actual resource consumption and task queue status after the DRL layer executes the scheduling action are fed back to the MIP layer as input for the next round of global optimization of MIP, forming an optimization loop of "planning-execution-feedback-replanning"; the scheduling instructions of the DRL agent are issued through the standard POSIX interface to realize fine-grained resource control of CPU core binding, CPU frequency adjustment, GPU computing unit allocation and memory bandwidth limitation, and the MIP layer and DRL layer run alternately in time sequence, with the DRL layer generating scheduling actions based on the latest solution results of the MIP layer.

2. The multi-task adaptive scheduling method based on embedded systems according to claim 1, characterized in that, The objective function of the mixed-integer programming (MIP) algorithm described in step S1 is specifically: ; Where N is the total number of tasks. For the task The estimated energy consumption Indicates task Whether it is scheduled For the task The urgency of the deadline , These are non-negative weighting coefficients.

3. The multi-task adaptive scheduling method based on embedded systems according to claim 1, characterized in that, The hard constraints of the mixed-integer programming (MIP) algorithm in step S1 include resource capacity constraints, which are specifically as follows: ; in, The total number of tasks to be scheduled. , , Tasks Resource requirements for CPU core count, GPU computing unit count, and memory bandwidth. , , This represents the total available resources for the embedded platform.

4. The multi-task adaptive scheduling method based on embedded systems according to claim 1, characterized in that, The DRL agent adopts an Actor-Critic network architecture, where the input to the Critic network includes a state vector. With dual variables It is used to evaluate the value of scheduling strategies guided by resource pricing.

5. The multi-task adaptive scheduling method based on embedded systems according to claim 1, characterized in that, The reward function of the DRL agent is designed as follows: ; in, For a moment The reward value, The task deadline fulfillment rate This represents the total system energy consumption during the current scheduling cycle. Penalty for motion fluctuations , , , The weighting coefficients are adjustable and satisfy the following conditions: ; For the degree of violation of hard constraints, For chip junction temperature, For temperature safety threshold, For memory usage, This is the safe threshold for memory usage.

6. The multi-task adaptive scheduling method based on embedded systems according to claim 1, characterized in that, It also includes an emergency task scheduling mechanism, which is as follows: when a high-urgency task is detected, the current non-critical task is frozen and its resources are released. Resources are allocated to the high-urgency task first and it is executed. After the high-urgency task is completed, the execution context of the frozen non-critical task is restored.

7. The multi-task adaptive scheduling method based on embedded systems according to claim 1, characterized in that, It also includes an emergency repair mechanism, specifically: when the chip temperature exceeds the limit or the memory is overloaded, a simplified version of MIP solution is triggered, which builds and solves the MIP model only for high-priority tasks, generating a safe and feasible scheduling solution to restore system stability.

8. The multi-task adaptive scheduling method based on embedded systems according to claim 1, characterized in that, It also includes multi-level task queues and dynamic priority management steps, specifically: creating high, medium, and low-level task queues to correspond to critical tasks, regular tasks, and background tasks, respectively, and configuring an initial priority for each task. Furthermore, the larger the value, the higher the priority; the system scans each queue every 100ms to determine the waiting time. Tasks according to exponential rules Increase dynamic priority, among which The dynamic priority of the task in the current scheduling cycle. It is the base of the natural logarithm.