Distributed task scheduling method, device and equipment for OpenHarmony Internet of Things equipment

By collecting hardware parameters and analyzing tasks for OpenHarmony IoT devices, combining variable learning models and distributed reinforcement learning, an efficient distributed task scheduling method is built, solving the problems of low utilization of equipment resources and poor task scheduling efficiency in the existing technology, and improving the overall performance and adaptability of the system are achieved.

CN119883568AInactive Publication Date: 2025-04-25深圳宇翊技术股份有限公司
View PDF 0 Cites 9 Cited by

Patent Information

Application Number
CN202411993967.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-31
Publication Date
2025-04-25
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

The distributed task scheduling method of the existing OpenHarmony Internet of Things devices has problems such as low device resource utilization, poor task scheduling efficiency, and unbalanced system load, which is difficult to meet the needs of complex application scenarios.

Method used

By collecting hardware parameters and classifying IoT devices in OpenHarmony distributed networks, a device capability data set is built; a task analysis and dependency analysis of the application based on the device capability data set is carried out to obtain a directed acyclic graph of tasks; a variational learning model is used to calculate and predict the device load, and a device resource reserved table is obtained; a nonlinear optimization model is built and the initial task allocation plan is obtained; a target task scheduling scheme is obtained through two-stage distributed reinforcement learning optimization, and it is deployed to an IoT device for performance evaluation.

Benefits of technology

It improves the overall performance of the system, realizes the efficient utilization of equipment resources and the efficient task scheduling, solves the real-time scheduling problem in dynamic load environments, and improves the adaptability of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119883568A_ABST
    Figure CN119883568A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of task scheduling, and discloses a distributed task scheduling method, device and equipment for OpenHarmony Internet of Things equipment, and the method comprises the steps: carrying out the hardware parameter collection and equipment classification of the Internet of Things equipment in an OpenHarmony distributed network, and obtaining an equipment capability data set; performing task analysis and dependency analysis on the application program to obtain a task directed acyclic graph; carrying out calculation and resource allocation prediction on the equipment load to obtain an equipment resource reservation table; constructing a nonlinear optimization model, and solving to obtain an initial task allocation scheme; performing two-stage distributed reinforcement learning optimization to obtain a target task scheduling scheme; the target task scheduling scheme is deployed to the Internet of Things equipment, data collection and performance evaluation are carried out, and a performance evaluation data set is obtained.The efficient communication and cooperative computing between the equipment are achieved based on the distributed soft bus, the overhead of task migration and data transmission is reduced, and the overall performance of the system is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of task scheduling technology, and in particular to a distributed task scheduling method, apparatus and device for OpenHarmony IoT devices. Background Art

[0002] The requirements for the distributed processing capabilities of OpenHarmony IoT devices are constantly increasing. The existing distributed task scheduling methods for IoT devices mainly have problems such as low device resource utilization, poor task scheduling efficiency, and unbalanced system load, which are difficult to meet the needs of complex application scenarios.

[0003] In the OpenHarmony IoT environment, there are many types of devices and their computing capabilities vary greatly. Traditional centralized task scheduling methods cannot fully utilize the computing resources of heterogeneous devices and lack flexibility in dealing with dynamic load changes. In addition, the communication overhead and task migration cost between devices also pose challenges to efficient task scheduling. Existing task scheduling algorithms often assume that the performance of devices is the same, ignoring the heterogeneous characteristics and dynamic load characteristics of IoT devices, resulting in unreasonable task allocation and degraded system performance. Summary of the invention

[0004] The present application provides a distributed task scheduling method, apparatus and device for OpenHarmony IoT devices. The present invention realizes efficient communication and collaborative computing between devices based on a distributed soft bus, reduces the overhead of task migration and data transmission, and improves the overall performance of the system.

[0005] In a first aspect, the present application provides a distributed task scheduling method for an OpenHarmony IoT device, the distributed task scheduling method for an OpenHarmony IoT device comprising: Collect hardware parameters and classify devices in the OpenHarmony distributed network to obtain device capability datasets; Performing task parsing and dependency analysis on the application based on the device capability dataset to obtain a task directed acyclic graph; According to the device capability data set and the task directed acyclic graph, a variational learning model is used to calculate the device load and predict resource allocation to obtain a device resource reservation table; Constructing a nonlinear optimization model based on the device resource reservation table and the task directed acyclic graph, and solving to obtain an initial task allocation solution; Performing two-stage distributed reinforcement learning optimization on the initial task allocation scheme to obtain a target task scheduling scheme; The target task scheduling scheme is deployed to the IoT device and data collection and performance evaluation are performed to obtain a performance evaluation data set, which includes execution time data, resource utilization data, and load balancing data.

[0006] A second aspect of the present application provides a distributed task scheduling device for an OpenHarmony IoT device, the distributed task scheduling device for an OpenHarmony IoT device comprising: The acquisition module is used to collect hardware parameters and classify devices in the OpenHarmony distributed network to obtain device capability data sets; An analysis module, used to perform task parsing and dependency analysis on the application based on the device capability data set to obtain a task directed acyclic graph; A prediction module, configured to calculate the device load and predict resource allocation using a variational learning model based on the device capability data set and the task directed acyclic graph, and obtain a device resource reservation table; A construction module, used to construct a nonlinear optimization model based on the device resource reservation table and the task directed acyclic graph, and solve to obtain an initial task allocation solution; An optimization module, used for performing two-stage distributed reinforcement learning optimization on the initial task allocation scheme to obtain a target task scheduling scheme; The evaluation module is used to deploy the target task scheduling solution to the IoT device and perform data collection and performance evaluation to obtain a performance evaluation data set, which includes execution time data, resource utilization data and load balancing data.

[0007] The third aspect of the present application provides an electronic device, comprising: a memory and at least one processor, wherein the memory stores instructions; the at least one processor calls the instructions in the memory so that the electronic device executes the above-mentioned distributed task scheduling method of the OpenHarmony IoT device.

[0008] A fourth aspect of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, which, when executed on a computer, enable the computer to execute the above-mentioned distributed task scheduling method for OpenHarmony IoT devices.

[0009] Compared with the prior art, the present application has the following beneficial effects: through the construction of device capability data sets and device classification, the comprehensive collection of hardware parameters and operating status of OpenHarmony IoT devices is realized, providing an accurate basis for device capability evaluation for task scheduling; the task directed acyclic graph representation method is adopted to accurately describe the dependencies and resource requirements between tasks, making task decomposition and merging more reasonable and improving the accuracy of task scheduling; the variational learning algorithm is introduced to model and predict device loads, overcoming the problem of inaccurate load prediction in traditional methods and improving the rationality of resource reservation; through the construction and solution of nonlinear optimization models, task allocation optimization under multi-objective constraints is realized, balancing multiple objectives such as execution time, communication overhead and load balancing; a two-stage distributed reinforcement learning method is used for task scheduling optimization, which effectively solves the real-time scheduling problem under dynamic load environments and improves the adaptability of the system; based on a distributed soft bus, efficient communication and collaborative computing between devices are realized, the overhead of task migration and data transmission is reduced, and the overall performance of the system is improved. BRIEF DESCRIPTION OF THE DRAWINGS

[0010] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative labor.

[0011] The structures, proportions, sizes, etc. illustrated in the drawings of this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with this technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantive technical significance. Any structural modification, change in proportion or adjustment of size, without affecting the effects and purposes that can be achieved by the present invention, should still fall within the scope of the technical contents disclosed by the present invention.

[0012] Figure 1 It is a flow chart of a distributed task scheduling method for an OpenHarmony IoT device provided by an embodiment of the present invention; Figure 2 It is a schematic block diagram of the structure of a distributed task scheduling device for an OpenHarmony IoT device provided by an embodiment of the present invention; Figure 3 It is a schematic block diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0013] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0014] The flowcharts shown in the accompanying drawings are only examples and do not necessarily include all the contents and operations / steps, nor must they be executed in the order described. For example, some operations / steps may also be decomposed, combined or partially merged, so the actual execution order may change according to actual conditions.

[0015] It should also be understood that the terms used in this application specification are only for the purpose of describing specific embodiments and are not intended to limit the application. As used in this application specification and the appended claims, unless the context clearly indicates otherwise, the singular forms "a", "an" and "the" are intended to include plural forms.

[0016] It should be further understood that the term "and / or" used in the specification and appended claims of this application refers to any combination and all possible combinations of one or more of the associated listed items, and includes these combinations. Figure 1 , an embodiment of the distributed task scheduling method of the OpenHarmony IoT device in the embodiment of the present application includes: Step 100: collect hardware parameters and classify devices of IoT in the OpenHarmony distributed network to obtain a device capability data set; It is understandable that the execution subject of the present application can be a distributed task scheduling device of an OpenHarmony IoT device, or a terminal or a server, which is not limited here. The present application embodiment is described by taking a server as the execution subject as an example.

[0017] Specifically, data collection is performed on the static hardware parameters of each IoT device in the OpenHarmony distributed network. The static hardware parameters include basic hardware information such as the device's CPU performance, memory capacity, storage space, network bandwidth, and energy consumption characteristics. These data can accurately reflect the basic configuration of IoT devices at the hardware level. At the same time, in the process of collecting static hardware parameters, the dynamic operation status of IoT devices is monitored in real time, including dynamic information such as the current load status of the device, the length of the task execution queue, real-time energy consumption, and network transmission delay. The computing power of IoT devices is systematically evaluated to quantify the computing power indicators of the devices. Based on a standardized computing task test framework, such as running fixed computing-intensive tasks and data processing tasks, a unified computing power quantification standard is formed by analyzing indicators such as the execution time, resource occupancy rate, and task throughput of the device on these tasks. Based on the computing power indicator data, IoT devices are hierarchically classified to construct device-level data. IoT devices are divided into three levels: terminal device layer, distributed soft bus node layer, and high-performance IoT device layer. The terminal device layer consists of low-power, resource-constrained IoT terminal devices, such as sensors and simple embedded devices; the distributed soft bus node layer mainly includes moderate-performance relay devices that can undertake certain computing and communication tasks; and the high-performance IoT device layer consists of high-performance devices with rich computing resources and stable network connections, which are suitable for performing complex computing tasks or assuming the core role of distributed scheduling. After completing the device level classification, a distributed soft bus communication link is constructed based on the device level data to form the communication link data between devices. In a distributed network, the soft bus, as a key mechanism for achieving efficient communication between devices, establishes optimized communication links based on the capabilities of different device levels and their geographical and topological locations. This process includes analyzing the physical connection, link bandwidth, and communication delay between devices to ensure that each device can find the optimal communication path in a distributed environment, reduce data transmission costs, and improve communication efficiency. Based on the communication link data, the heterogeneous collaborative capabilities of the entire OpenHarmony distributed network are analyzed. By combining the hardware performance, operating status, and communication capabilities of the device with the task scheduling requirements, the capability boundaries and optimization space of the entire distributed network in collaborative computing are evaluated. The results of heterogeneous collaborative capability analysis form collaborative capability data, which describes the potential performance of different types of equipment when performing tasks in collaboration and the overall load balancing capability of the system. The hardware basic data, operating status data, computing capability indicator data, device level data, communication link data, and collaborative capability data are associated and integrated to generate a device capability data set.Design efficient data integration and processing mechanisms to eliminate redundancy and conflict between data. At the same time, use fusion algorithms to mine the potential relationships between data to obtain device capability data sets that reflect the hardware and operating capabilities of each IoT device in the distributed network, and reveal the collaboration potential between devices and the performance boundaries of the overall network.

[0018] Step 200: Perform task parsing and dependency analysis on the application based on the device capability data set to obtain a task directed acyclic graph; Specifically, the processor parameters of the hardware basic data in the device capability data set are input into the application analysis module, and the logical structure and computing requirements of the application are analyzed to achieve the step-by-step decomposition of the task. The complex task is decomposed into basic task units that can be executed independently to form basic task unit data. In the process of task decomposition, the application analysis module will combine the processor characteristics of the device, such as the number of cores, frequency, supported instruction sets, and hardware acceleration capabilities, to ensure that the decomposed basic task units can match the hardware capabilities of the device. Subtasks are merged according to the basic task unit data and the computing capability indicator data in the device capability data set, and the order and structure of task execution are optimized, thereby reducing the switching overhead between tasks and the additional delay caused by data dependence, and obtaining an optimized subtask sequence. The computational complexity, data volume, and resource requirements of the basic task unit are analyzed, and combined with the computing capability of the device, it is determined which tasks can be merged and executed in the same device or the same time slice, thereby improving execution efficiency and reducing system overhead. Based on the optimized subtask sequence, the resource requirements of each subtask are quantified to generate task resource requirement data. The purpose of resource requirement quantification is to accurately estimate the resources such as CPU, memory, storage, and network bandwidth required by each subtask during execution. Through this quantification process, tasks and device capabilities are matched, and necessary inputs are provided for subsequent task scheduling. The matching degree of task resource requirement data and the collaborative capability data in the device capability data set is calculated to evaluate the compatibility between each task and the possible execution device, including the matching of computing capabilities, the adaptation of communication capabilities, and the balance of resource consumption, and generate task device adaptation data. Based on the task device adaptation data and the optimized subtask sequence, the data flow of the task is analyzed to generate data dependency data. Data flow analysis identifies the input-output relationship between tasks, clarifies the data transfer path between tasks, and explores potential parallel execution opportunities. Through analysis, dependencies between tasks are constructed. Based on the data dependency data, critical path analysis is performed on subtasks to generate execution priority data. Critical path analysis identifies the most critical dependency chain in the task execution path and determines the time bottleneck of the entire task execution. The execution priority data and data dependency data are combined to construct directed edges to form a dependency edge set. The process of constructing the dependency edge set is based on the dependency and priority information between tasks, providing complete edge information for the subsequent construction of a directed acyclic graph. Using the optimized subtask sequence as the nodes of the graph and the dependency edge set as the edges of the graph, through comprehensive analysis and construction, all subtasks and their dependencies are organized into a task directed acyclic graph, which describes the execution order and dependencies between tasks and ensures that all subtasks can run along the optimal path during the scheduling and execution process.

[0019] Step 300: According to the device capability data set and the task directed acyclic graph, the variational learning model is used to calculate the device load and predict resource allocation to obtain a device resource reservation table; It should be noted that the operating status data is extracted from the device capability data set, and the resource requirement data is extracted from the task directed acyclic graph, and the probability distribution model is constructed based on this. The likelihood function model is established by analyzing the current load, resource utilization, task execution history, and resource requirements such as CPU, memory, and network bandwidth required by the task. In this model, the load distribution parameters of the device and the resource allocation probability parameters are two core elements used to describe the current state of the device and its matching degree with the task requirements. The variational distribution function of the Gaussian distribution family is constructed based on the likelihood function model. By selecting the Gaussian distribution as the approximate function family, it is ensured that the model has good computational performance and convergence when processing complex probability distributions. Through the variational inference method, the parameters of the Gaussian distribution family (such as the mean vector and the covariance matrix) are used to approximate the posterior distribution of the original likelihood function to form a variational learning model. In the variational learning model, the load state of the device and the resource requirements of the task are uniformly modeled as a multivariate distribution, thereby capturing the collaborative relationship between devices and effectively handling the uncertainty in the task execution process. In order to optimize the variational learning model, the evidence lower bound objective function is calculated. The evidence lower bound is an optimization objective used to maximize the logarithmic posterior probability of the likelihood function model. By defining and calculating the evidence lower bound objective function, the problem is transformed into a solvable optimization problem. The objective function is iteratively optimized using the gradient ascent method to gradually update the parameters of the variational distribution. In each iteration, the gradient of the objective function is calculated and the mean vector and covariance matrix are adjusted to make the variational distribution closer to the actual posterior distribution, and the optimal variational parameters are obtained. Based on the optimal variational parameters, variational inference calculations are performed to generate device load prediction distributions, describing the load change trend of each device when performing tasks in the future. Combined with the task directed acyclic graph, the resource requirements of the task are calculated, and a resource allocation strategy is formulated accordingly. The resource allocation strategy includes the CPU time slices, memory usage, and network bandwidth allocation required for each task. At this stage, the model considers the execution priority of the task and the collaboration capability of the device to ensure that the resource allocation not only meets the task requirements but also achieves load balancing between devices. The resource allocation strategy is divided into time windows and device mapping. The resource allocation plan is mapped to specific time periods and devices to ensure that the task can be executed as planned. The goal of time window division is to reasonably allocate the start and end time of each task according to task dependencies and resource requirements, while minimizing conflicts and waiting between tasks. Device mapping is to allocate tasks to the most suitable devices for their execution, based on the hardware basic data and collaborative capability data in the device capability data set to ensure that the computing resources and communication resources of the device are optimally utilized. Finally, the device resource reservation table is obtained, which records the amount of resources that each device needs to reserve in different time periods, including CPU resources, memory resources, and network bandwidth.

[0020] The equipment load distribution is modeled according to the variational learning model, and the log-likelihood expectation calculation is performed on it. Based on the operating status data and task resource requirement data in the equipment capability data set, the probability of the equipment load distribution is used as the basis for the possibility evaluation of the task allocation results under the current state to obtain the likelihood expectation value. The likelihood expectation value indicates the rationality of the task scheduling results under the current distribution, and provides a preliminary quantitative basis for the optimization goal. The KL divergence (Kullback-Leibler Divergence) between the variational learning model and the true posterior distribution is calculated. The KL divergence measures the difference between the two distributions. By minimizing this value, the variational distribution is ensured to be as close to the true posterior distribution as possible, thereby improving the prediction accuracy of the model. The calculation process of the distribution difference value needs to combine the probability density of the variational distribution function and the posterior distribution function, and the difference value is obtained by integral calculation. The calculation of the KL divergence will use the numerical approximation method to reduce the computational complexity caused by the integration of high-dimensional data. The evidence lower bound function is constructed based on the likelihood expectation value and the distribution difference value as the initial optimization objective function. The definition of the evidence lower bound function comprehensively considers the performance of task scheduling and the accuracy of distribution fitting, and is the core goal of variational learning model optimization. When constructing the initial objective function, the constraints of actual task scheduling are introduced into the optimization goal. Resource capacity constraints and task dependency constraints are added. The resource capacity constraints ensure that the device does not exceed its available CPU, memory, and network bandwidth when executing tasks, while the task dependency constraints ensure that the execution order of tasks conforms to the dependencies in the task directed acyclic graph. By adding these constraints, the constrained optimization objective function is obtained, which ensures that the optimization result maximizes the objective function value while meeting the actual distributed task scheduling requirements. The gradient vector of the variational parameter is calculated according to the constrained optimization objective function. Based on the partial derivative of the objective function, the direction of parameter update is determined by analyzing the impact of parameter changes on the objective function. In order to improve the efficiency and stability of the optimization process, the adaptive learning rate, that is, the learning step value, is calculated based on the gradient vector. The size of the learning step directly affects the convergence speed and effect of the optimization process. Too large a learning step causes the parameter to skip the optimal solution, while too small a learning step causes the optimization process to be too slow. The adaptive learning rate is calculated using the Adam optimization algorithm or a similar method, which dynamically adjusts the step size according to the historical changes of the gradient to achieve fast and stable convergence. After obtaining the gradient direction and the learning step size, the variational parameters are updated and calculated based on the gradient ascent method. By adjusting the mean vector and covariance matrix of the variational distribution along the gradient direction, the objective function value is gradually improved, so that the variational distribution is closer to the true posterior distribution. After each parameter update, the updated parameters are iteratively optimized, and whether to stop the optimization process is determined based on the preset convergence conditions. The convergence condition is based on the change amplitude of the objective function or the number of iterations. When the change amplitude of the objective function value is lower than a certain threshold or the maximum number of iterations is reached, the optimization process terminates.Through multiple iterative optimizations, the optimal variational parameters, including the mean vector and covariance matrix, are obtained.

[0021] Step 400: construct a nonlinear optimization model based on the device resource reservation table and the task directed acyclic graph, and solve to obtain an initial task allocation plan; Specifically, the resource allocation requirements are modeled through the device resource reservation table, and a multi-objective optimization function is constructed, which includes the device computing time minimization target, the communication overhead minimization target, and the load balancing maximization target. These targets together constitute the optimization target matrix, where the device computing time minimization target focuses on reducing the total execution time of tasks on the device to improve the overall efficiency of the system; the communication overhead minimization target focuses on reducing the time and bandwidth consumption of data transmission between tasks; the load balancing maximization target aims to ensure that the task load is evenly distributed among devices, thereby avoiding single-point overload. The execution time of the subtasks in the task directed acyclic graph is analyzed and calculated to generate a time constraint matrix. The time constraint matrix contains key information such as the execution time of the task, the execution deadline, and the communication transmission delay. Among them, the task execution time is determined by the computing power of the device and the complexity of the task, while the execution deadline is determined by the functional requirements and real-time requirements of the application. The communication transmission delay reflects the data dependency between tasks and their time overhead in network transmission. These information are organized in the form of a matrix, which can provide time dimension constraints for the optimization model and ensure that the generated task allocation scheme meets all constraints in time. At the same time, the resource constraints of IoT devices are imposed according to the reserved resource values ​​in the device resource reservation table to generate a resource constraint matrix. The resource constraint matrix describes the upper limit of resource usage of each device in each time window, including CPU capacity, memory capacity, and bandwidth capacity. By introducing these constraints into the optimization model, it is ensured that the available resources of the device will not be exceeded during the task allocation process, thereby avoiding the problem of task execution failure or device performance degradation. According to the set of dependent edges in the task directed acyclic graph, the task sequence is constrained and modeled to construct a dependency constraint matrix. The dependency constraint matrix records the order relationship between tasks to ensure that the execution order of all subtasks conforms to the task dependency relationship during task scheduling. Weights are assigned to the optimization target matrix and the resource constraint matrix to generate a target weight vector, which reflects the priority of different optimization targets in specific application scenarios. Based on the target weight vector and each constraint matrix, a nonlinear optimization model is constructed. The goal of the nonlinear optimization model is to maximize the weighted objective function value while satisfying all time, resource, and dependency constraints. The complexity of this model is usually high, and the interior point method is used to solve it. The interior point method is a nonlinear optimization algorithm that can quickly converge to the global optimal solution under multiple constraints. By iteratively solving the interior point method, the parameters of the optimization model are gradually adjusted to the optimal solution, and the initial task allocation plan is generated.

[0022] Step 500: Perform two-stage distributed reinforcement learning optimization on the initial task allocation plan to obtain a target task scheduling plan; Specifically, the state features of the task execution order and resource allocation data in the initial task allocation scheme are constructed to obtain the state space vector. By extracting the task completion time features, resource utilization features and load balancing features, the key performance indicators of the initial task allocation are converted into numerical representations that can be parsed by the model. Among them, the task completion time feature describes the execution time of the task and its impact on the total execution time, the resource utilization feature reflects the CPU, memory and bandwidth resource usage of the device, and the load balancing feature measures the uniformity of task allocation between devices. The action space is constructed according to the state space vector to generate an action selection matrix. The action selection matrix contains a set of possible operations in the task scheduling process, including task reallocation operations, resource reconfiguration operations and execution order adjustment operations. Task reallocation operations refer to the reallocation of tasks between different devices to optimize resource utilization and task completion time; resource reconfiguration operations optimize resource utilization efficiency by adjusting the allocation ratio of CPU, memory and bandwidth; and execution order adjustment operations aim to rearrange the execution order of tasks, thereby reducing the dependent waiting time between tasks. The combination of these operations forms a complete action space, providing a variety of strategies for optimizing task scheduling for reinforcement learning models. Based on the state space vector and action selection matrix, the reward function is calculated for resource reservation to obtain the reward value matrix. The design of the reward function needs to comprehensively consider the goals and constraints of task scheduling, such as rewarding shorter task completion time, higher resource utilization, and better load balancing, while punishing failed operations caused by insufficient resources or task conflicts. The reward value matrix reflects the benefits of taking different actions under different states. The state space vector, action selection matrix, and reward value matrix are input into the second-stage real-time scheduling modeling to generate the scheduling state space. The scheduling state space is constructed on the basis of the initial task allocation plan and combined with the dynamic changes in the real-time scheduling process, which can more accurately describe the changes in time, resources, and dependencies in task scheduling. On this basis, a distributed policy gradient network is constructed to generate a policy network model. The policy network model adopts the Actor-Critic architecture, in which the Actor network is responsible for generating optimized actions, and the Critic network evaluates the value of the actions. This architecture can realize the collaborative training of policy optimization and value evaluation, and improve the efficiency and accuracy of task scheduling. In order to improve the scheduling effect, multi-agent collaborative training is performed based on the policy network model. Multi-agent collaborative training is a reinforcement learning method designed for distributed environments, in which each device acts as an agent, while optimizing task scheduling locally, sharing state information and reward feedback with other agents to jointly optimize the global task scheduling strategy. During the collaborative training process, the experience replay mechanism is used to sample and retrain historical scheduling data to prevent the policy network from falling into the local optimum. By dynamically adjusting the learning rate and reward weight, the adaptability and robustness of the policy network to different scenarios are improved.Through multiple iterations of training and experience replay optimization, the target task scheduling scheme is obtained. The target task scheduling scheme clarifies the target execution device, start time and resource quota of the task in each time window, ensuring that all tasks can be completed efficiently while meeting the time, resource and dependency constraints.

[0023] Step 600: deploy the target task scheduling solution to the IoT device and perform data collection and performance evaluation to obtain a performance evaluation data set, which includes execution time data, resource utilization data, and load balancing data.

[0024] Specifically, the target task scheduling scheme is sent to each IoT device through a distributed deployment system. This process involves binding tasks to devices, setting execution time windows, and initializing resource allocation parameters. The scheduling system pushes the execution details of each task (including target devices, start time, and allocated resource quota) to the corresponding device node according to the generated scheme. At the same time, the software system on the device side needs to provide comprehensive support for task execution to ensure that the task execution can be efficiently started according to the set time and resource requirements after receiving the scheduling instructions. During the task execution, a performance monitoring module is deployed on the device side to record the key performance indicators of the task execution process in real time, including execution time data, resource utilization data, and load balancing data. The performance data is transmitted and centrally stored. In a distributed environment, the data acquisition module packages the performance data and uploads it to the central monitoring server through the IoT communication protocol (such as MQTT or CoAP). The central server provides efficient data storage and processing capabilities to support real-time monitoring and analysis of large-scale devices. The stored data includes the original execution time, resource utilization, and load balancing information, as well as statistical and aggregated indicators generated based on these data. In the data analysis phase, the collected performance data is cleaned and preprocessed to filter out noise and outliers. The data is mined through a variety of analysis methods. For execution time data, statistical methods are used to calculate the average execution time, shortest execution time, and longest execution time of the task, so as to evaluate the overall efficiency of the scheduling scheme. For resource utilization data, the changing trend of resource usage is analyzed by drawing a time series graph, and the peak, average, and fluctuation range of resource usage are calculated to determine whether the resource allocation is reasonable. For load balance data, the distribution of task loads among devices is quantified by calculating the variance of load distribution or using balance indicators (such as the Theil index). After the analysis is completed, the performance evaluation results are organized into a performance evaluation data set. The performance evaluation data set is stored in a structured form, where the execution time data contains the actual start time, end time, and total execution time of each task; the resource utilization data includes the resource utilization curve and statistical characteristic values ​​of each device; and the load balance data is expressed in the form of device load distribution and balance indicators.

[0025] In the embodiments of the present application, through the construction of device capability data sets and device classification, comprehensive collection of hardware parameters and operating status of OpenHarmony IoT devices is achieved, providing an accurate basis for device capability evaluation for task scheduling; the task directed acyclic graph representation method is adopted to accurately describe the dependencies and resource requirements between tasks, making task decomposition and merging more reasonable and improving the accuracy of task scheduling; the variational learning algorithm is introduced to model and predict device loads, overcoming the problem of inaccurate load prediction in traditional methods and improving the rationality of resource reservation; through the construction and solution of nonlinear optimization models, task allocation optimization under multi-objective constraints is achieved, balancing multiple objectives such as execution time, communication overhead and load balancing; a two-stage distributed reinforcement learning method is used for task scheduling optimization, which effectively solves the real-time scheduling problem under dynamic load environments and improves the adaptability of the system; based on a distributed soft bus, efficient communication and collaborative computing between devices are achieved, the overhead of task migration and data transmission is reduced, and the overall performance of the system is improved.

[0026] In a specific embodiment, the process of executing step 100 may specifically include the following steps: Collect data on static hardware parameters of IoT devices in the OpenHarmony distributed network to obtain basic hardware data, and monitor the dynamic operating status of IoT devices in real time to obtain operating status data; Evaluate the computing power of IoT devices to obtain computing power index data, and classify IoT devices based on the computing power index data to obtain device hierarchical data. The device hierarchical data divides IoT devices into terminal device layer, distributed soft bus node layer and high-performance IoT device layer; Construct a distributed soft bus communication link for device-level data to obtain communication link data, and perform heterogeneous collaborative capability analysis on the OpenHarmony distributed network based on the communication link data to obtain collaborative capability data; The hardware basic data, operation status data, computing power indicator data, equipment level data, communication link data and collaborative capability data are associated and integrated to obtain the equipment capability data set.

[0027] Specifically, the static hardware parameters of IoT devices in the OpenHarmony distributed network are collected. The basic hardware data includes processor parameters, memory capacity, storage capacity, and network bandwidth. The basic data are: ; in, :equipment Processor frequency; :equipment The number of processor cores; equipment Storage capacity; :equipment The network bandwidth is used to monitor the dynamic operation status of IoT devices in real time. The operation status data includes CPU utilization, memory usage, and bandwidth occupancy. The running status data at time The time is expressed as: ; in, :equipment In time CPU utilization, For the The CPU cycle consumption of each task; :equipment Memory utilization, The amount of memory currently used by the device; :equipment The network bandwidth utilization rate, is the currently used bandwidth. The computing power of IoT devices is evaluated by the execution time of the benchmark task. and task load Computing equipment Computing capability indicators: ; in, : The standard computational load of the task (unit: number of operations); :equipment The time required to perform the task. Based on the computing power index, the devices are classified into different levels. Assume that the threshold of the level classification is , the device level It is expressed as: ; Build a distributed soft bus communication link for device-level data. and equipment The communication efficiency between is: ; in, :equipment and equipment The bandwidth between :equipment and equipment Based on the communication link data, the heterogeneous collaboration capability of the OpenHarmony distributed network is analyzed. It is expressed as: ; in, Indicates the device and equipment The above data are associated and fused to generate the equipment capability data set. , which is defined as: ; This dataset describes the static hardware capabilities, dynamic operating status, computing capabilities, hierarchical classification, communication performance, and collaboration capabilities of the device.

[0028] In a specific embodiment, the process of executing step 200 may specifically include the following steps: Input the processor parameters of the hardware basic data in the device capability data set into the application analysis module to perform task decomposition, obtain basic task unit data, and merge subtasks according to the basic task unit data and the computing capability index data in the device capability data set to obtain an optimized subtask sequence; Based on the optimized subtask sequence, the resource requirements of each subtask are quantified to obtain the task resource requirement data, and the matching degree between the task resource requirement data and the collaborative capability data in the equipment capability data set is calculated to obtain the task equipment adaptation data; Perform data flow analysis based on task equipment adaptation data and optimized subtask sequence to obtain data dependency data, and perform critical path analysis on subtasks based on the data dependency data to obtain execution priority data; Directed edges are constructed for the execution priority data and the data dependency data to obtain a dependency edge set, and a directed acyclic graph is constructed using the optimized subtask sequence as a graph node and the dependency edge set as a graph edge to obtain a task directed acyclic graph.

[0029] Specifically, the processor parameters in the device capability dataset, including the processor frequency of each device , Number of cores , instruction set support per core Input to the application analysis module. These parameters are used to analyze the execution requirements of tasks and decompose complex applications into a set of basic task units. Suppose the task set of the application is , each task The computational complexity of The unit of the task is the operand. The task decomposition is based on the instruction set supported by the processor. , the task Transformed into a basic task unit set , where each basic task unit Indicates that the device can Instruction set The decomposition process is described by the following formula: ; in It is the basic task unit The computational complexity of and computing capability indicator data in the device capability dataset , merge subtasks to optimize the task sequence. The goal of merging subtasks is to reduce the dependency overhead between tasks while matching the computing power of the device. The merging process is described by the following optimization formula: Minimize: , subject to ; in, is the communication time between subtasks; Yes Equipment Execute subtasks time; It is a subtask After the merging is completed, the optimized subtask sequence is obtained , where each It is a subtask after merging and optimization. Based on the optimized subtask sequence , quantify the resource requirements of each subtask to obtain the task resource requirement data. Resource requirement quantification calculates the CPU, memory, and bandwidth requirements of each subtask during execution. The resource requirement is expressed as: ; in, : CPU requirements of subtasks; and They are memory and network bandwidth requirements, estimated through historical data. Collaborate with device capability data Perform matching calculation to obtain task equipment adaptation data. The matching calculation is expressed by the following formula: ; in Represents a subtask On the device The higher the degree of match, the more suitable the device is for the task. and optimize the subtask sequence , perform data flow analysis to obtain data dependency data. Data dependency Defined as a task and tasks The degree of dependency between tasks is calculated by the amount of data transferred between tasks and the transmission path: ; in, It's a task and The amount of data between is the communication bandwidth. Based on data dependencies , perform critical path analysis on subtasks to determine execution priority data. The goal of critical path analysis is to find the bottleneck path in task execution, and its calculation formula is: ; in It is a directed edge set of task dependencies. According to the execution priority data and data dependency data, the directed edges are constructed to obtain the dependency edge set . The subtask sequence will be optimized As a graph node, it depends on the edge set As graph edges, construct a directed acyclic graph of tasks The directed acyclic graph clarifies the execution order and data dependencies of tasks, providing structured support for distributed scheduling.

[0030] In a specific embodiment, the process of executing step 300 may specifically include the following steps: Probabilistic distribution modeling is performed on the operating status data in the equipment capability data set and the resource demand data in the task directed acyclic graph to obtain a likelihood function model, which includes equipment load distribution parameters and resource allocation probability parameters; Based on the likelihood function model, the variational distribution function of the Gaussian distribution family is constructed to obtain a variational learning model; Calculate the evidence lower bound objective function according to the variational learning model to obtain the optimization objective function, and perform gradient ascent iterative calculation on the optimization objective function to obtain the optimal variational parameters, which include the mean vector and the covariance matrix; Based on the optimal variational parameters, variational inference calculation is performed to obtain the predicted distribution of equipment load, and resource demand calculation is performed based on the predicted distribution of equipment load and the directed acyclic graph of tasks to obtain the resource allocation strategy, which includes the allocation of CPU resources, memory resources, and bandwidth resources; The resource allocation strategy is divided into time windows and device mapping to obtain a device resource reservation table.

[0031] Specifically, the operating status data in the equipment capability data set is analyzed to obtain the current load status of the equipment. The operating status is , including CPU usage , memory usage , Bandwidth usage Assume that the resource demand data in the task directed acyclic graph is , indicating the task Various resources required during the execution process. In order to accurately model the equipment load, probability distribution modeling is performed based on the task resource requirements and equipment operating status data to obtain the likelihood function of equipment load distribution. When performing probability distribution modeling, according to the equipment operating status and resource requirements data for tasks , assuming that they follow a certain probability distribution, choose Gaussian distribution (normal distribution) for modeling. Assume that the equipment load The distribution of is expressed as: ; in Yes Equipment The load average, Yes Equipment The covariance matrix of the loadings. Task Resource requirements Modeled in a similar way, assuming that the resource requirements of tasks follow a normal distribution: ; in and are the mean and covariance of the task resource requirements, respectively. The relationship between the equipment load distribution and the task resource demand distribution is described by the likelihood function model. Assume that the equipment load distribution parameter is , the resource allocation probability parameter is , then the likelihood function model is expressed as: ; The likelihood function model captures the correlation between device load and resource requirements through the relationship between device load distribution and task resource requirements. Based on the likelihood function model, a variational distribution function of the Gaussian distribution family is constructed to obtain a variational learning model. The purpose of variational inference is to optimize the variational distribution. , so that the distribution is as close as possible to the true posterior distribution. is the variational distribution function, which belongs to the Gaussian distribution family and has the form: ; in and is the mean and covariance of the variational distribution for the equipment load distribution parameters, and is the mean and covariance of the variational distribution for the probability parameter of resource allocation. Based on the variational distribution function, the evidence lower bound objective function is calculated to optimize the variational parameters. It is expressed as: ; Among them, the first term is the expectation of the likelihood function, and the second term is the entropy of the variational distribution. The optimization objective function is solved by the gradient ascent method to obtain the optimal variational parameter The optimization process is expressed as: ; Through multiple iterations, the optimal estimate of device load distribution and resource allocation probability is obtained, that is, the mean vector and the covariance matrix Based on the optimal variational parameters, variational inference is performed to obtain the predicted distribution of the equipment load. The goal of variational inference is to calculate the posterior distribution of the equipment load through the variational distribution. According to the Bayesian inference principle, the posterior distribution is expressed as: ; in, is the prior distribution, is the likelihood function of the device load. In the framework of variational inference, the variational distribution is used Approximate posterior distribution , and infer the load distribution of the equipment by optimizing the variational distribution. Based on the predicted distribution of equipment load and the resource demand data in the task directed acyclic graph, the resource demand is calculated to obtain the resource allocation strategy. The load forecast is ,Task The resource requirement is , resource allocation strategy The following constraints need to be met: ; in Yes Equipment The maximum load of the device is ensured to ensure that the load of the device does not exceed its maximum processing capacity. According to the resource allocation strategy obtained by the device load prediction distribution and resource demand calculation, the device's resource allocation amount (including CPU, memory and bandwidth) will be allocated to the task. The resource allocation strategy is divided into time windows and device mapping to obtain the device resource reservation table. In the resource allocation strategy, tasks need to be executed in different time windows, and the time windows are divided according to the execution time of the task and the available resources of the device. The time window division is performed using the following formula: ; in It's a task The execution time, is the maximum time window. According to the time window division and the resource requirements of the task, the equipment is allocated to the corresponding time window to form a device resource reservation table.

[0032] In a specific embodiment, the process of executing step 400 may specifically include the following steps: The log-likelihood expectation of the equipment load distribution is calculated according to the variational learning model to obtain the likelihood expectation value, and the KL divergence of the variational learning model and the true posterior distribution is calculated to obtain the distribution difference value; Based on the expected value of likelihood and the distribution difference value, an evidence lower bound function is constructed to obtain the initial objective function, and resource capacity constraints and task dependency constraints are added to the initial objective function to obtain the constrained optimization objective function; The gradient vector of the variational parameter is calculated according to the constrained optimization objective function to obtain the parameter update direction, and the adaptive learning rate is calculated based on the parameter update direction to obtain the learning step value; The variational parameters are updated by gradient ascent calculation to obtain updated variational parameters, and the updated variational parameters are iteratively optimized according to preset convergence conditions to obtain optimal variational parameters. The optimal variational parameters include mean vector and covariance matrix.

[0033] Specifically, when performing variational learning, the equipment load distribution is modeled. The load distribution is ,in Indicates the device Assume that the equipment load follows a normal distribution ,in is the load average, is the covariance matrix. In order to perform variational inference, construct the variational distribution , and also assume that it is a Gaussian distribution with a mean of , the covariance matrix is To perform variational inference, we calculate the expected log-likelihood of the device load. Indicates the device The log-likelihood of is written as: ; in, It represents the conditional probability of the equipment load under a given mean and covariance matrix. The expected value of the likelihood is obtained by calculating the expected value of the likelihood function: ; Among them, the expected value In the variational distribution The value obtained by integrating the log-likelihood function is as follows. The KL divergence between the variational distribution and the true posterior distribution is calculated. The KL divergence measures the difference between the two distributions. The definition of KL divergence is as follows: ; in, is the variational distribution, is the true load distribution. The smaller the KL divergence, the closer the variational distribution is to the true posterior distribution. By minimizing this KL divergence, the variational parameters are optimized so that the variational distribution better approximates the true posterior distribution. Based on the likelihood expectation and KL divergence, the evidence lower bound (ELBO) function is constructed, and the objective function is used to optimize the variational distribution. The form of the ELBO function is as follows: ; The first term is the log-likelihood expectation, and the second term is the entropy of the variational distribution. The variational parameters are optimized by maximizing the evidence lower bound function. In order to consider resource constraints and task dependencies, constraints are added to the initial objective function to obtain the constrained optimization objective function. Let the resource constraint be And the task dependency constraints are , then the constrained optimization objective function is expressed as: ; in, and is the penalty coefficient of resource constraints and task dependency constraints, which is used to adjust the importance of constraints. In order to optimize the variational parameters, the gradient vector of the variational parameters is calculated. Assume that the parameters of the variational distribution are , the parameter update direction is obtained by calculating the gradient of the objective function. The gradient vector of the objective function is calculated by the chain rule: ; The learning step size is obtained by calculating the adaptive learning rate , Commonly used methods include gradient-based adaptive learning rate adjustment algorithms (such as Adam, Adagrad, etc.). The adaptive learning rate is calculated as: ; in is the learning rate, is the mean of the squared gradients, is a small constant to prevent division by zero errors. Based on the gradient vector and the learning step size, the variational parameters are updated by gradient ascent. The update rule of gradient ascent is: ; in It is The variational parameters of the iteration, is the updated variational parameter. Through multiple iterations of updates, until the convergence condition is met, the variational parameter finally converges to the optimal value. ,in and Respectively represent the mean vector and covariance matrix of the variational distribution. In the iterative optimization process, when the optimization process converges, the optimal variational parameters are obtained. The convergence condition is when the change of the objective function is less than the preset threshold ,Right now: ; When this condition is met, the variational parameters are considered to have converged and the optimization goal has been achieved. Through these steps, the optimal variational parameters are obtained.

[0034] In a specific embodiment, the process of executing step 500 may specifically include the following steps: Based on the device resource reservation table, a multi-objective function is constructed for resource allocation to obtain an optimization target matrix, which includes the target of minimizing device computing time, the target of minimizing communication overhead, and the target of maximizing load balancing. Calculate the execution time of subtasks in the task directed acyclic graph to obtain the time constraint matrix, which includes task execution time, execution deadline, and communication transmission delay; According to the reserved resource values ​​in the device resource reservation table, the resources of the IoT devices are restricted to obtain a resource constraint matrix, which includes the upper limit of CPU capacity, memory capacity, and bandwidth capacity in each time window; The task order constraints are constructed based on the dependency edge set in the task directed acyclic graph to obtain the dependency constraint matrix, and the optimization target matrix and resource constraint matrix are weighted to obtain the target weight vector. A nonlinear optimization model is constructed according to the target weight vector and the constraint matrix, and the nonlinear optimization model is solved by the interior point method to obtain an initial task allocation scheme, which includes the correspondence between subtasks and devices and the execution time points.

[0035] Specifically, based on the device resource reservation table, a multi-objective function is constructed to obtain an optimization target matrix. The construction of the optimization target matrix needs to consider multiple factors, including the device computing time minimization target, the communication overhead minimization target, and the load balancing maximization target. The calculation time is , the communication overhead is , the load balancing degree is , then the optimization target matrix O is expressed as: ; in, represents the computation time minimization objective, represents the communication cost minimization objective, Represents the goal of maximizing load balancing. The optimization target matrix reflects how to balance these three goals when resources are limited. The goals of minimizing computing time and communication overhead are as small as possible, while the load balancing degree is expected to be as large as possible, that is, the load on each device is as even as possible. The execution time of the subtasks in the task directed acyclic graph is calculated to obtain the time constraint matrix. The time constraint matrix contains the time information of task execution, including the execution time, execution deadline and communication transmission delay of the task. Assume that task The execution time is , the deadline is , the communication delay is , then the time constraint matrix It is expressed as: ; The matrix defines the time requirements for each task, including the latest time (deadline) for task completion and the communication delay during the completion process. Based on the reserved resource values ​​in the device resource reservation table, the resource constraints of the IoT devices are imposed to obtain the resource constraint matrix. The resource constraint matrix describes the resource constraints of the device in each time window, including the upper limit of the CPU capacity, memory capacity, and bandwidth capacity of each device. Assume that the device In the time window The maximum resources for CPU, memory, and bandwidth within , and , then the resource constraint matrix for: ; These resource constraints ensure that during the task allocation process, the device will not exceed its resource limit within a specific time window. The resource constraint matrix is ​​closely related to the device capability data, ensuring the feasibility of task scheduling under limited resources. The task order constraints are constructed based on the dependency edge set in the task directed acyclic graph to obtain the dependency constraint matrix. The task dependency relationship describes the execution order between tasks and ensures that tasks are scheduled in the correct order. Suppose task and tasks There is a dependency relationship between tasks, indicating that Need to be on task It can only be executed after completion, depending on the constraint matrix Defined as: ; in, is a binary matrix. If the task Depends on the task ,but ,otherwise . This matrix reflects the execution order constraints between tasks. Based on the optimization target matrix and the resource constraint matrix, weights are assigned to obtain the target weight vector. The target weight vector w is used to represent the importance of each optimization target, which is manually specified or dynamically adjusted according to the characteristics of the task. Assume that the target weight vector is: ; in, , and Represent the weights of the objective of minimizing computing time, minimizing communication overhead, and maximizing load balancing. Through weight allocation, the priority of each objective is adjusted according to the actual needs of the task. According to the objective weight vector and constraint matrix, a nonlinear optimization model is constructed. This model obtains a task allocation scheme that satisfies resource constraints, time constraints, and task dependency constraints by optimizing the objective function. Assume that the optimization objective function for: ; in, represents the optimization target matrix, represents the time constraint matrix, represents the resource constraint matrix, represents the dependency constraint matrix, , and is the corresponding penalty coefficient. By adjusting these coefficients, the influence of each constraint condition is balanced. The interior point method is used to solve the nonlinear optimization model. The interior point method is a method for solving constrained optimization problems, which is suitable for dealing with nonlinear optimization problems with constraints. Through the interior point method, the initial task allocation solution is obtained. ,in Including the correspondence between each subtask and the device and the execution time point. Task allocation plan The execution order and resource allocation of each task on each device are determined to meet the time, resource and dependency constraints.

[0036] In a specific embodiment, the process of executing step 600 may specifically include the following steps: The first stage state feature construction is performed on the task execution order and resource allocation data in the initial task allocation plan to obtain a state space vector, which includes task completion time features, resource utilization features, and load balancing features; The action space is constructed according to the state space vector to obtain the action selection matrix, which includes task reallocation operation, resource reconfiguration operation, and execution order adjustment operation; Calculate the reward function for resource reservation based on the state space vector and the action selection matrix to obtain a reward value matrix; The second stage of real-time scheduling modeling is performed on the state space vector, action selection matrix and reward value matrix to obtain the scheduling state space, and a distributed policy gradient network is constructed based on the scheduling state space to obtain the policy network model. The policy network model adopts the Actor-Critic architecture, including action network parameters and evaluation network parameters. Based on the policy network model, multi-agent collaborative training is carried out to obtain the collaborative scheduling strategy, and the collaborative scheduling strategy is optimized through experience replay to obtain the target task scheduling scheme. The target task scheduling scheme determines the target execution device, start time and resource quota of the task in each time window.

[0037] Specifically, for the task execution order and resource allocation data in the initial task allocation plan, the first stage of state feature construction is carried out to obtain the state space vector. The state space vector is an important representation of the current state of the system, which contains information on task completion time characteristics, resource utilization characteristics, load balancing characteristics, etc. The completion time is , the resource utilization is , the load balancing degree is , then the state space vector s is expressed as: ; in, Indicates the number of tasks, Indicates the number of devices. For the The completion time of a task, For the The resource utilization of each device, Indicates the load balance. It is calculated by the variance of equipment resource utilization. The specific formula is: ; Load balancing The maximum value of is 1, indicating that the resource utilization of all devices is balanced, while the minimum value indicates that the resource utilization of devices varies greatly. Therefore, the higher the load balancing degree, the better the system performance. The action space is constructed based on the state space vector to obtain the action selection matrix. The action selection matrix defines the actions taken by the system, including task reallocation operations, resource reconfiguration operations, execution order adjustment operations, etc. Let each action in the action space be ,in Represents a task reallocation operation, Represents a resource reconfiguration operation, Represents the execution order adjustment operation, action selection matrix It is expressed as: ; Each action modifies the current task allocation and resource configuration through a certain algorithm, thereby affecting the overall performance of the system. For example, the task reallocation operation will change the task allocation device, the resource reconfiguration operation will reallocate the resource capacity of the device, and the execution order adjustment operation will rearrange the execution order of the tasks. Based on the state space vector and the action selection matrix, the reward function for resource reservation is calculated to obtain the reward value matrix. The reward function is used to evaluate the contribution of an action to the task scheduling effect, and is defined by measuring multiple objectives such as task completion time, resource utilization, and load balancing. Assume that the execution time of the task is , the resource utilization is , the load balancing degree is , then the reward function Defined as: ; in, is the weight coefficient, which controls the relative importance of each goal. The purpose of this reward function is to minimize the task completion time, maximize resource utilization, and maximize load balance, thereby improving the overall performance of task scheduling. By calculating the reward value for each action execution, the reward value matrix It is expressed as: ; The reward matrix reflects the effect of performing different actions under different states. In the second phase of real-time scheduling modeling, the scheduling state space is constructed based on the state space vector, action selection matrix and reward value matrix. The scheduling state space reflects the dynamic state of task scheduling, including all possible system states and actions to transition from the current state to the next state. A distributed policy gradient network is used to model the scheduling state space to obtain a policy network model. The policy network model adopts an Actor-Critic architecture, in which the Actor part is used to select actions and the Critic part is used to evaluate the value of actions. Assume that the current state is , in the selection action After that, the next state of the system is , then the action selection strategy in the Actor Critic architecture and the evaluation function Respectively expressed as: ; ; in, is the state-action value function, which means that in the state Next select action Quality, is the policy function, which means that in the state Next select action probability. Based on the policy network model, multi-agent collaborative training is performed to obtain a collaborative scheduling strategy. In a multi-agent environment, each agent (i.e., each device or each task) adjusts task allocation and resource allocation according to its own state and strategy to achieve global optimization. Multi-agent collaborative training uses experience replay optimization to store the experience of each agent during the training process (i.e., state, action, reward sequence), and randomly extracts batches from it for training. By continuously optimizing the policy network, the target task scheduling scheme is obtained, which determines the target execution device, start time, and resource quota of the task in each time window.

[0038] The above describes the distributed task scheduling method of the OpenHarmony IoT device in the embodiment of the present application. The following describes the distributed task scheduling device 10 of the OpenHarmony IoT device in the embodiment of the present application. Figure 2 In the embodiment of the present application, an embodiment of the distributed task scheduling device 10 of the OpenHarmony IoT device includes: The acquisition module 11 is used to collect hardware parameters and classify devices of the Internet of Things in the OpenHarmony distributed network to obtain a device capability data set; An analysis module 12 is used to perform task parsing and dependency analysis on the application based on the device capability data set to obtain a task directed acyclic graph; The prediction module 13 is used to calculate the device load and predict the resource allocation based on the device capability data set and the task directed acyclic graph using a variational learning model to obtain a device resource reservation table; A construction module 14 is used to construct a nonlinear optimization model based on the device resource reservation table and the task directed acyclic graph, and solve to obtain an initial task allocation solution; The optimization module 15 is used to perform two-stage distributed reinforcement learning optimization on the initial task allocation plan to obtain a target task scheduling plan; The evaluation module 16 is used to deploy the target task scheduling solution to the IoT device and perform data collection and performance evaluation to obtain a performance evaluation data set, which includes execution time data, resource utilization data and load balancing data.

[0039] Through the collaborative cooperation of the above-mentioned components, through the construction of device capability data sets and device classification, the comprehensive collection of hardware parameters and operating status of OpenHarmony IoT devices is achieved, providing an accurate basis for device capability evaluation for task scheduling; the task directed acyclic graph representation method is adopted to accurately describe the dependencies and resource requirements between tasks, making task decomposition and merging more reasonable and improving the accuracy of task scheduling; the variational learning algorithm is introduced to model and predict device loads, overcoming the problem of inaccurate load prediction in traditional methods and improving the rationality of resource reservation; through the construction and solution of nonlinear optimization models, task allocation optimization under multi-objective constraints is achieved, balancing multiple objectives such as execution time, communication overhead and load balancing; the two-stage distributed reinforcement learning method is used for task scheduling optimization, which effectively solves the real-time scheduling problem under dynamic load environments and improves the adaptability of the system; based on the distributed soft bus, efficient communication and collaborative computing between devices are achieved, reducing the overhead of task migration and data transmission, and improving the overall performance of the system.

[0040] See also Figure 3 , Figure 3 This is a schematic block diagram of the structure of an electronic device 300 provided in an embodiment of the present application. The electronic device 300 includes a processor 301 and a memory 302. The processor 301 and the memory 302 are connected via a device bus 303, wherein the memory 302 may include a non-volatile storage medium and an internal memory.

[0041] The non-volatile storage medium can store a computer program. The computer program includes program instructions, and when the program instructions are executed by the processor 301, the processor 301 can execute any of the above-mentioned distributed task scheduling methods for OpenHarmony IoT devices.

[0042] The processor 301 is used to provide computing and control capabilities to support the operation of the entire electronic device 300 .

[0043] The internal memory provides an environment for the operation of the computer program in the non-volatile storage medium. When the computer program is executed by the processor 301, the processor 301 can execute any of the above-mentioned distributed task scheduling methods for OpenHarmony IoT devices.

[0044] Those skilled in the art will understand that Figure 3 The structure shown in the figure is only a block diagram of a partial structure related to the present application scheme, and does not constitute a limitation on the electronic device 300 involved in the present application scheme. The specific electronic device 300 may include more or fewer components than shown in the figure, or combine certain components, or have a different component arrangement.

[0045] It should be understood that the processor 301 may be a central processing unit (CPU), and the processor 301 may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. Among them, the general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0046] It should be noted that those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the electronic device 300 described above can refer to the corresponding process of the distributed task scheduling method of the aforementioned OpenHarmony IoT device, and will not be repeated here.

[0047] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by one or more processors, the one or more processors implement a distributed task scheduling method for an OpenHarmony IoT device as provided in an embodiment of the present application.

[0048] The computer-readable storage medium may be an internal storage unit of the electronic device 300 in the aforementioned embodiment, such as a hard disk or memory of the electronic device 300. The computer-readable storage medium may also be an external storage device of the electronic device 300, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped with the electronic device 300.

[0049] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices and units described above can refer to the corresponding processes in the aforementioned method embodiments and will not be repeated here.

[0050] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application is essentially or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product. The computer software product is stored in a storage medium, including several instructions to enable an electronic device (which can be a personal computer, server, or network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM), random access memory (RAM), disk or optical disk, etc., various media that can store program codes.

[0051] As described above, the above embodiments are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A distributed task scheduling method for OpenHarmony IoT devices, characterized in that: The method comprises: Collect hardware parameters and classify devices in the OpenHarmony distributed network to obtain device capability datasets; Performing task parsing and dependency analysis on the application based on the device capability dataset to obtain a task directed acyclic graph; According to the device capability data set and the task directed acyclic graph, a variational learning model is used to calculate the device load and predict resource allocation to obtain a device resource reservation table; Constructing a nonlinear optimization model based on the device resource reservation table and the task directed acyclic graph, and solving to obtain an initial task allocation solution; Performing two-stage distributed reinforcement learning optimization on the initial task allocation scheme to obtain a target task scheduling scheme; The target task scheduling scheme is deployed to the IoT device and data collection and performance evaluation are performed to obtain a performance evaluation data set, which includes execution time data, resource utilization data, and load balancing data.

2. The distributed task scheduling method of OpenHarmony IoT device according to claim 1, characterized in that: The hardware parameter collection and device classification of IoT devices in the OpenHarmony distributed network are performed to obtain a device capability data set, including: Collect data on static hardware parameters of IoT devices in the OpenHarmony distributed network to obtain hardware basic data, and monitor the dynamic operating status of the IoT devices in real time to obtain operating status data; Evaluate the computing capability of IoT devices to obtain computing capability index data, and classify IoT devices by level based on the computing capability index data to obtain device level data, wherein the device level data classifies IoT devices into a terminal device layer, a distributed soft bus node layer, and a high-performance IoT device layer; Constructing a distributed soft bus communication link for the device-level data to obtain communication link data, and performing heterogeneous collaborative capability analysis on the OpenHarmony distributed network based on the communication link data to obtain collaborative capability data; The hardware basic data, the operating status data, the computing capability index data, the device level data, the communication link data and the collaborative capability data are data-associated and fused to obtain a device capability data set.

3. The distributed task scheduling method of OpenHarmony IoT device according to claim 2, characterized in that: The performing task parsing and dependency analysis on the application based on the device capability data set to obtain a task directed acyclic graph includes: Input the processor parameters of the hardware basic data in the device capability data set into the application analysis module to perform task decomposition to obtain basic task unit data, and merge subtasks according to the basic task unit data and the computing capability indicator data in the device capability data set to obtain an optimized subtask sequence; Quantifying the resource requirements of each subtask based on the optimized subtask sequence to obtain task resource requirement data, and calculating the matching degree between the task resource requirement data and the collaborative capability data in the device capability data set to obtain task device adaptation data; Performing data flow analysis on the task device adaptation data and the optimized subtask sequence to obtain data dependency data, and performing critical path analysis on the subtasks based on the data dependency data to obtain execution priority data; Directed edges are constructed for the execution priority data and the data dependency data to obtain a dependency edge set, and a directed acyclic graph is constructed using the optimized subtask sequence as a graph node and the dependency edge set as a graph edge to obtain a task directed acyclic graph.

4. The distributed task scheduling method of OpenHarmony IoT device according to claim 3, characterized in that: The device resource reservation table is obtained by calculating the device load and predicting resource allocation using a variational learning model according to the device capability data set and the task directed acyclic graph, including: Probability distribution modeling is performed on the operating status data in the device capability data set and the resource demand data in the task directed acyclic graph to obtain a likelihood function model, wherein the likelihood function model includes a device load distribution parameter and a resource allocation probability parameter; Constructing a variational distribution function of the Gaussian distribution family based on the likelihood function model to obtain a variational learning model; Calculating the evidence lower bound objective function according to the variational learning model to obtain an optimized objective function, and performing gradient ascent iterative calculation on the optimized objective function to obtain optimal variational parameters, wherein the optimal variational parameters include a mean vector and a covariance matrix; Perform variational inference calculation based on the optimal variational parameters to obtain device load prediction distribution, and perform resource demand calculation based on the device load prediction distribution and the task directed acyclic graph to obtain a resource allocation strategy, wherein the resource allocation strategy includes a CPU resource allocation amount, a memory resource allocation amount, and a bandwidth resource allocation amount; The resource allocation strategy is divided into time windows and device mapped to obtain a device resource reservation table.

5. The distributed task scheduling method of OpenHarmony IoT device according to claim 4, characterized in that: The method of calculating the evidence lower bound objective function according to the variational learning model to obtain an optimized objective function, and performing gradient ascent iterative calculation on the optimized objective function to obtain optimal variational parameters, wherein the optimal variational parameters include a mean vector and a covariance matrix, including: Performing log-likelihood expectation calculation on the equipment load distribution according to the variational learning model to obtain a likelihood expectation value, and performing KL divergence calculation on the variational learning model and the true posterior distribution to obtain a distribution difference value; Constructing an evidence lower bound function based on the likelihood expectation value and the distribution difference value to obtain an initial objective function, and adding resource capacity constraints and task dependency constraints to the initial objective function to obtain a constrained optimization objective function; Calculating the gradient vector of the variational parameter according to the constrained optimization objective function to obtain a parameter update direction, and performing adaptive learning rate calculation based on the parameter update direction to obtain a learning step value; The variational parameters are updated by gradient ascent calculation to obtain updated variational parameters, and the updated variational parameters are iteratively optimized according to preset convergence conditions to obtain optimal variational parameters, wherein the optimal variational parameters include a mean vector and a covariance matrix.

6. The distributed task scheduling method of OpenHarmony IoT device according to claim 5, characterized in that: The nonlinear optimization model is constructed based on the device resource reservation table and the task directed acyclic graph, and an initial task allocation scheme is obtained by solving the problem, including: Based on the device resource reservation table, a multi-objective function is constructed for resource allocation to obtain an optimization target matrix, wherein the optimization target matrix includes a device computing time minimization target, a communication overhead minimization target, and a load balancing maximization target; Calculating the execution time of subtasks in the task directed acyclic graph to obtain a time constraint matrix, wherein the time constraint matrix includes task execution duration, execution deadline, and communication transmission delay; According to the reserved resource values ​​in the device resource reservation table, resources of the IoT device are restricted to obtain a resource constraint matrix, wherein the resource constraint matrix includes a CPU capacity upper limit, a memory capacity upper limit, and a bandwidth capacity upper limit for each time window; Constructing task order constraints based on the dependent edge set in the task directed acyclic graph to obtain a dependent constraint matrix, and performing weight assignment on the optimization target matrix and the resource constraint matrix to obtain a target weight vector; A nonlinear optimization model is constructed according to the target weight vector and the constraint matrix, and the nonlinear optimization model is solved by the interior point method to obtain an initial task allocation scheme, wherein the initial task allocation scheme includes a correspondence between subtasks and devices and an execution time point.

7. The distributed task scheduling method for OpenHarmony IoT devices according to claim 6, characterized in that: The two-stage distributed reinforcement learning optimization is performed on the initial task allocation scheme to obtain a target task scheduling scheme, including: Performing a first-stage state feature construction on the task execution sequence and resource allocation data in the initial task allocation scheme to obtain a state space vector, wherein the state space vector includes a task completion time feature, a resource utilization rate feature, and a load balancing feature; Constructing an action space according to the state space vector to obtain an action selection matrix, wherein the action selection matrix includes a task reallocation operation, a resource reconfiguration operation, and an execution order adjustment operation; Performing reward function calculation on resource reservation based on the state space vector and the action selection matrix to obtain a reward value matrix; Performing second-stage real-time scheduling modeling on the state space vector, the action selection matrix, and the reward value matrix to obtain a scheduling state space, and constructing a distributed policy gradient network according to the scheduling state space to obtain a policy network model, wherein the policy network model adopts an Actor-Critic architecture and includes action network parameters and evaluation network parameters; Based on the policy network model, multi-agent collaborative training is performed to obtain a collaborative scheduling strategy, and the collaborative scheduling strategy is optimized through experience replay to obtain a target task scheduling scheme, which determines the target execution device, start time and resource quota of the task in each time window.

8. A distributed task scheduling device for OpenHarmony IoT devices, characterized in that: A method for executing a distributed task scheduling method for an OpenHarmony IoT device according to any one of claims 1 to 7, the device comprising: The acquisition module is used to collect hardware parameters and classify devices in the OpenHarmony distributed network to obtain device capability data sets; An analysis module, used to perform task parsing and dependency analysis on the application based on the device capability data set to obtain a task directed acyclic graph; A prediction module, configured to calculate the device load and predict resource allocation using a variational learning model based on the device capability data set and the task directed acyclic graph, and obtain a device resource reservation table; A construction module, used to construct a nonlinear optimization model based on the device resource reservation table and the task directed acyclic graph, and solve to obtain an initial task allocation solution; An optimization module, used for performing two-stage distributed reinforcement learning optimization on the initial task allocation scheme to obtain a target task scheduling scheme; The evaluation module is used to deploy the target task scheduling solution to the IoT device and perform data collection and performance evaluation to obtain a performance evaluation data set, which includes execution time data, resource utilization data and load balancing data.

9. An electronic device, characterized in that: The electronic device comprises: a memory and at least one processor, wherein instructions are stored in the memory; The at least one processor calls the instructions in the memory so that the electronic device executes the distributed task scheduling method for the OpenHarmony IoT device as described in any one of claims 1-7.

10. A computer-readable storage medium having instructions stored thereon, characterized in that: When the instructions are executed by the processor, the distributed task scheduling method for the OpenHarmony IoT device according to any one of claims 1 to 7 is implemented.

Citation Information

Cited By

  • Task processing method, device, equipment and product

    CN120317030A

  • Production element collaborative awareness service combination optimization method under industrial internet

    CN120355154A

  • Task scheduling method and device and storage medium

    CN120386611A

  • Intelligent resource scheduling method and system based on dynamic data consanguinity map

    CN120407208A

  • Development experiment box multi-device cooperative control method based on open-source gap system

    CN120596231A