Task offloading method and apparatus, non-volatile storage medium
By generating task sequences and determining computing power and energy consumption constraints, and selecting appropriate unloading methods, the problem of improper node selection during task unloading is solved, and task processing and transmission latency is reduced.
Patent Information
- Application Number
- CN202411999303.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-31
- Publication Date
- 2025-12-12
- Estimated Expiration
- 2044-12-31
AI Technical Summary
In the Industrial Internet, existing technologies struggle to simultaneously consider the dependencies between tasks, equipment energy consumption limitations, and computing resource limitations when unloading tasks, resulting in poor quality of the selected unloading nodes and increased task processing and transmission latency.
By receiving task unloading requests, generating task sequences, determining computing power constraints and energy consumption constraints, selecting appropriate unloading methods (local, cloud, or edge unloading), and transferring tasks according to the unloading path to meet dependency, computing resource, and energy consumption limitations.
In dependency-based task scenarios, the system comprehensively considers various constraints and selects the optimal unloading node to reduce task processing and transmission latency.
Smart Images

Figure CN119781985B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of edge computing, in particular to a task offloading method and device, and a nonvolatile storage medium. BACKGROUND
[0002] In the industrial internet, with the development of modular program design, more and more application tasks are composed of multiple modules and can be modeled as dependent tasks. Specifically, there is an execution sequence among multiple tasks, and in this dependent task scenario, the dependency relationship among tasks needs to be added as a consideration factor when selecting an offloading node. In the related art, when performing task offloading, it is difficult to obtain resource parameters such as link bandwidth and delay, so when selecting an offloading node, the dependency relationship among tasks, the device energy consumption limit, and the computing resource limit cannot be considered at the same time, which may select a node with poor path transmission quality as the offloading node, increase the task processing delay and transmission delay, and cause high transmission data delay.
[0003] At present, no effective solution has been proposed for the above problems. SUMMARY
[0004] Embodiments of the present application provide a task offloading method and device, and a nonvolatile storage medium, to at least solve the technical problem of poor quality of the selected offloading node, and increased task processing delay, caused by the fact that the method for performing task offloading in the related art cannot consider the dependency relationship among tasks, the device energy consumption limit, and the computing resource limit at the same time.
[0005] According to an aspect of the embodiments of the present application, a task offloading method is provided, including: receiving a task offloading request, wherein the task offloading request records at least the following information: a plurality of to-be-offloaded tasks, a dependency relationship of the plurality of to-be-offloaded tasks, the dependency relationship being used to indicate an execution order between the plurality of to-be-offloaded tasks, and the dependency relationship including: parallel execution, sequential execution; generating at least one task sequence according to the plurality of to-be-offloaded tasks and the dependency relationship, wherein the task sequence is used to indicate the execution order of the plurality of to-be-offloaded tasks included in the offloaded task sequence; for each to-be-offloaded task, determining a computing capability constraint and an energy consumption constraint of the to-be-offloaded task according to a task sequence to which the to-be-offloaded task belongs, wherein the computing capability constraint is used to indicate a maximum computing resource consumed by executing the to-be-offloaded task, and the energy consumption constraint is used to indicate a maximum electric energy consumed by executing the to-be-offloaded task; determining an offloading mode corresponding to the to-be-offloaded task according to the computing capability constraint, and determining an execution device of an offloaded process of the to-be-offloaded task according to the offloading mode, the computing capability constraint and the energy consumption constraint, wherein the offloading mode includes: local offloading, cloud offloading and edge offloading, the local offloading is used to indicate that the offloaded process of the to-be-offloaded task is executed on a local device, the local device is an industrial device that sends the task offloading request, the cloud offloading is used to indicate that the offloaded process of the to-be-offloaded task is executed on a cloud server, the edge offloading is used to indicate that the offloaded process of the to-be-offloaded task is executed on an edge device, the edge device is a device located at an edge of a network architecture to which the to-be-offloaded task belongs, and the execution device includes: the local device, the cloud server and the edge device; determining an offloading path of the to-be-offloaded task according to the execution device, and transmitting the to-be-offloaded task to the execution device according to the offloading path, so as to offload the to-be-offloaded task.
[0006] Optionally, the generating at least one task sequence according to the plurality of to-be-offloaded tasks and the dependency relationship includes: determining each to-be-offloaded task as a node, and determining the dependency relationship as an edge, connecting the plurality of nodes with the dependency relationship in sequence according to the direction of the edge to generate a task graph, wherein the direction of the edge is determined by the execution order; determining the out-degree of each node, wherein the out-degree is used to indicate the number of first-type edges connected with the node, and the first-type edge is an edge with the current node as a starting point and another node different from the current node as a terminal point; for a first-type node with the out-degree of 0, determining each first-type node as a task sequence; for a second-type node with the out-degree not being 0, determining the in-degree of each second-type node, wherein the in-degree is used to indicate the data of second-type edges connected with the node, and the second-type edge is an edge with the current node as a terminal point and another node different from the current node as a starting point; generating a task sequence according to the second-type node, wherein the number of the task sequences generated according to the second-type node is the same as the out-degree of the second-type node, and the plurality of third-type nodes included in the task sequence generated according to the second-type node are nodes located on the same edge as the second-type node in the task graph.
[0007] Optionally, the computing capability constraint and the energy consumption constraint of the to-be-offloaded task are determined according to a task sequence to which the to-be-offloaded task belongs, wherein the computing capability constraint is determined by the following method: for each to-be-offloaded task, a plurality of target to-be-offloaded tasks belonging to the same task sequence as the to-be-offloaded task and having an execution sequence before the to-be-offloaded task are determined, and a computing resource requirement corresponding to each target to-be-offloaded task is obtained, wherein the computing resource requirement is a computing resource consumed by executing the target to-be-offloaded task; in the case that the to-be-offloaded task belongs to only one task sequence, a plurality of target to-be-offloaded tasks having an execution sequence before the to-be-offloaded task in the task sequence are determined, and the computing capability constraint of the to-be-offloaded task is determined according to a plurality of computing resource requirements corresponding to the plurality of target to-be-offloaded tasks; in the case that the to-be-offloaded task belongs to a plurality of different task sequences, the independent computing capability constraint of the to-be-offloaded task in each task sequence is determined according to the target to-be-offloaded tasks contained in each task sequence, respectively, and the maximum independent computing capability constraint in the plurality of independent computing capability constraints is determined as the computing capability constraint of the to-be-offloaded task.
[0008] Optionally, the computing capability constraint and the energy consumption constraint of the to-be-offloaded task are determined according to a task sequence to which the to-be-offloaded task belongs, wherein the energy consumption constraint is determined by the following method: a first energy consumption consumed by the to-be-offloaded task when being transmitted to each edge device is determined, and a second energy consumption consumed by each edge device when executing the to-be-offloaded task is determined; for each edge device, a sum of the first energy consumption and the second energy consumption is determined as a total energy consumption consumed by the edge device when executing the to-be-offloaded task in the offloading process; for each to-be-offloaded task, the maximum total energy consumption in a plurality of total energy consumptions corresponding to the to-be-offloaded task is determined as the energy consumption constraint of the to-be-offloaded task.
[0009] Optionally, the offloading mode corresponding to the to-be-offloaded task is determined according to the computing capability constraint, including: obtaining a first idle computing resource of the local device, and a second idle computing resource of each edge device, wherein the first idle computing resource is a computing resource not occupied by the local device, and the second idle computing resource is a computing resource not occupied by the edge device; for each to-be-offloaded task, a first comparison result is obtained by comparing the computing capability constraint with the first idle computing resource; in the case that the first comparison result indicates that the computing capability constraint is less than or equal to the first idle computing resource, it is determined that the offloading mode is local offloading; in the case that the first comparison result indicates that the computing capability constraint is greater than the first idle computing resource, a second comparison result is obtained by comparing the computing capability constraint with the second idle computing resource; in the case that the second comparison result indicates that the computing capability constraint is less than or equal to the second idle computing resource, it is determined that the offloading mode is edge offloading; in the case that the second comparison result indicates that the computing capability constraint is greater than the second idle computing resource, it is determined that the offloading mode is cloud offloading.
[0010] Optionally, the execution device of the offloading process of the to-be-offloaded task is determined according to the offloading mode, the computing capability constraint and the energy consumption constraint, comprising: in the case that the offloading mode of the to-be-offloaded task is local offloading, the execution device is determined as the local device; in the case that the offloading mode of the to-be-offloaded task is cloud offloading, the execution device is determined as any one of the cloud servers; for the target to-be-offloaded task of the edge offloading mode, a first resource tag of each target to-be-offloaded task is obtained, wherein the computing capability constraint and the energy consumption constraint of the target to-be-offloaded task are recorded in the first resource tag; and a second resource tag of each edge device is obtained, wherein the second idle computing resource of the edge device and the target energy consumption consumed by the edge device in executing the to-be-offloaded task are recorded in the second resource tag, and the second idle computing resource is the computing resource not occupied by the edge device; for each target to-be-offloaded task, the target resource tag is determined in the plurality of second resource tags according to the first resource tag, wherein the target resource tag is the second resource tag recording that the second idle computing resource is greater than the computing capability constraint in the first resource tag, and the target energy consumption is less than the energy consumption constraint; the edge device corresponding to the target resource tag is determined as the target edge device, and the execution device of the target to-be-offloaded task is determined in the target edge device, wherein the target edge device is the edge device meeting the offloading resource requirement of the to-be-offloaded task.
[0011] Optionally, the execution device of the target to-be-offloaded task is determined in the target edge device, comprising: in the case that there is only one target edge device, the target edge device is determined as the execution device; in the case that there are a plurality of target edge devices, the plurality of target edge devices are ranked in the order from more to less of the corresponding second idle computing resource to obtain the ranking result of each target edge device; the target edge device corresponding to the ranking result with the smallest value is determined as the execution device, and the remaining target edge devices are determined as the alternative execution devices, wherein the alternative execution devices are used as the execution devices of the to-be-offloaded task in the case of failure of the execution device.
[0012] Optionally, the offloading path of the to-be-offloaded task is determined according to the execution device, comprising: for each to-be-offloaded task, the network link of transmitting the to-be-offloaded task from the local device to the execution device is determined, wherein the local device, the execution device, the plurality of switches, the sequence of transmitting the to-be-offloaded task in the local device, the execution device and the plurality of switches are recorded in the network link; the transmission delay of each network link is determined, and the network link corresponding to the transmission delay with the smallest value is determined as the offloading path of the to-be-offloaded task.
[0013] According to a further aspect of the embodiments of the present application, a device for task offloading is also provided, comprising: a receiving module configured to receive a task offloading request, wherein the task offloading request records at least the following information: a plurality of to-be-offloaded tasks, and a dependency relationship of the plurality of to-be-offloaded tasks, the dependency relationship being used to indicate an execution order between the plurality of to-be-offloaded tasks, and the dependency relationship comprising: parallel execution and sequential execution; a generating module configured to generate at least one task sequence according to the plurality of to-be-offloaded tasks and the dependency relationship, wherein the task sequence is used to indicate an execution order of the plurality of to-be-offloaded tasks included in the offloading task sequence; a first determining module configured to, for each to-be-offloaded task, determine a computing capability constraint and an energy consumption constraint of the to-be-offloaded task according to a task sequence to which the to-be-offloaded task belongs, wherein the computing capability constraint is used to indicate a maximum computing resource consumed by executing the to-be-offloaded task, and the energy consumption constraint is used to indicate a maximum electric energy consumed by executing the to-be-offloaded task; a second determining module configured to determine an offloading manner corresponding to the to-be-offloaded task according to the computing capability constraint, and determine an execution device of an offloading process of the to-be-offloaded task according to the offloading manner, the computing capability constraint and the energy consumption constraint, wherein the offloading manner comprises: local offloading, cloud offloading and edge offloading, the local offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on a local device, the local device is an industrial device that sends the task offloading request, the cloud offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on a cloud server, the edge offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on an edge device, the edge device is a device located at an edge of a network architecture to which the to-be-offloaded task belongs, and the execution device comprises: the local device, the cloud server and the edge device; and an offloading module configured to determine an offloading path of the to-be-offloaded task according to the execution device, and transmit the to-be-offloaded task to the execution device according to the offloading path, so as to offload the to-be-offloaded task.
[0014] According to a further aspect of the embodiments of the present application, a non-transitory storage medium is also provided, and the non-transitory storage medium stores a computer program, wherein a device in which the non-transitory storage medium is located executes the method for task offloading by running the computer program.
[0015] According to a further aspect of the embodiments of the present application, an electronic device is also provided, comprising a memory and a processor, the memory stores a computer program, and the processor is configured to execute the method for task offloading by running the computer program.
[0016] According to a further aspect of the embodiments of the present application, a computer program product is also provided, comprising computer instructions, and the computer instructions are executed by a processor to implement the steps of the method for task offloading.
[0017] In the embodiment of the present application, a task offloading request is received, wherein the task offloading request records at least the following information: a plurality of to-be-offloaded tasks, a dependency relationship of the plurality of to-be-offloaded tasks, the dependency relationship is used to indicate the execution order between the plurality of to-be-offloaded tasks, and the dependency relationship includes: parallel execution and sequential execution; at least one task sequence is generated according to the plurality of to-be-offloaded tasks and the dependency relationship, wherein the task sequence is used to indicate the execution order of the plurality of to-be-offloaded tasks included in the offloading task sequence; for each to-be-offloaded task, the computing capability constraint and the energy consumption constraint of the to-be-offloaded task are determined according to the task sequence to which the to-be-offloaded task belongs, wherein the computing capability constraint is used to indicate the maximum computing resource consumed by executing the to-be-offloaded task, and the energy consumption constraint is used to indicate the maximum electric energy consumed by executing the to-be-offloaded task; the offloading manner corresponding to the to-be-offloaded task is determined according to the computing capability constraint, and the execution device of the offloading process of the to-be-offloaded task is determined according to the offloading manner, the computing capability constraint and the energy consumption constraint, wherein the offloading manner includes: local offloading, cloud offloading and edge offloading, the local offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on a local device, the local device is an industrial device that sends the task offloading request, the cloud offloading indicates that the offloading process of the to-be-offloaded task is executed by using a cloud server, the edge offloading indicates that the offloading process of the to-be-offloaded task is executed by using an edge device, the edge device is a device located at the edge of a network architecture to which the to-be-offloaded task belongs, and the execution device includes: the local device, the cloud server and the edge device; the offloading path of the to-be-offloaded task is determined according to the execution device, and the to-be-offloaded task is transmitted to the execution device according to the offloading path, so as to offload the to-be-offloaded task. In the task offloading scenario of the dependency type, the offloading node meeting the demand is selected according to the task request, the computing resource limitation, the device energy consumption limitation and the dependency relationship between tasks are considered as limiting factors, the offloading path of the task is determined by using a dynamic programming method, the device energy consumption is considered as a limiting factor when the task offloading is executed, thereby achieving the technical effects of comprehensively considering multiple limiting information, determining the optimal offloading node and reducing the task processing delay and transmission delay, and further solving the technical problem of poor quality of the selected offloading node and increased task processing delay caused by the fact that the method for performing task offloading in the related art cannot simultaneously consider the dependency relationship between tasks, the device energy consumption limitation and the computing resource limitation. BRIEF DESCRIPTION OF DRAWINGS
[0018] The accompanying drawings, which are included to provide a further understanding of the present application, constitute a part of the present application and illustrate the illustrative embodiments of the present application and their description serve to explain the present application, and do not constitute improper limitations on the present application. In the drawings:
[0019] Figure 1 is a hardware structure block diagram of a computer terminal for implementing a method for task offloading according to an embodiment of the present application;
[0020] Figure 2 is a step flow chart of a task offloading method according to an embodiment of the present application;
[0021] Figure 3 is a structural diagram of a task offloading device according to an embodiment of the present application;
[0022] Figure 4 is a working flow chart of a task offloading device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] In order to make the personnel in the art better understand the scheme of the present application, the technical scheme in the embodiments of the present application will be clearly and completely described below in combination with the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor should fall within the scope of protection of the present application.
[0024] It should be noted that the terms "first", "second", and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0025] In order to better understand the embodiments of the present application, the technical terms involved in the embodiments of the present application are explained as follows:
[0026] Software Defined Network (SDN): an implementation of network virtualization, the core idea of which is to separate the control layer and the data layer of network equipment, realize the centralized control and flexible programming of network, and provide a platform for the innovation of core network and application.
[0027] Out-degree: for a node in a directed graph, the out-degree is defined as the number of edges pointing to other nodes from the node as the starting point.
[0028] In-degree: indicates how many edges point to the node.
[0029] In the related art, when performing task offloading, only the task completion delay is considered, and the energy consumption of the device is not considered, so that the offloading node is determined with the minimum task completion delay as the target, and there may be a problem that the energy consumption limit of the offloading node cannot support it to perform task offloading. In addition, when performing task offloading, the traditional network cannot master the network state of the link in the system, and it is difficult to obtain resource parameters such as link bandwidth and delay, so when selecting an offloading node, a node with poor path transmission quality may be selected as the offloading node, resulting in the problem of high delay of transmitting data. In order to solve the above problems, the related solutions are provided in the embodiments of the present application, which will be described in detail below.
[0030] According to the embodiments of the present application, a method embodiment of task offloading is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0031] The method embodiment provided in the embodiments of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 A hardware structure block diagram of a computer terminal for implementing the method of task offloading is shown. As shown in Figure 1 , the computer terminal 10 can include one or more (in the figure, 102a, 102b, …, 102n are shown) processors 102 (the processor 102 can include but not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA), a memory 104 for storing data, and a transmission device 106 for communication function. In addition, it can also include a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which can be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. Those skilled in the art can understand that Figure 1 The structure shown is only schematic, which does not limit the structure of the above-mentioned electronic device. For example, the computer terminal 10 can also include more or less components than Figure 1 shown, or have a different configuration than Figure 1 shown.
[0032] It should be noted that the one or more processors 102 and / or other data processing circuitry described above can be referred to herein generally as "data processing circuitry." The data processing circuitry can be embodied in whole or in part as software, hardware, firmware, or any combination thereof. In addition, the data processing circuitry can be a single standalone processing module, or incorporated in whole or in part within any one of the other elements of the computer terminal 10. As referred to in the embodiments of the present application, the data processing circuitry functions as a processor to control, for example, the selection of the variable resistance terminal path connected to the interface.
[0033] The memory 104 can be used to store software programs of application software and modules, such as program instructions / data storage means corresponding to the task offloading method of the embodiments of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, i.e. implements the task offloading method described above. The memory 104 can include a high-speed random access memory, and can further include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 can further include a memory disposed remotely with respect to the processor 102, which can be connected to the computer terminal 10 through a network. Examples of the network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0034] The transmission device 106 is used to receive or send data via a network. Specific examples of the network can include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 can be a radio frequency (RF) module, which is used to communicate with the Internet in a wireless manner.
[0035] The display can be, for example, a touch screen type liquid crystal display (LCD), which can enable a user to interact with the user interface of the computer terminal 10.
[0036] The embodiments of the present application provide a task offloading method that can be run in the operating environment described above, Figure 2 is a step flow chart of the task offloading method provided by the embodiments of the present application, as Figure 2 shown, the method includes the following steps:
[0037] Step S202, receiving a task offloading request, wherein the task offloading request at least records the following information: a plurality of to-be-offloaded tasks, a dependency relationship among the plurality of to-be-offloaded tasks, the dependency relationship being used to indicate an execution order among the plurality of to-be-offloaded tasks, and the dependency relationship including: parallel execution and sequential execution.
[0038] The method provided by the embodiments of the present application can be applied in a dependent task scenario to plan an optimal offloading node (representing a device for executing an offloading process) and offloading path for a dependent task. Specifically, the dependent task scenario can be an industrial edge computing system based on a dependent task, and the industrial edge computing system includes industrial devices (denoted as Device), edge nodes (representing edge devices, denoted as Edge), SDN switches (denoted as SW), and an SDN controller (denoted as Controller). In the connection relationship among the above devices / hardware / modules, the industrial devices are connected to the edge nodes, the edge nodes are connected to the SDN switches, and the SDN switches are connected to the SDN controller. Each link has its own delay value. The SDN controller can control the global view of the network. The edge nodes are used to process the computing tasks of the industrial devices, and each edge node has its own computing capability value. When the method provided by the embodiments of the present application is applied to execute task offloading in the above dependent task scenario, the process of task offloading is triggered by the received task offloading request. For example, in the above industrial edge computing system, the SDN controller executes step S202, and the SDN controller receives a task offloading request from the industrial devices (denoted as Device) through a receiving module, wherein the task offloading request includes a task list (composed of a plurality of to-be-offloaded tasks) to be offloaded and a dependency relationship among the to-be-offloaded tasks. Generally, the dependency relationship among the tasks includes parallel execution and sequential execution. The dependency relationship among the to-be-offloaded tasks is used to indicate the execution order of the to-be-offloaded tasks when they are executed or offloaded.
[0039] Step S204, generating at least one task sequence according to the plurality of to-be-offloaded tasks and the dependency relationship, wherein the task sequence is used to indicate the execution order of the plurality of to-be-offloaded tasks included in the offloading task sequence.
[0040] In step S204, the offloading sequence (i.e., the task sequence) corresponding to each to-be-offloaded task is generated according to the to-be-offloaded tasks and the dependency relationship among the to-be-offloaded tasks recorded in the task offloading request received in step S202. The offloading sequence (i.e., the task sequence) corresponding to each to-be-offloaded task is generated by arranging the plurality of to-be-offloaded tasks having a dependency relationship with the to-be-offloaded task in sequence according to the execution order of the to-be-offloaded tasks. Through the offloading sequence (i.e., the task sequence) corresponding to each to-be-offloaded task, the plurality of to-be-offloaded tasks having a dependency relationship with the to-be-offloaded task and the execution order of the to-be-offloaded task in the actual execution process can be determined.
[0041] Optionally, the at least one task sequence is generated according to the plurality of tasks to be offloaded and the dependency relationship, including: determining each task to be offloaded as a node, and determining the dependency relationship as an edge, connecting the plurality of nodes with the dependency relationship in sequence according to the direction of the edge to generate a task graph, wherein the direction of the edge is determined by the execution order; determining the out-degree of each node, wherein the out-degree is used to indicate the number of first-type edges connected to the node, and the first-type edge is an edge with the current node as the starting point and another node different from the current node as the ending point; for a first-type node with the out-degree of 0, determining each first-type node as a task sequence; for a second-type node with the out-degree not being 0, determining the in-degree of each second-type node, wherein the in-degree is used to indicate the data of second-type edges connected to the node, and the second-type edge is an edge with the current node as the ending point and another node different from the current node as the starting point; and generating a task sequence according to the second-type node, wherein the number of the task sequences generated according to the second-type node is the same as the out-degree of the second-type node, and the plurality of third-type nodes contained in the task sequences generated according to the second-type node are nodes located on the same edge as the second-type node in the task graph.
[0042] In this embodiment, the task sequence corresponding to the task to be offloaded is generated according to the task to be offloaded and the dependency relationship of the task to be offloaded, which can be implemented by generating a directed acyclic graph (i.e., a task graph) DAG. The SDN controller maps each task to be offloaded as a node in the task graph, and maps the dependency relationship as a directed edge between the nodes. The direction of the directed edge represents the execution order of the tasks to be offloaded represented by the two nodes connected by the edge, wherein the node pointed by the arrow represents the task to be offloaded that is executed later among the two tasks to be offloaded. When constructing the task graph DAG, first, the out-degree of the node is determined: for each node in the DAG, the out-degree is calculated, i.e., the number of edges (i.e., first-type edges) pointing to other nodes from the node as the starting point. After the DAG graph is constructed, the task sequence is generated by traversing the DAG graph: first, all nodes with the out-degree of 0 (i.e., first-type nodes) are added to the task sequence, because the out-degree of 0 indicates that the node is used as a task sequence alone. Then, for each node with the out-degree not being 0 (i.e., a second-type node), the in-degree is calculated, i.e., the number of edges (i.e., second-type edges) pointing to the node. If the in-degree of the node is 0, the node can be added to the current task sequence; otherwise, the in-degree calculation is repeated until all nodes are added to a sequence, and the predecessor nodes of the node are completed. In the process of repeating the in-degree calculation, the nodes in the DAG located on the same edge as the node with the out-degree not being 0 (i.e., a second-type node) are added to the task sequence corresponding to the node with the out-degree not being 0 (i.e., a second-type node). For example, if a task in the DAG has no predecessor task, it will be executed first; if there are multiple tasks with no predecessor task, they can be executed in parallel.
[0043] In step S206, for each to-be-offloaded task, the computing capability constraint and the energy consumption constraint of the to-be-offloaded task are determined according to the task sequence to which the to-be-offloaded task belongs, wherein the computing capability constraint is used to indicate the maximum computing resource consumed by executing the to-be-offloaded task, and the energy consumption constraint is used to indicate the maximum electric energy consumed by executing the to-be-offloaded task.
[0044] Since there is a parallel execution and sequential execution dependency relationship between multiple to-be-offloaded tasks, if there is a parallel execution relationship between a to-be-offloaded task and other to-be-offloaded tasks, multiple different task sequences can be generated for the to-be-offloaded task in step S204. In step S206, the computing resource and energy consumption resource (for example, the electric energy consumed by the device executing the offloading process) consumed by each to-be-offloaded task when the to-be-offloaded task is offloaded are determined according to the task sequence in which the to-be-offloaded task is located. The reason why the task sequence needs to be considered is that when there is a dependency relationship between a to-be-offloaded task and other tasks, the to-be-offloaded task may need to be offloaded after the tasks that have a dependency relationship with the to-be-offloaded task and whose execution sequence is in front of the to-be-offloaded task are offloaded, and after the to-be-offloaded task is offloaded, the tasks that have a dependency relationship with the to-be-offloaded task but whose execution sequence is behind the to-be-offloaded task also need to be offloaded. Therefore, the computing resource and energy consumption resource consumed by each to-be-offloaded task when the to-be-offloaded task is offloaded are affected by other tasks that have a dependency relationship with the to-be-offloaded task. In this embodiment, when a to-be-offloaded task belongs to multiple task sequences, the maximum computing resource and maximum energy consumption resource consumed by executing the to-be-offloaded task are determined through the multiple task sequences, and the maximum computing resource and maximum energy consumption resource are used as constraint conditions (computing capability constraint and energy consumption constraint) for screening the device executing the offloading process of the to-be-offloaded task.
[0045] According to some optional embodiments of the present application, the computing capability constraint and the energy consumption constraint of the to-be-offloaded task are determined according to the task sequence to which the to-be-offloaded task belongs. The computing capability constraint is determined by the following method: for each to-be-offloaded task, multiple target to-be-offloaded tasks that belong to the same task sequence as the to-be-offloaded task and whose execution sequence is in front of the to-be-offloaded task are determined, and the computing resource demand corresponding to each target to-be-offloaded task is obtained, wherein the computing resource demand is the computing resource consumed by executing the target to-be-offloaded task. In the case where the to-be-offloaded task belongs to only one task sequence, multiple target to-be-offloaded tasks whose execution sequence is in front of the to-be-offloaded task in the task sequence are determined, and the computing capability constraint of the to-be-offloaded task is determined according to the multiple computing resource demands corresponding to the multiple target to-be-offloaded tasks. In the case where the to-be-offloaded task belongs to multiple different task sequences, the independent computing capability constraint of the to-be-offloaded task in each task sequence is determined according to the target to-be-offloaded tasks contained in each task sequence, and the maximum independent computing capability constraint in the multiple independent computing capability constraints is determined as the computing capability constraint of the to-be-offloaded task.
[0046] In some embodiments, the computing capability constraint (CP) and the energy consumption constraint (E) of each to-be-offloaded task are determined. This process can be accomplished by evaluating the computing intensity and energy consumption demand of the task, i.e., estimating the demand of the task for computing resources and the energy consumption during execution according to the complexity and data transmission amount of the task. For example, for a to-be-offloaded task (ti), when its out-degree is 0, i.e., the corresponding task sequence of the to-be-offloaded task (ti) only contains the to-be-offloaded task (ti) one, the computing capability constraint CP(ti) of the to-be-offloaded task (ti) is defined according to the processor memory, the demand for central processing unit (CPU) or the synthetic performance index of the to-be-offloaded task (ti). When the out-degree of the to-be-offloaded task (ti) is not 0, i.e., the corresponding task sequence of the to-be-offloaded task (ti) contains multiple to-be-offloaded tasks that have a dependency relationship with the to-be-offloaded task (ti) in addition to the to-be-offloaded task (ti), the computing capability constraint CP(ti) of the to-be-offloaded task (ti) is determined according to the demand of the to-be-offloaded task (ti) and the multiple to-be-offloaded tasks that have a dependency relationship with the to-be-offloaded task (ti) for the following resources: processor memory, demand for central processing unit (CPU), and synthetic performance index. When the to-be-offloaded task (ti) and other to-be-offloaded tasks have a parallel execution dependency relationship, the to-be-offloaded task (ti) can belong to multiple different task sequences. In this case, a corresponding computing capability constraint CP(ti) of the to-be-offloaded task (ti) is determined for each task sequence. Since the demand of the multiple to-be-offloaded tasks that have an execution sequence before the to-be-offloaded task (ti) in each task sequence (i.e., target to-be-offloaded tasks) for computing resources is different, the computing capability constraint CP(ti) of the to-be-offloaded task (ti) determined according to each task sequence is also different. In this embodiment, in the case where the to-be-offloaded task (ti) belongs to multiple task sequences, the maximum value of the multiple computing capability constraints CP(ti) of the to-be-offloaded task (ti) determined according to the multiple task sequences is determined as the corresponding computing capability constraint of the to-be-offloaded task (ti).
[0047] According to some optional embodiments of the present application, the computing capability constraint and the energy consumption constraint of the to-be-offloaded task are determined according to the task sequence to which the to-be-offloaded task belongs. The energy consumption constraint is determined by the following method: determining the first energy consumption consumed by the to-be-offloaded task when transmitted to each edge device, and determining the second energy consumption consumed by each edge device when executing the to-be-offloaded task; for each edge device, the sum of the first energy consumption and the second energy consumption is determined as the total energy consumption consumed by the edge device when executing the offloading process of the to-be-offloaded task; for each to-be-offloaded task, the maximum value of the multiple total energy consumptions corresponding to the to-be-offloaded task is determined as the energy consumption constraint of the to-be-offloaded task.
[0048] In some embodiments, the energy consumption constraint E(ti) of the task to be offloaded (ti) is determined based on the energy consumed by the device performing the offloading process of the task to be offloaded (ti) (i.e. the performing device, such as the local device, the edge node, the cloud server, etc.). In the embodiments of the present application, the energy consumption constraint E(ti) of the task to be offloaded (ti) is determined based on the transmission energy consumed when the task to be offloaded (ti) is transmitted to its corresponding performing device (i.e. the first energy consumption) and the energy consumed when the corresponding performing device performs the task to be offloaded (ti) (i.e. the second energy consumption). When there is a parallel execution dependency relationship between the task to be offloaded (ti) and other tasks to be offloaded, the task to be offloaded (ti) can belong to multiple different task sequences. In this case, the total energy consumption consumed by the offloading of the task to be offloaded (ti) can be determined according to the execution order of the task to be offloaded (ti) in different task sequences and the dependent other tasks, and the maximum total energy consumption among the multiple total energy consumptions corresponding to the task to be offloaded (ti) is determined as the energy consumption constraint E(ti) of the task to be offloaded (ti). For example, the determination of the energy consumption constraint E(ti) of the task to be offloaded (ti) can be represented by the following process: determining the first part of the total energy consumption, i.e. the energy consumed when the task to be offloaded (ti) is transmitted to the edge device n, denoted as D trans (ti,n); determining the second part of the total energy consumption, i.e. the energy consumed when the task to be offloaded (ti) is executed on the edge device n, denoted as E exec (ti,n). The total energy consumption Z tot (ti,n) of the task to be offloaded (ti) is composed of the transmission energy (i.e. the first energy consumption) D trans (ti,n) and the execution energy E exec (ti,n), i.e. Z tot (ti,n) = D trans (ti,n) + E exec (ti,n). When determining the energy consumption constraint E(ti), the SDN controller will traverse all edge devices n, calculate the total energy consumption Z tot (ti,n) of each device when executing the task to be offloaded (ti), and determine the maximum value among these total energy consumption values as the energy consumption constraint E(ti) of the task to be offloaded (ti). In other embodiments, the energy consumption constraint E(ti) can also be determined by the following formula: wherein ζ n is the energy consumed by the edge node n when running a single CPU cycle, V i is the data volume required for processing the task ti, C i is the complexity of processing the task ti, represents the energy consumed by the offloading node (i.e. the device performing the offloading process) n per unit time when transmitting the data of the task to be offloaded (ti), C i is a preset value determined based on the amount of computing resources required for executing the task (ti), such as memory, etc.
[0049] Step S208, determining the offloading mode corresponding to the to-be-offloaded task according to the computing capability constraint, and determining the execution device of the offloading process of executing the to-be-offloaded task according to the offloading mode, the computing capability constraint and the energy consumption constraint, wherein the offloading mode includes local offloading, cloud offloading and edge offloading, the local offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on the local device, the local device is the industrial device that sends the task offloading request, the cloud offloading indicates that the offloading process of the to-be-offloaded task is executed on the cloud server, the edge offloading indicates that the offloading process of the to-be-offloaded task is executed on the edge device, the edge device is a device located at the edge of the network architecture to which the to-be-offloaded task belongs, and the execution device includes the local device, the cloud server and the edge device.
[0050] In step S208, the most suitable offloading mode is determined according to the constraint conditions (the computing capability constraint and the energy consumption constraint) determined for each to-be-offloaded task in step S206; in the embodiments of the present application, three offloading modes, i.e., the local offloading, the cloud offloading and the edge offloading, are provided, and each offloading mode is executed by a corresponding execution device, wherein the local offloading is executed by the industrial device (i.e., the local device) that sends the task offloading request, the cloud offloading is executed by the cloud server, and the edge offloading is executed by the device (i.e., the edge device) located at the edge of the network architecture (such as the SDN network) to which the to-be-offloaded task belongs.
[0051] Optionally, determining the offloading mode corresponding to the to-be-offloaded task according to the computing capability constraint includes: obtaining a first idle computing resource of the local device, and a second idle computing resource of each edge device, wherein the first idle computing resource is a computing resource that is not occupied by the local device, and the second idle computing resource is a computing resource that is not occupied by the edge device; for each to-be-offloaded task, comparing the computing capability constraint with the first idle computing resource to obtain a first comparison result; in a case where the first comparison result indicates that the computing capability constraint is less than or equal to the first idle computing resource, determining that the offloading mode is the local offloading; in a case where the first comparison result indicates that the computing capability constraint is greater than the first idle computing resource, comparing the computing capability constraint with the second idle computing resource to obtain a second comparison result; in a case where the second comparison result indicates that the computing capability constraint is less than or equal to the second idle computing resource, determining that the offloading mode is the edge offloading; and in a case where the second comparison result indicates that the computing capability constraint is greater than the second idle computing resource, determining that the offloading mode is the cloud offloading.
[0052] In the method provided in the embodiments of the present application, after the energy consumption constraint E(ti) and the computing power constraint CP(ti) of the task to be offloaded ti are determined, the most suitable offloading mode (local offloading or cloud offloading or edge offloading) is determined according to the computing power constraint CP(ti) and the energy consumption constraint E(ti) of the task. In the embodiments, which offloading mode to be used is determined by comparing the computing power of the device (i.e., the offloading device) executing the offloading process and the demand of the task to be offloaded ti for computing power. In the embodiments, when determining the offloading mode, the executing device (the local device, the cloud server or the edge device) implementing the offloading mode should satisfy the following conditions: wherein, E n (t i ) is the total energy consumption of the executing device n executing the offloading process of the task to be offloaded ti, CP n (t i ) is the idle resource (the first idle computing resource, the second idle computing resource) that the executing device n can provide for executing the offloading process of the task to be offloaded ti. In specific implementation, the computing power constraint CP(ti) of the task to be offloaded ti is compared with the (first) idle computing resource CP local of the local device, and CP(ti) is compared with the (second) idle computing resource CP edge of the edge device. If CP(ti) is less than or equal to the (first) idle computing resource CP local of the local device, local offloading is selected. If CP(ti) is greater than CP local of the local device and at the same time less than or equal to the (second) idle computing resource CP edge of the edge device, edge offloading is selected. If CP(ti) is greater than the (second) idle computing resource CP edge of all edge devices, cloud offloading is selected. For example, if the computing power constraint CP(ti) of a task exceeds the computing power (i.e., the second idle computing resource) that all edge nodes can provide for the offloading process, cloud offloading is selected to ensure that the task can be successfully executed. If edge offloading is selected, the SDN controller will also select the best edge device as the executing device of the offloading process based on the computing power, energy consumption characteristics and network status of the edge devices. For example, the idle computing resources CP edgeand energy consumption characteristics, the edge device that can meet the task requirements and has the lowest energy consumption is selected as the execution device. For example, the CP value of the task is compared with the idle computing resource CPlocalof the local device, and with the idle computing resource CPedgeof the edge device. The offloading mode is determined: if the CP value of the task is less than or equal to the CPlocalof the local device, local offloading is selected; if the CP value is less than or equal to the CPedgeof the edge device, edge offloading is selected; and if the CP value is greater than the CP value of all edge devices, cloud offloading is selected.
[0053] According to some optional embodiments of the present application, the execution device of the offloading process of the to-be-offloaded task is determined according to the offloading mode, the computing capability constraint and the energy consumption constraint, including: in the case that the offloading mode of the to-be-offloaded task is local offloading, the execution device is determined to be the local device; in the case that the offloading mode of the to-be-offloaded task is cloud offloading, the execution device is determined to be any one of the cloud servers; for the target to-be-offloaded task with the edge offloading mode, a first resource tag of each target to-be-offloaded task is obtained, wherein the computing capability constraint and the energy consumption constraint of the target to-be-offloaded task are recorded in the first resource tag; and a second resource tag of each edge device is obtained, wherein the second idle computing resource of the edge device and the target energy consumption consumed by the edge device in executing the to-be-offloaded task are recorded in the second resource tag, and the second idle computing resource is the computing resource not occupied by the edge device; for each target to-be-offloaded task, a target resource tag is determined in the plurality of second resource tags according to the first resource tag, wherein the target resource tag is the second resource tag recording the second idle computing resource greater than the computing capability constraint in the first resource tag, and recording the target energy consumption less than the energy consumption constraint; the edge device corresponding to the target resource tag is determined as the target edge device, and the execution device of the target to-be-offloaded task is determined in the target edge device, wherein the target edge device is the edge device meeting the offloading resource requirement of the to-be-offloaded task.
[0054] After the offloading mode is determined according to the method in the last embodiment, further, the device (i.e., the execution device) executing the offloading process of the to-be-offloaded task (ti) is determined according to the determined offloading mode, the computing capability constraint CP(ti) and the energy consumption constraint E(ti) of the to-be-offloaded task. Specifically, in this embodiment, if the offloading mode is local offloading, the industrial device sending the offloading request (i.e., the local device) is used as the execution device executing the offloading process; if the offloading mode is cloud offloading, the cloud server is used as the execution device executing the offloading process. If the offloading mode is edge offloading, the edge device executing the offloading process of the to-be-offloaded task (ti) is determined from the plurality of edge devices according to the computing resource that can be provided by the edge device and the energy consumption consumed in executing the offloading process. Specifically, the edge device executing the offloading process of the to-be-offloaded task (ti) is selected from the plurality of edge devices by executing the following flow,
[0055] For a task to be unloaded using the edge offloading method (i.e., the target task to be unloaded), the computational resource constraint CP(ti) of the target task to be unloaded (ti) is compared with the (second) idle computational resource CP of the edge device n. edge Compare (n) and pair the energy consumption constraint E(ti) of the target unloaded task (ti) with the energy consumption (i.e., the target energy consumption) E of the edge device n when executing the unloaded task. exec Comparing (ti,n), the edge device that meets the following conditions is selected as the edge device to perform edge offloading (i.e., the target edge device): In this embodiment, the attribute information of the edge device (second idle computing resource CP) edge (n) Energy consumption E generated during the execution of the unloading task exec (ti,n) is obtained through SDN and can be recorded as a tag (i.e., the second resource tag). The constraints of the task to be unloaded (computing capacity constraints and energy consumption constraints) can also be recorded as a tag (i.e., the first resource tag). In addition, in this embodiment, if there are multiple edge devices that meet the conditions, the (second) idle computing resource CP is selected. edge (n) The maximum energy consumption E generated exec The device with the smallest (ti,n) is selected; if both of the above conditions cannot be met simultaneously, the (second) idle computing resource CP is selected first. edge (n) The largest edge device.
[0056] Optionally, determining the execution device for the target task to be unloaded among the target edge devices includes: if there is only one target edge device, determining the target edge device as the execution device; if there are multiple target edge devices, ranking the multiple target edge devices in descending order of their corresponding second idle computing resources to obtain a ranking result for each target edge device; determining the target edge device corresponding to the ranking result with the smallest value as the execution device, and determining the remaining target edge devices as alternative execution devices, wherein the alternative execution devices are used as the execution devices for the task to be unloaded in the event of a failure of the execution device.
[0057] As mentioned in the above embodiments, when the unloading method is edge unloading, there may be multiple edge devices that meet the conditions to be executed devices. Therefore, the unloading method is edge unloading, and the method for determining the executed device is as follows: If only a single edge device meets the task requirements, it is directly determined as the executed device. Ranking of multiple executed devices: If multiple edge devices meet the conditions... According to the CP of each device edge (n) Rank the results and select the CP. edge(n) the largest device as the execution device, and other devices as alternatives. Then, when the task to be offloaded (ti) is marked to be executed on the preferred offloading node, the parallel tasks that have dependencies with it for parallel execution will be offloaded to other alternative offloading nodes (i.e. alternative execution devices) according to the computing power (CP) requirements of the parallel tasks, and the idle computing resources CP edge (n) of the offloading nodes, respectively.
[0058] Step S210, determining the offloading path of the task to be offloaded according to the execution device, and transmitting the task to be offloaded to the execution device according to the offloading path to offload the task to be offloaded.
[0059] Finally, when the offloading manner of the task to be offloaded is determined according to the above steps, and the device (i.e. the execution device) executing the offloading manner is determined, in step S208, the offloading path followed when offloading the task to be offloaded according to the device (i.e. the execution device) executing the offloading manner of the task to be offloaded is determined.
[0060] Optionally, determining the offloading path of the task to be offloaded according to the execution device comprises: for each task to be offloaded, determining a network link for transmitting the task to be offloaded from the local device to the execution device, wherein the network link records the local device, the execution device, a plurality of switches, and the order of transmission of the task to be offloaded in the local device, the execution device and the plurality of switches; determining the transmission delay of each network link, and determining the network link corresponding to the smallest transmission delay as the offloading path of the task to be offloaded.
[0061] In the embodiments of the present application, the shortest path algorithm (Dijkstra algorithm) is used to determine the optimal offloading path. When determining the offloading path, the dynamic programming method is used, and the time delay in the transmission process of the to-be-offloaded task (ti) is considered as a factor to determine the offloading path. Specifically, for the to-be-offloaded task (ti), the network link from the local device (i.e., the industrial device that sends the offloading request) where the to-be-offloaded task (ti) is located to the execution device (e.g., edge device n) that executes the offloading process of the to-be-offloaded task (ti) is determined, wherein the network link includes the starting point (i.e., the local device), the end point (i.e., the execution device), and the SDN switch that the to-be-offloaded task (ti) passes through in the transmission process. In the network link, the above-mentioned devices are recorded in the order in which the to-be-offloaded task (ti) passes through them. Next, the shortest path algorithm (Dijkstra algorithm) is used to calculate the transmission time delay of all possible network links, and the link with the minimum time delay is selected as the offloading path. For example, if the to-be-offloaded task (ti) needs to be executed on the edge device n, the offloading module will calculate the shortest path from the local device to n and ensure that the delay of this path is the minimum. The above-mentioned dynamic programming offloading path method can be described as the following process: step 1, in the DAG, the attributes of each execution device include the earliest start time (EST) and the latest finish time (LFT). The EST refers to the earliest time at which the task can start execution under the condition of meeting the limit condition, and the LFT refers to the latest time at which the task can be completed without delaying the task progress; step 2, first, assign an initial value to each task node. For the node with an in-degree of 0, i.e., the EST of the start node is assigned as 0. For the node with an out-degree of 0, i.e., the LFT of the end node is assigned as the longest path length; step 3, according to each to-be-offloaded task ti in the task sequence, for each task node ti, the earliest start time EST(ti) of ti is determined by the following formula: EST(ti) = max(EST(tk))+weight(tk,ti), wherein tk and ti belong to the same task sequence and the execution order of tk is before that of ti, and weight(tk,ti) is the time length of the transmission of task tk to task ti; step 4, the latest finish time LFT(ti) of task ti is determined according to the formula LFT(ti) = min(LFT(ti))-weight(ti,tj), wherein tj is a task in the same task sequence as ti and the execution order of tj is after that of ti. Based on the above information, the offloading path (i.e., the critical path) is determined, which is one of the multiple task sequences to which the to-be-offloaded task belongs; wherein the task execution time is determined according to the scheduling result in the tag scheduling. The task execution time is calculated according to the following formula: wherein Z ithe number of CPU cycles required to process task ti, f loc is the data processing frequency of the local node. If it is marked to be executed on the offload node (i.e., the offload process is executed by the edge device), the task execution time is calculated according to the following formula: where f n is the data processing frequency of the edge device n. Finally, the offload process of each task to be offloaded on the offload path is executed in turn according to the scheduling scheme specified by the offload path. For tasks with parallel execution dependencies, the tasks at the same level in the task sequence are determined. One of the tasks must be on the offload path. If the task on the offload path is marked to be executed on the local node, the other parallel tasks are scheduled to the offload nodes including the preferred offload node and the alternative offload node in order from small to large according to the computing resource constraint (CP) requirements of each parallel task and the size of the idle computing resources of the offload node (the device executing the offload process, i.e., the execution device). If it is marked to be executed on the preferred offload node, the other parallel tasks are offloaded to other alternative offload nodes according to the CP value requirements of the parallel tasks and the CP value size of the offload node.
[0062] Through the above steps, the state of the network resources and computing resources of the device can be obtained in combination with the SDN technology. When determining the offload node (i.e., the execution device executing the offload process), the computing resources and energy consumption are considered comprehensively, the actual application environment is considered, and it is ensured that the determined offload node (i.e., the execution device executing the offload process) is executable. In addition, the offload path is determined in combination with the dynamic programming method, which reduces the task processing delay and transmission delay.
[0063] Figure 3 is a structural diagram of a task offloading device provided by an embodiment of the present application, as shown in Figure 3As shown, the device comprises: a receiving module 30, configured to receive a task offloading request, wherein the task offloading request at least records the following information: a plurality of to-be-offloaded tasks, a dependency relationship of the plurality of to-be-offloaded tasks, the dependency relationship being used to indicate an execution order between the plurality of to-be-offloaded tasks, and the dependency relationship comprising: parallel execution and sequential execution; a generating module 32, configured to generate at least one task sequence according to the plurality of to-be-offloaded tasks and the dependency relationship, wherein the task sequence is used to indicate an execution order of the plurality of to-be-offloaded tasks included in the offloaded task sequence; a first determining module 34, configured to, for each to-be-offloaded task, determine a computing capability constraint and an energy consumption constraint of the to-be-offloaded task according to a task sequence to which the to-be-offloaded task belongs, wherein the computing capability constraint is used to indicate a maximum computing resource consumed by executing the to-be-offloaded task, and the energy consumption constraint is used to indicate a maximum electric energy consumed by executing the to-be-offloaded task; a second determining module 36, configured to determine an offloading manner corresponding to the to-be-offloaded task according to the computing capability constraint, and determine an execution device of an offloading process of the to-be-offloaded task according to the offloading manner, the computing capability constraint and the energy consumption constraint, wherein the offloading manner comprises: local offloading, cloud offloading and edge offloading, the local offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on a local device, the local device is an industrial device that sends the task offloading request, the cloud offloading is used to indicate that the offloading process of the to-be-offloaded task is executed by using a cloud server, the edge offloading is used to indicate that the offloading process of the to-be-offloaded task is executed by using an edge device, the edge device is a device located at an edge of a network architecture to which the to-be-offloaded task belongs, and the execution device comprises: the local device, the cloud server and the edge device; and an offloading module 38, configured to determine an offloading path of the to-be-offloaded task according to the execution device, and transmit the to-be-offloaded task to the execution device according to the offloading path, so as to offload the to-be-offloaded task.
[0064] It should be noted that, Figure 3 The preferred embodiments of the embodiments shown can be seen with reference to Figure 2 The related description of the embodiments shown will not be repeated here.
[0065] Figure 4 is a workflow diagram of the task offloading device, as Figure 4As shown, the task offloading device executes the method provided by the embodiments of the present application, and receives the offloading request from the industrial device (Device) through the receiving module 30. The request contains the task list to be offloaded and the dependency relationship between tasks, which can be represented in the form of a directed acyclic graph (DAG), ensuring the feasibility of the order and parallel execution of tasks. For example, if the computational resource requirement (CP) of a task is greater than the computing capacity of the local device, the request will contain detailed information of the task, as well as the identification (ID) of any predecessor or successor task, in order to perform subsequent sorting and resource allocation. After receiving the offloading request by the receiving module 30, the task information (multiple tasks to be offloaded and their dependency relationships) recorded therein is transmitted to the generating module 32. The generating module 32 generates at least one task sequence by arranging multiple tasks to be offloaded according to the dependency relationship in the form of a directed acyclic graph (i.e., a task graph). The generating module 30 first identifies the nodes with an in-degree of 0 in the DAG and uses these nodes as the starting point of task execution to construct the task sequence. Then, the directed edges of the completed tasks are continuously removed until all nodes in the DAG are added to the sequence. For example, if a task in the DAG has no predecessor task, it will be executed first; if there are multiple tasks with no predecessor task, they can be executed in parallel. The generating module 32 transmits the task sequence generated by it to the first determining module 34, and the first determining module 34 determines the computational capacity constraint (CP) and energy consumption constraint (E) for each task according to the task sequence provided by the generating module 32. This process can be completed by evaluating the computational intensity and energy consumption requirement of the task, i.e., estimating its demand for computational resources and energy consumption during execution according to the complexity and data transmission volume of the task. For example, for a task ti, its CP value can be defined according to the processor memory, CPU demand, or synthetic performance indicator of the task; and E is determined based on the execution time of the task on different devices (local device, edge node, cloud server), transmission time, and energy consumption characteristics of the device. The second determining module 36 determines the most appropriate offloading mode (local offloading, cloud offloading, edge offloading) corresponding to the execution device (local device, cloud server, edge device) according to the computational capacity constraint and energy consumption constraint of the task to be offloaded output by the first determining module 34. For example, if the computational capacity constraint (CP) of a task exceeds the computing capacity range of all edge nodes (i.e., edge devices), the second determining module 36 will choose cloud offloading to ensure that the task can be successfully executed. After determining the offloading mode, the SDN controller will select the best execution device based on the computing capacity, energy consumption characteristics, and network status of the device. For example, by comparing the idle computing resources and energy consumption characteristics of each edge device, the edge device that can meet the task requirements and has the lowest energy consumption is selected as the execution device.Finally, the execution device executing the offloading process determined by the second determining module, the computing resource constraint and the energy consumption constraint of the task to be offloaded are used by the offloading module 38 to plan the offloading path, and the task is transmitted to the execution device through the SDN network. The planning of the offloading path uses the shortest path planning algorithm (i.e., Dijkstra algorithm) to ensure that the path delay is minimized. For example, when the task ti needs to be executed on the edge device n, the SDN controller calculates the shortest path from the local device to the edge device n, then generates the corresponding forwarding table and issues it to the SDN switch (SW) in the network, ensuring that the data packet can be transmitted along the planned path. Once the path is determined, the offloading module 38 will notify the device where the task to be offloaded is located (i.e., the local device) to send the task data packet to the execution device executing the offloading process.
[0066] The embodiments of the present application also provide a non-volatile storage medium, and the non-volatile storage medium stores a computer program, wherein the device where the non-volatile storage medium is located executes the above task offloading method by running the computer program.
[0067] The non-volatile storage medium is used for storing a program for performing the following functions: receiving a task offloading request, wherein the task offloading request at least records the following information: a plurality of tasks to be offloaded, a dependency relationship of the plurality of tasks to be offloaded, the dependency relationship is used to indicate the execution order between the plurality of tasks to be offloaded, and the dependency relationship includes: parallel execution, sequential execution; generating at least one task sequence according to the plurality of tasks to be offloaded and the dependency relationship, wherein the task sequence is used to indicate the execution order of the plurality of tasks to be offloaded included in the offloading task sequence; for each task to be offloaded, determining the computing capability constraint and the energy consumption constraint of the task to be offloaded according to the task sequence to which the task to be offloaded belongs, wherein the computing capability constraint is used to indicate the maximum computing resource consumed by executing the task to be offloaded, and the energy consumption constraint is used to indicate the maximum electric energy consumed by executing the task to be offloaded; determining the offloading mode corresponding to the task to be offloaded according to the computing capability constraint, and determining the execution device of the offloading process of the task to be offloaded according to the offloading mode, the computing capability constraint and the energy consumption constraint, wherein the offloading mode includes: local offloading, cloud offloading and edge offloading, the local offloading is used to indicate that the offloading process of the task to be offloaded is executed on the local device, the local device is the industrial device that sends the task offloading request, the cloud offloading indicates that the offloading process of the task to be offloaded is executed on the cloud server, the edge offloading indicates that the offloading process of the task to be offloaded is executed on the edge device, the edge device is the device located at the edge of the network architecture to which the task to be offloaded belongs, and the execution device includes: the local device, the cloud server and the edge device; determining the offloading path of the task to be offloaded according to the execution device, and transmitting the task to be offloaded to the execution device according to the offloading path to offload the task to be offloaded.
[0068] The embodiment of the present application further provides an electronic device, comprising a memory and a processor, the memory stores a computer program, and the processor is configured to execute the method of task offloading by the computer program.
[0069] The processor in the electronic device is used to run a program for performing the following functions: receiving a task offloading request, wherein the task offloading request records at least the following information: a plurality of to-be-offloaded tasks, a dependency relationship of the plurality of to-be-offloaded tasks, the dependency relationship is used to indicate an execution order between the plurality of to-be-offloaded tasks, and the dependency relationship comprises parallel execution and sequential execution; generating at least one task sequence according to the plurality of to-be-offloaded tasks and the dependency relationship, wherein the task sequence is used to indicate an execution order of the plurality of to-be-offloaded tasks included in the offloading task sequence; for each to-be-offloaded task, determining a computing capability constraint and an energy consumption constraint of the to-be-offloaded task according to a task sequence to which the to-be-offloaded task belongs, wherein the computing capability constraint is used to indicate a maximum computing resource consumed by executing the to-be-offloaded task, and the energy consumption constraint is used to indicate a maximum electric energy consumed by executing the to-be-offloaded task; determining an offloading mode corresponding to the to-be-offloaded task according to the computing capability constraint, and determining an execution device of an offloading process of the to-be-offloaded task according to the offloading mode, the computing capability constraint and the energy consumption constraint, wherein the offloading mode comprises local offloading, cloud offloading and edge offloading, the local offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on a local device, the local device is an industrial device that sends the task offloading request, the cloud offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on a cloud server, the edge offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on an edge device, the edge device is a device located at an edge of a network architecture to which the to-be-offloaded task belongs, and the execution device comprises the local device, the cloud server and the edge device; determining an offloading path of the to-be-offloaded task according to the execution device, and transmitting the to-be-offloaded task to the execution device according to the offloading path to offload the to-be-offloaded task.
[0070] The embodiment of the present application further provides a computer program product, comprising computer instructions, which, when executed by a processor, implement the steps of the method of task offloading.
[0071] It should be noted that each module in the above task offloading device can be a program module (for example, a set of program instructions for implementing a certain specific function) or a hardware module, and for the latter, it can be in the following form, but is not limited to this: the form of each module is a processor, or the functions of each module are implemented by a processor.
[0072] The serial numbers of the above embodiments of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.
[0073] In the above-described embodiments of the present application, the description of each embodiment focuses on different aspects, and the parts not described in detail in a certain embodiment can be referred to the relevant description of other embodiments.
[0074] In several embodiments provided in the present application, it should be understood that the disclosed technical contents can be implemented by other ways. Among them, the above-described device embodiments are only schematic, for example, the division of the units can be a logical function division, and actual implementation can have another division way, for example, a plurality of units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units or modules shown or discussed can be indirect coupling or communication connection through some interfaces, units or modules, which can be electrical or other forms.
[0075] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, that is, they can be located in one place or distributed on multiple units. Part or all of the units can be selected to achieve the purpose of the embodiment scheme according to actual needs.
[0076] In addition, each functional unit in each embodiment of the present application can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The above integrated unit can be realized in the form of hardware or in the form of software functional unit.
[0077] The integrated unit, if realized in the form of software functional unit and sold or used as an independent product, can be stored in a computer readable storage medium. Based on such understanding, the technical solutions of the present application essentially or the parts that make contributions to the related art or the whole or part of the technical solutions can be embodied in the form of software product, which is stored in a storage medium and includes a plurality of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute all or part of the steps of the method described in each embodiment of the present application. The foregoing storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and various program code storage media.
[0078] The above is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, which should be regarded as the protection scope of the present application.
Claims
1. A method of task offloading, the method comprising: The method comprises the following steps: receiving a task offloading request, wherein the task offloading request records at least the following information: a plurality of to-be-offloaded tasks, a dependency relationship of the plurality of to-be-offloaded tasks, the dependency relationship being used to indicate an execution order between the plurality of to-be-offloaded tasks, and the dependency relationship comprising parallel execution and sequential execution; generating at least one task sequence according to the plurality of to-be-offloaded tasks and the dependency relationship, comprising: determining each of the to-be-offloaded tasks as a node, determining the dependency relationship as an edge, connecting the plurality of nodes with the dependency relationship in sequence according to the direction of the edge to generate a task graph, wherein the direction of the edge is determined by the execution order; determining the out-degree of each node, wherein the out-degree is used to indicate the number of first-type edges connected to the node, and the first-type edge is an edge with a current node as a starting point and another node different from the current node as a terminal point; for a first-type node with an out-degree of 0, determining each of the first-type nodes as the task sequence; for a second-type node with an out-degree not equal to 0, determining the in-degree of each of the second-type nodes, wherein the in-degree is used to indicate the data of second-type edges connected to the node, and the second-type edge is an edge with a current node as a terminal point and another node different from the current node as a starting point; generating the task sequence according to the second-type node, wherein the number of the task sequences generated according to the second-type node is the same as the out-degree of the second-type node, and a plurality of third-type nodes contained in the task sequence generated according to the second-type node are nodes located on the same edge as the second-type node in the task graph, wherein the task sequence is used to indicate the execution order when offloading the plurality of to-be-offloaded tasks contained in the task sequence; for each of the to-be-offloaded tasks, determining the computing capability constraint and the energy consumption constraint of the to-be-offloaded task according to the task sequence to which the to-be-offloaded task belongs, wherein the computing capability constraint is used to indicate the maximum computing resource consumed by executing the to-be-offloaded task, and the energy consumption constraint is used to indicate the maximum electric energy consumed by executing the to-be-offloaded task; determining the offloading mode corresponding to the to-be-offloaded task according to the computing capability constraint, and determining the execution device of the offloading process of the to-be-offloaded task according to the offloading mode, the computing capability constraint and the energy consumption constraint, wherein the offloading mode comprises local offloading, cloud offloading and edge offloading, the local offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on a local device, the local device is an industrial device that sends the task offloading request, the cloud offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on a cloud server, the edge offloading is used to indicate that the offloading process of the to-be-offloaded task is executed on an edge device, the edge device is a device located at the edge of a network architecture to which the to-be-offloaded task belongs, and the execution device comprises the local device, the cloud server and the edge device. According to the execution device, determine an offloading path of the to-be-offloaded task, and transmit the to-be-offloaded task to the execution device according to the offloading path, so as to offload the to-be-offloaded task.
2. The method of claim 1, wherein, According to the task sequence to which the to-be-offloaded task belongs, determine the computing capability constraint and the energy consumption constraint of the to-be-offloaded task, wherein the computing capability constraint is determined by the following method: For each to-be-offloaded task, determine a plurality of target to-be-offloaded tasks belonging to the same task sequence as the to-be-offloaded task and having an execution sequence before the to-be-offloaded task, and obtain a computing resource demand corresponding to each target to-be-offloaded task, wherein the computing resource demand is the computing resource consumed by executing the target to-be-offloaded task. In the case where the to-be-offloaded task only belongs to one task sequence, determine a plurality of target to-be-offloaded tasks having an execution sequence before the to-be-offloaded task in the task sequence, and determine the computing capability constraint of the to-be-offloaded task according to a plurality of computing resource demands corresponding to a plurality of target to-be-offloaded tasks. In the case where the to-be-offloaded task belongs to a plurality of different task sequences, respectively determine an independent computing capability constraint of the to-be-offloaded task in each task sequence according to the target to-be-offloaded task contained in each task sequence, and determine the independent computing capability constraint with the largest value among a plurality of independent computing capability constraints as the computing capability constraint of the to-be-offloaded task.
3. The method of claim 1, wherein, According to the task sequence to which the to-be-offloaded task belongs, determine the computing capability constraint and the energy consumption constraint of the to-be-offloaded task, wherein the energy consumption constraint is determined by the following method: Determine a first energy consumption consumed by the to-be-offloaded task transmitted to each edge device, and determine a second energy consumption consumed by each edge device executing the to-be-offloaded task; For each edge device, determine a total energy consumption consumed by the edge device executing the offloading process of the to-be-offloaded task as the sum of the first energy consumption and the second energy consumption; For each to-be-offloaded task, determine the total energy consumption with the largest value among a plurality of total energy consumptions corresponding to the to-be-offloaded task as the energy consumption constraint of the to-be-offloaded task.
4. The method of claim 1, wherein, According to the computing capability constraint, determine the offloading mode corresponding to the to-be-offloaded task, comprising: Obtain a first idle computing resource of the local device, and a second idle computing resource of each edge device, wherein the first idle computing resource is a computing resource not occupied by the local device, and the second idle computing resource is a computing resource not occupied by the edge device; For each to-be-offloaded task, compare the computing capability constraint with the first idle computing resource to obtain a first comparison result; in the case where the first comparison result indicates that the computing capability constraint is less than or equal to the first idle computing resource, determine that the offloading mode is the local offloading; In the case where the first comparison result indicates that the computing capability constraint is greater than the first idle computing resource, compare the computing capability constraint with the second idle computing resource to obtain a second comparison result; determining the execution device of the offloading process of the to-be-offloaded task according to the offloading mode, the computing capability constraint and the energy consumption constraint, comprising: determining the execution device as the local device in the case that the offloading mode of the to-be-offloaded task is the local offloading; 5. The method of claim 1, wherein, determining the execution device as any one of the cloud servers in the case that the offloading mode of the to-be-offloaded task is the cloud offloading. for a target to-be-offloaded task of the edge offloading mode, obtaining a first resource label of each of the target to-be-offloaded task, wherein the first resource label records the computing capability constraint and the energy consumption constraint of the target to-be-offloaded task; and obtaining a second resource label of each of the edge devices, wherein the second resource label records the second idle computing resource of the edge device, and a target energy consumption consumed by the edge device in executing the to-be-offloaded task, and the second idle computing resource is a computing resource not occupied by the edge device; for each of the target to-be-offloaded task, determining a target resource label in a plurality of the second resource labels according to the first resource label, wherein the target resource label is a second resource label recording that the second idle computing resource is greater than the computing capability constraint in the first resource label, and the target energy consumption is less than the energy consumption constraint; determining the edge device corresponding to the target resource label as a target edge device, and determining the execution device of the target to-be-offloaded task in the target edge device, wherein the target edge device is an edge device meeting the offloading resource requirement of the to-be-offloaded task. determining the execution device of the target to-be-offloaded task in the target edge device, comprising: determining the target edge device as the execution device in the case that there is only one target edge device; 6. The method of claim 5, wherein, ranking a plurality of the target edge devices in descending order of the corresponding second idle computing resource to obtain a ranking result of each of the target edge devices in the case that there are a plurality of the target edge devices; determining the target edge device corresponding to the ranking result with the smallest value as the execution device, and determining the remaining target edge devices as alternative execution devices, wherein the alternative execution devices are used as the execution device of the to-be-offloaded task in the case that the execution device fails. determining the offloading path of the to-be-offloaded task according to the execution device, comprising: 7. The method of claim 1, wherein, For each of the to-be-offloaded tasks, determine a network link for transmitting the to-be-offloaded task from the local device to the execution device, wherein the network link records the local device, the execution device, a plurality of switches, and a sequence of the to-be-offloaded task in the local device, the execution device, and the plurality of switches; Determine a transmission delay of each of the network links, and determine the network link corresponding to the transmission delay with the smallest value as the offloading path of the to-be-offloaded task.
8. An apparatus for task offloading, the apparatus comprising: Comprise: A receiving module configured to receive a task offloading request, wherein the task offloading request records at least the following information: a plurality of to-be-offloaded tasks, and a dependency relationship of the plurality of to-be-offloaded tasks, the dependency relationship being used to indicate an execution sequence of the plurality of to-be-offloaded tasks, and the dependency relationship comprising: parallel execution and sequential execution; A generating module configured to generate at least one task sequence according to the plurality of to-be-offloaded tasks and the dependency relationship, comprising: determining each of the to-be-offloaded tasks as a node, and determining the dependency relationship as an edge, connecting the plurality of nodes with the dependency relationship in sequence according to the direction of the edge to generate a task graph, wherein the direction of the edge is determined by the execution sequence; determining an out-degree of each of the nodes, wherein the out-degree is used to indicate the number of first-type edges connected to the node, and the first-type edge is an edge with a current node as a starting point and another node different from the current node as a terminal point; for a first-type node with the out-degree of 0, determining each of the first-type nodes as the task sequence; for a second-type node with the out-degree not being 0, determining an in-degree of each of the second-type nodes, wherein the in-degree is used to indicate the data of second-type edges connected to the node, and the second-type edge is an edge with a current node as a terminal point and another node different from the current node as a starting point; generating the task sequence according to the second-type node, wherein the number of the task sequences generated according to the second-type node is the same as the out-degree of the second-type node, and a plurality of third-type nodes contained in the task sequence generated according to the second-type node are nodes located on the same edge as the second-type node in the task graph, wherein the task sequence is used to indicate an execution sequence when offloading a plurality of to-be-offloaded tasks contained in the task sequence; A first determining module configured to, for each of the to-be-offloaded tasks, determine a computing capability constraint and an energy consumption constraint of the to-be-offloaded task according to the task sequence to which the to-be-offloaded task belongs, wherein the computing capability constraint is used to indicate a maximum computing resource consumed when executing the to-be-offloaded task, and the energy consumption constraint is used to indicate a maximum electric energy consumed when executing the to-be-offloaded task. The second determining module is configured to determine an unloading manner corresponding to the to-be-unloaded task according to the computing capability constraint, and determine an execution device of an unloading process of the to-be-unloaded task according to the unloading manner, the computing capability constraint and the energy consumption constraint, wherein the unloading manner comprises local unloading, cloud unloading and edge unloading, the local unloading is used to indicate that the unloading process of the to-be-unloaded task is executed on a local device, the local device is an industrial device that sends the task unloading request, the cloud unloading indicates that the unloading process of the to-be-unloaded task is executed on a cloud server, the edge unloading indicates that the unloading process of the to-be-unloaded task is executed on an edge device, the edge device is a device located at an edge of a network architecture to which the to-be-unloaded task belongs, and the execution device comprises the local device, the cloud server and the edge device. The unloading module is configured to determine an unloading path of the to-be-unloaded task according to the execution device, and transmit the to-be-unloaded task to the execution device according to the unloading path, so as to unload the to-be-unloaded task.
9. A non-volatile storage medium, comprising: The non-volatile storage medium stores a computer program, and a device in which the non-volatile storage medium is located executes the method for task unloading according to any one of claims 1 to 6 by running the computer program.
10. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to execute the method for task unloading according to any one of claims 1 to 6 by using the computer program.
11. A computer program product comprising computer instructions, characterized in that, The computer instructions are executed by the processor to implement the steps of the method for task unloading according to any one of claims 1 to 6.
Citation Information
Patent Citations
Task unloading method and device, electronic equipment and storage medium
CN115835301A
Task scheduling method and device, electronic equipment and storage medium
CN117806795A