Task scheduling method, device and equipment for multiple pieces of Internet of Things equipment and storage medium
By building a task priority queue and genetic algorithm, combining dynamic voltage frequency adjustment and particle swarm algorithm, the problem of low energy consumption and efficiency in IoT device task scheduling is solved, low power consumption and efficient scheduling is achieved, and suitable for resource-limited resources environment.
Patent Information
- Application Number
- CN202410829188.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-25
- Publication Date
- 2024-11-08
AI Technical Summary
The existing IoT device task scheduling methods fail to effectively consider the relationship between task scheduling and hardware operation, and ignore energy consumption and environmental factors, resulting in high power consumption and low efficiency of equipment during long-term operation.
Using multi-IoT device task scheduling method, by constructing task priority queues, random sorting, genetic algorithms and particle swarm algorithms, combined with dynamic voltage frequency adjustment, task scheduling is optimized to reduce energy consumption and task completion time, and handle sharing through autonomous decision-making modules Resource competition, generate probabilistic strategies for task scheduling.
It effectively reduces the energy consumption and task completion time of IoT devices, reduces additional overhead and scheduling control difficulty, and is suitable for IoT devices with limited resources, improving the long-term operation efficiency of equipment.
Smart Images

Figure CN118916126A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of Internet of Things, and in particular to a method, apparatus, device and storage medium for scheduling tasks of multiple Internet of Things devices. Background Art
[0002] At present, IoT devices have been widely used in various fields, such as smart home, smart city, industrial Internet, smart transportation, etc., which provide important support for improving life and efficiency. However, many IoT devices often collect environmental data through sensors, but the battery life of most IoT devices is limited. It can be seen that formulating a reasonable scheduling plan to adapt to device tasks and control the real-time status of sensors is particularly important for achieving low-power long-term operation of IoT devices. Among them, energy consumption and real-time performance are two key indicators for task scheduling of IoT devices. Therefore, with the rise of the Internet of Things, research on real-time task scheduling will help improve the operating efficiency of IoT devices.
[0003] In related technologies, task scheduling of IoT devices is often achieved through algorithms such as scheduling based on time, events and states, scheduling based on priorities and dynamic scheduling. However, these methods do not consider the operating relationship between task scheduling and hardware and ignore the impact of energy consumption costs, environmental factors and other issues. To solve the above problems, some studies apply evolutionary algorithms to task scheduling, that is, formalizing the task scheduling problem into an optimization problem, so as to iterate and optimize the generated initialization population through evolutionary algorithms, and finally obtain a suitable task scheduling solution. However, since the memory and computing resources of IoT devices are limited, the above algorithms will be subject to resource constraints in practical applications. Summary of the invention
[0004] The present application provides a method, apparatus, device and storage medium for scheduling tasks of multiple IoT devices to effectively reduce energy consumption and task completion time and reduce additional overhead.
[0005] In a first aspect, an embodiment of the present application provides a method for scheduling tasks of multiple IoT devices, comprising the following steps:
[0006] Building a task priority queue based on task information of different IoT devices, and building an initial task order queue based on the task priority queue;
[0007] Performing multiple random sorting on tasks with the same priority in the initial task sequence queue to generate multiple target task sequence queues;
[0008] Construct chromosomes according to each target task sequential queue and its corresponding target processor number list and target DVFS level list to generate an initial population;
[0009] Iteratively processing the chromosomes in the initial population by selecting, crossing over, and mutating based on a genetic algorithm to obtain a target population, wherein the optimization objectives of the iterative processing are energy consumption and task completion time;
[0010] Probabilistically analyzing the target population according to the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty to generate a probabilistic strategy;
[0011] The target task scheduling scheme is determined through the probabilistic strategy and the task scheduling is performed.
[0012] In combination with the first aspect, in one embodiment, before the step of constructing a chromosome according to each target task sequence queue and its corresponding target processor number list and target DVFS level list, it also includes:
[0013] Randomly generate a list of target processor numbers based on the number of cores in the multi-core processor;
[0014] The CPU frequency of the multi-core processor is divided into gears, and a target DVFS level list is randomly generated based on the divided gears;
[0015] The length of the target processor number list, the length of the target DVFS level list, and the length of the target task order queue are all the same.
[0016] In combination with the first aspect, in one implementation, the iterative processing of selecting, crossing over and mutating chromosomes in the initial population based on a genetic algorithm to obtain a target population includes:
[0017] Two target chromosomes are selected from the initial population based on the binary tournament selection method;
[0018] Perform a crossover operation on the target task sequence queues in the two target chromosomes;
[0019] According to the crossover result, matching adjustment and crossover operation are performed on the target processor number list and the target DVFS level list to generate a post-crossover chromosome;
[0020] Perform mutation operation on the chromosomes after crossover to generate offspring populations;
[0021] The initial subpopulation and the offspring population are merged to obtain a new population, and the iterative process is re-performed based on the new population until a preset iteration termination condition is met to generate a target population.
[0022] In combination with the first aspect, in one embodiment, the mutation operation of the target DVFS level list in the chromosome after crossover is implemented by a uniform mutation method, and the mutation operation of the target processor number list in the chromosome after crossover is implemented by an adaptive uniform mutation method, wherein the mutation probability in the adaptive uniform mutation method is determined based on the utilization of the core processor.
[0023] In combination with the first aspect, in one implementation, the probability analysis of the target population is performed according to the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty to generate a probabilistic strategy, including:
[0024] The optimal chromosome is determined from the target population by using the fast non-dominated sorting method and the crowding degree calculation method;
[0025] Determine the competition congestion coefficient corresponding to the time period in which the shared competition task needs to be executed according to the shared resource attributes of the task;
[0026] Calculating the competition degree of each chromosome in the target population based on the competition crowding coefficient, and determining multiple target chromosomes according to the competition degree;
[0027] Based on the particle swarm algorithm and the target fitness algorithm including the shared resource competition penalty, the probabilities of the optimal chromosome and each target chromosome are determined to generate a probabilistic strategy.
[0028] In combination with the first aspect, in one implementation, the calculation formula of the shared resource competition penalty is:
[0029]
[0030] Where Penal represents the penalty for shared resource competition, K i Indicates whether the i-th task is a shared resource competition task, ω is the weight between energy consumption and time, P failure_i is the failure rate of the i-th task, E i 、T i They represent the energy consumption and time required to complete the i-th task respectively.
[0031] In combination with the first aspect, in one implementation, the step of constructing a task priority queue based on task information of different IoT devices includes:
[0032] Determine the dependencies between tasks based on the task information of different IoT devices, and determine the node number corresponding to each task according to the dependencies to construct a task graph;
[0033] Determine the priority number of each task through the task graph and the task predecessor set;
[0034] The priority number and the node number corresponding to each task are sorted in order from low to high to generate a task priority queue.
[0035] In a second aspect, an embodiment of the present application provides a multi-IoT device task scheduling device, including:
[0036] A preprocessing module, which is used to construct a task priority queue based on task information of different IoT devices, and to construct an initial task order queue according to the task priority queue;
[0037] A genetic evolution module, which is used to randomly sort the tasks with the same priority in the initial task sequence queue multiple times to generate multiple target task sequence queues; construct chromosomes according to each target task sequence queue and its corresponding target processor number list and target DVFS level list to generate an initial population; based on a genetic algorithm, the chromosomes in the initial population are iteratively processed by selection, crossover and mutation to obtain a target population, wherein the optimization target of the iterative processing is energy consumption and task completion time;
[0038] An autonomous decision-making module, which is used to perform probability analysis on the target population according to the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty to generate a probabilistic strategy;
[0039] The task scheduling module is used to determine the target task scheduling plan through the probabilistic strategy and perform task scheduling.
[0040] In conjunction with the second aspect, in one embodiment, the genetic evolution module is further used to:
[0041] Randomly generate a list of target processor numbers based on the number of cores in the multi-core processor;
[0042] The CPU frequency of the multi-core processor is divided into gears, and a target DVFS level list is randomly generated based on the divided gears;
[0043] The length of the target processor number list, the length of the target DVFS level list, and the length of the target task order queue are all the same.
[0044] In conjunction with the second aspect, in one embodiment, the genetic evolution module is specifically used for:
[0045] Two target chromosomes are selected from the initial population based on the binary tournament selection method;
[0046] Perform a crossover operation on the target task sequence queues in the two target chromosomes;
[0047] According to the crossover result, matching adjustment and crossover operation are performed on the target processor number list and the target DVFS level list to generate a post-crossover chromosome;
[0048] Perform mutation operation on the chromosomes after crossover to generate offspring populations;
[0049] The initial subpopulation and the offspring population are merged to obtain a new population, and the iterative process is re-performed based on the new population until a preset iteration termination condition is met to generate a target population.
[0050] In combination with the second aspect, in one embodiment, the mutation operation of the target DVFS level list in the chromosome after crossover is implemented by a uniform mutation method, and the mutation operation of the target processor number list in the chromosome after crossover is implemented by an adaptive uniform mutation method, wherein the mutation probability in the adaptive uniform mutation method is determined based on the utilization of the core processor.
[0051] In conjunction with the second aspect, in one implementation, the autonomous decision-making module is specifically used to:
[0052] The optimal chromosome is determined from the target population by using the fast non-dominated sorting method and the crowding degree calculation method;
[0053] Determine the competition congestion coefficient corresponding to the time period in which the shared competition task needs to be executed according to the shared resource attributes of the task;
[0054] Calculating the competition degree of each chromosome in the target population based on the competition crowding coefficient, and determining multiple target chromosomes according to the competition degree;
[0055] Based on the particle swarm algorithm and the target fitness algorithm including the shared resource competition penalty, the probabilities of the optimal chromosome and each target chromosome are determined to generate a probabilistic strategy.
[0056] In conjunction with the second aspect, in one implementation, the calculation formula for the shared resource competition penalty is:
[0057]
[0058] Where Penal represents the penalty for shared resource competition, K i Indicates whether the i-th task is a shared resource competition task, ω is the weight between energy consumption and time, P failure_i is the failure rate of the i-th task, E i 、T i They represent the energy consumption and time required to complete the i-th task respectively.
[0059] In conjunction with the second aspect, in one implementation, the preprocessing module is specifically used for:
[0060] Determine the dependencies between tasks based on the task information of different IoT devices, and determine the node number corresponding to each task according to the dependencies to construct a task graph;
[0061] Determine the priority number of each task through the task graph and the task predecessor set;
[0062] The priority number and the node number corresponding to each task are sorted in order from low to high to generate a task priority queue.
[0063] In a third aspect, an embodiment of the present application provides a multi-IoT device task scheduling device, wherein the multi-IoT device task scheduling device includes a processor, a memory, and a multi-IoT device task scheduling program stored in the memory and executable by the processor, wherein when the multi-IoT device task scheduling program is executed by the processor, the steps of the multi-IoT device task scheduling method as described above are implemented.
[0064] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a multi-IoT device task scheduling program is stored, wherein when the multi-IoT device task scheduling program is executed by a processor, the steps of multi-IoT device task scheduling as described above are implemented.
[0065] The beneficial effects brought by the technical solution provided in the embodiments of the present application include:
[0066] A task priority queue is constructed based on the task information of different IoT devices, and an initial task sequence queue is constructed based on the task priority queue; tasks with the same priority in the initial task sequence queue are randomly sorted multiple times to generate multiple target task sequence queues; chromosomes are constructed based on each target task sequence queue and its corresponding target processor number list and target DVFS level list to generate an initial population, so as to effectively reduce energy consumption through dynamic voltage adjustment technology, which is conducive to the long-term operation of IoT devices; and the chromosomes in the initial population are iteratively processed by selection, crossover and mutation based on the genetic algorithm to obtain the target population, wherein the optimization objectives of the iterative processing are energy consumption and task completion time; and an autonomous decision-making method will be used to make task scheduling decisions for the shared resource competition problem, that is, a probabilistic strategy is generated after a probability analysis of the target population is performed based on the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty, and then the target task scheduling plan is determined through the probabilistic strategy and the task scheduling is performed; since no additional communication with other devices is required in the above scheduling decision process, it can effectively reduce additional overhead and reduce the difficulty of scheduling control. BRIEF DESCRIPTION OF THE DRAWINGS
[0067] Figure 1 This is a flow chart of an embodiment of a method for scheduling tasks of multiple IoT devices of the present application;
[0068] Figure 2 This is a schematic diagram of the overall framework of the task scheduling method involved in the embodiment of the present application;
[0069] Figure 3 It is a task diagram involved in the embodiment scheme of this application;
[0070] Figure 4 This is a schematic diagram of the task priority queue involved in the embodiment of the present application;
[0071] Figure 5 A schematic diagram of chromosome coding involved in the embodiment of the present application;
[0072] Figure 6 This is a schematic diagram of the hardware structure of a multi-IoT device task scheduling device involved in the embodiment of the present application. DETAILED DESCRIPTION
[0073] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.
[0074] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0075] In a first aspect, an embodiment of the present application provides a method for scheduling tasks of multiple IoT devices.
[0076] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of an embodiment of the method for scheduling tasks of multiple IoT devices in this application. Figure 1 As shown, the multi-IoT device task scheduling method includes:
[0077] Step S10: constructing a task priority queue based on the task information of different IoT devices, and constructing an initial task order queue according to the task priority queue.
[0078] Exemplarily, in this embodiment, for multi-core processors and multi-IoT device working scenarios with competition for shared resources, each task will be prioritized according to the input real-time task information to generate a task priority queue. Among them, the task priority queue not only contains the node number corresponding to each task, but also tasks with the same priority have the same priority number; it should be understood that low-level tasks have higher priorities and are executed first during task scheduling, that is, the smaller the priority number corresponding to a task, the higher its priority, and the task is executed first. Then the task priority queue is grouped according to the task priority, that is, each group of tasks has the same priority, so as to construct an initial task sequence queue that meets the dependency relationship between tasks. It can be understood that the length of the initial task sequence queue is determined by the number of tasks. For example, if there are N tasks, the length of the initial task sequence queue is n.
[0079] Furthermore, in one embodiment, the step of constructing a task priority queue based on task information of different IoT devices includes:
[0080] Determine the dependencies between tasks based on the task information of different IoT devices, and determine the node number corresponding to each task according to the dependencies to construct a task graph;
[0081] Determine the priority number of each task through the task graph and the task predecessor set;
[0082] The priority number and the node number corresponding to each task are sorted in order from low to high to generate a task priority queue.
[0083] For example, in this embodiment, after determining the dependency between tasks based on the task information of different IoT devices, the dependency between tasks can be represented by a directed acyclic graph, that is, the tasks that the IoT devices need to perform are included in the graph, represented by a node, and the dependency between two tasks is represented by an edge. It should be noted that when constructing a task priority queue, it is necessary to first ensure that each task priority queue satisfies the dependency constraint, that is, for any two tasks (T i , T j ) between each edge e ij , T i You must start executing T j before completing its execution.
[0084] For details, see Figure 2As shown, after combining the new task with the current task set, N tasks are obtained, and then the dependencies between the N tasks are determined according to the preset task information, and then a directed acyclic task graph is generated according to the dependencies; it should be noted that when constructing the task graph, two additional virtual nodes need to be added: the start node and the end node, where the start node is connected to all nodes without successor tasks, and the end node is connected to all nodes without successor tasks, and the start node is numbered 0, and the end node is numbered N+1. For example, see Figure 3 As shown, there are 11 tasks in total, the start node number is 0 and the end node number is 12, and the nodes of the 11 tasks are numbered 1 to 11 respectively.
[0085] Then calculate the priority of each task, assuming pred_set(T j ) is in the startup task T j The set of all previous tasks that must be executed before (i.e., the task predecessor set), then each task T j The priority can be determined by:
[0086]
[0087] Among them, max_level(T i ) belongs to task T j The predecessor task T i The priority number of task T j Compared with other front-wheel drive i is the maximum priority number. Specifically, the priority number of the start node is set to L0, and the priority number of the task node is set to the highest priority of its parent node plus 1.
[0088] Finally, sort the priority numbers from low to high, and divide them into segments according to the priority of the task, and sort the node numbers corresponding to the tasks with the same priority number from low to high, so as to generate the following: Figure 4 The task priority queue shown. It can be understood that Figure 3 The task priority queue in is divided into 4 sections, namely L1 (i.e. Level 1), L2 (i.e. Level 2), L3 (i.e. Level 3) and L4 (i.e. Level 4), and L1 includes tasks with node numbers 1 and 2, L2 includes tasks with node numbers 3, 4 and 5, L3 includes tasks with node numbers 6, 7, 8 and 9, and L4 includes tasks with node numbers 10 and 11.
[0089] Step S20: performing multiple random sorting on the tasks with the same priority in the initial task sequence queue to generate multiple target task sequence queues.
[0090] Exemplarily, in the initialization phase, after N tasks are arranged from low to high according to priority groups to obtain an initial task sequence queue, the order of tasks in each section is randomly shuffled and reassembled according to priority from low to high, that is, each group of tasks in the initial task sequence queue is randomly shuffled to obtain a target task sequence queue that satisfies the dependency relationship between tasks, and the target task sequence queue is used as part of the individuals in the initial population. It can be understood that, assuming that the size of the initial population is M, M target task sequence queues need to be generated, that is, the initial task sequence queue needs to be randomly sorted M times, and a target task sequence queue is obtained after each random sorting.
[0091] Step S30: construct a chromosome according to each target task sequence queue and its corresponding target processor number list and target DVFS level list to generate an initial population.
[0092] Exemplarily, in this embodiment, each target task sequence queue and its corresponding randomly generated target processor number list and DVFS (dynamic voltage frequency scaling) level list are encoded and combined to obtain the following: Figure 5 The chromosomes shown in FIG. 1 and each chromosome is used as an individual of the population to construct an initial population. It can be understood that, assuming that there are M target task sequence queues, M chromosomes will be generated accordingly.
[0093] In one embodiment, before the step of constructing a chromosome according to each target task sequence queue and its corresponding target processor number list and target DVFS level list, the method further includes:
[0094] Randomly generate a list of target processor numbers based on the number of cores in the multi-core processor;
[0095] The CPU frequency of the multi-core processor is divided into gears, and a target DVFS level list is randomly generated based on the divided gears;
[0096] The length of the target processor number list, the length of the target DVFS level list, and the length of the target task order queue are all the same.
[0097] Exemplarily, in this embodiment, each chromosome in the initial population is divided into three parts, namely, a task order queue, a processor number list, and a DVFS level list, and the length of each part is the same, which is the number of tasks N, that is, the length of the chromosome is 3n. Among them, a processor number list of length n is randomly generated in the range of [1, p], where p is the number of cores of the multi-core processor; the CPU frequency is divided into multiple gears according to the characteristics of the multi-core processor, and the highest DVFS level q is determined by the gear division result, and a DVFS level list of length n is randomly generated in the range of [0, q]. It should be noted that the values of the processor number and the DVFS level are both integers.
[0098] In this embodiment, the DVFS level is introduced into the chromosome to perform adaptive adjustment of energy consumption, that is, the voltage of each processor is adaptively adjusted through the DVFS technology to change the processing frequency and speed of the processor, thereby achieving adaptive adjustment of energy consumption, which is beneficial to the long-term operation of the Internet of Things device.
[0099] Step S40: performing iterative processing of selection, crossover and mutation on the chromosomes in the initial population based on a genetic algorithm to obtain a target population, wherein the optimization targets of the iterative processing are energy consumption and task completion time.
[0100] Exemplarily, it can be understood that all individuals (i.e., chromosomes) in the initial population can be possible solutions to task scheduling, so this embodiment transforms the task scheduling problem into a multi-objective optimization problem including energy consumption and task completion time, that is, the optimization goal is to complete a series of periodic tasks with lower energy consumption and completion time. Among them, this embodiment will use the genetic algorithm NSGAII to perform non-dominated sorting and crowding calculation on the individuals in the initial population, and perform multiple selection, crossover and mutation iterative optimization processes on the individuals according to the non-dominated sorting and crowding calculation results until the target population is obtained.
[0101] Step S50: performing a probability analysis on the target population according to the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty to generate a probabilistic strategy.
[0102] Demonstration, in this embodiment, in response to the problem of shared resource competition among multiple IoT devices, autonomous decision-making is made on the task plan corresponding to the optimized target population, the goal of which is to select individuals with appropriate probabilistic strategies to reduce the overhead of shared resource competition. Specifically, before starting to make scheduling decisions, tasks are divided into two categories according to the shared resource attributes of the tasks to be executed: one category requires a large amount of shared resources in the cluster, such as data transmission with the server, and the other category does not require competition for shared resources; then the iterated population is analyzed to count the possible high-frequency time periods of shared resource competition tasks, and then representative solutions (i.e., individuals) are selected from the target population to search for the best game strategy under the condition of additional overhead caused by shared resource competition through the particle swarm algorithm, that is, the particle swarm algorithm is used to search for probabilistic strategies, and the penalty caused by shared resource competition is introduced when calculating fitness, which does not require additional communication with other devices, can reduce additional overhead and reduce the difficulty of scheduling control.
[0103] Step S60: Determine the target task scheduling plan through the probabilistic strategy and perform task scheduling.
[0104] Exemplarily, in this embodiment, the target task scheduling scheme of this round is determined by the roulette wheel selection method according to the probabilistic strategy obtained above. It should be noted that the roulette wheel selection method is also called the proportional selection method, which is a selection strategy commonly used in genetic algorithms. Its basic idea is that the probability of each individual being selected is proportional to its fitness, and the purpose is to allow individuals with high fitness to have a greater chance of being selected, so as to gain an advantage in the evolution process of the genetic algorithm; therefore, the roulette wheel selection method is widely used in the parent screening process of the genetic algorithm, because it can effectively determine the probability of being selected according to the fitness of the individual, so as to find a better solution in the search space.
[0105] Specifically, the individuals selected based on the probabilistic strategy are sent to the task scheduling module for decoding to obtain the target task scheduling plan; at the same time, the task scheduling module monitors the task execution status of each processor core. If the current task queue length is not greater than the current number of idle CPU cores, the CPU cores are allocated to the task nodes according to the topological priority and executed in sequence; if the current task queue length is greater than the current number of idle CPU cores, the head task status of the task queue of each processor core is checked when the processor core is in an idle state or the task is completed. If it is detected that the head task is in an executable state, the task scheduling module will allocate tasks to the specified processor core according to the target task scheduling plan and set its DVFS level, so that the processor executes the corresponding task and achieves optimal configuration of energy consumption and running time.
[0106] It can be seen that this embodiment proposes to combine task scheduling based on genetic algorithm with task decision-making based on particle swarm optimization. In order to solve the problem of shared resource competition among multiple IoT devices, it effectively combines avoiding shared resource competition with task scheduling optimization, and optimizes the task scheduling scheme from a multi-objective perspective. The implementation process is: (1) preprocessing the real-time task set of IoT devices, and dividing the tasks into tasks participating in shared resource competition and tasks not participating in shared resource competition. Then, generating a task graph according to the dependency relationship between tasks; (2) generating a task priority queue based on the dependency relationship between tasks; (3) performing multi-objective optimization on the energy consumption and scheduling time of the task priority queue; (4) searching the optimized population through the particle swarm optimization algorithm to obtain a probabilistic strategy; (5) allocating the task queues to the CPU core resources in turn and executing them according to the probabilistic strategy, thereby solving the multi-objective optimization problem of balancing power consumption and scheduling real-time performance in task scheduling of IoT devices, and effectively reducing the additional overhead caused by shared resource competition among multiple IoT devices.
[0107] Furthermore, in one embodiment, the iterative processing of selecting, crossing over and mutating chromosomes in the initial population based on a genetic algorithm to obtain a target population includes:
[0108] Two target chromosomes are selected from the initial population based on the binary tournament selection method;
[0109] Perform a crossover operation on the target task sequence queues in the two target chromosomes;
[0110] According to the crossover result, matching adjustment and crossover operation are performed on the target processor number list and the target DVFS level list to generate a post-crossover chromosome;
[0111] Performing a mutation operation on the chromosome after the crossover to generate a descendant population; wherein the mutation operation of the target DVFS level list in the chromosome after the crossover is implemented by a uniform mutation method, and the mutation operation of the target processor number list in the chromosome after the crossover is implemented by an adaptive uniform mutation method, wherein the mutation probability in the adaptive uniform mutation method is determined based on the utilization rate of the core processor;
[0112] The initial subpopulation and the offspring population are merged to obtain a new population, and the iterative process is re-performed based on the new population until a preset iteration termination condition is met to generate a target population.
[0113] For example, see Figure 2As shown, in the population iteration stage, all individuals in the initial population are first non-dominated sorted and the crowding degree is calculated, and then the binary tournament selection method can be preferably used to select two parent individuals (target chromosomes), that is, the binary tournament selection method is executed twice, and each time a solution with a smaller non-dominated level or a larger crowding degree is randomly selected as the parent.
[0114] A crossover operation is performed on the two selected parents; wherein, in the crossover operation, firstly, the order (i.e., position)-based OX crossover operator can be preferably used to perform a crossover operation on part of the target task sequential queue in the target chromosome, and the processor number list and the DVFS level list are matched and adjusted according to the crossover result to ensure that the processor number and DVFS level corresponding to the task in the original target task sequential queue remain unchanged; then, the binary crossover operator SBX can be preferably used to perform a crossover operation on part of the processor number list and the DVFS level list to ensure that the chromosomes in the crossover process still meet the dependencies between tasks.
[0115] The chromosome obtained by crossover (i.e., the chromosome after crossover) is mutated. In the mutation operation, for each priority segment in the target task sequence queue, two tasks of the same level are randomly exchanged, that is, two positions are randomly selected for exchange (if the selected positions are repeated, no exchange is performed), and the corresponding processor numbers and DVFS levels are adjusted and exchanged; for the DVFS level list, the uniform mutation method is preferably used for the mutation operation; for the processor number list, the adaptive uniform mutation method is preferably used for the mutation operation, that is, the mutation probability of the processor number list is adaptively adjusted according to the processor usage within the same task priority, so as to improve the parallel capability of the task scheduling scheme and accelerate the convergence speed. Specifically, when the tasks in a priority segment are concentrated on a single processor, resulting in low overall processor utilization, the uniform mutation probability P will be adaptively increased within a certain range. m , which helps parallel processing of IoT tasks and speeds up convergence.
[0116] Repeat the above operation M times to obtain a child population of size M; then merge the child population and the parent population (i.e., the initial population) to obtain a new population of size 2M; then perform fast non-dominated sorting on the obtained new population and calculate the crowding degree, and select M individuals with high sorting and large crowding distance from the new population to form the next generation population for re-iteration until the preset iteration termination condition is met to generate the target population, and if the termination condition is not met, the above iteration process is repeated. It can be understood that the iteration termination condition can be the number of iterations or the result of multiple iterations is not updated.
[0117] It should be noted that in real-time task scheduling, when a new task needs to be scheduled, the task priority is recalculated, the task order queue is randomly generated again, and the corresponding chromosome encoding position is updated and adjusted, and then a certain period of iteration is performed to obtain a new parent generation.
[0118] Further, in one embodiment, the target population is subjected to probability analysis according to the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty to generate a probabilistic strategy, including:
[0119] The optimal chromosome is determined from the target population by using the fast non-dominated sorting method and the crowding degree calculation method;
[0120] Determine the competition congestion coefficient corresponding to the time period in which the shared competition task needs to be executed according to the shared resource attributes of the task;
[0121] Calculating the competition degree of each chromosome in the target population based on the competition crowding coefficient, and determining multiple target chromosomes according to the competition degree;
[0122] Based on the particle swarm algorithm and the target fitness algorithm including the shared resource competition penalty, the probabilities of the optimal chromosome and each target chromosome are determined to generate a probabilistic strategy; wherein the calculation formula of the shared resource competition penalty is:
[0123]
[0124] Where Penal represents the penalty for shared resource competition, K i Indicates whether the i-th task is a shared resource competition task, ω is the weight between energy consumption and time, P failure_i is the failure rate of the i-th task, E i 、T i They represent the energy consumption and time required to complete the i-th task respectively.
[0125] For example, see Figure 2 As shown, all chromosomes in the target population are sorted and the congestion is calculated by a fast non-dominated sorting method and a crowding calculation method, and individuals with a high ranking and a low crowding are selected as the optimal chromosomes; then, the execution time periods of the tasks competing for shared resources are counted according to the preset task information, that is, the time periods that need to execute the shared competition tasks are counted according to the shared resource attributes of the tasks and the competition crowding coefficient of the time period is accumulated; for example, in seconds, the higher the competition crowding coefficient, the more task scheduling schemes need to execute the tasks competing for shared resources within this second.
[0126] Then, the competitive crowding coefficient is used as a weight to calculate the competitiveness of each chromosome in the target population, and the target population except the optimal chromosome is classified from low to high according to the competitiveness; then the chromosome with the highest ranking in each category is selected as the representative (i.e., the target chromosome), and it forms a representative individual of the target population with the optimal chromosome. It should be noted that the target population can be classified according to the three dimensions of high, medium and low competitiveness as the classification basis to obtain three types of chromosomes; of course, the dimensions of the classification basis can be further refined, such as high, relatively high, medium, relatively low and low, which can be determined according to actual needs and are not limited here.
[0127] Finally, in order to reduce the competition for shared resources, this embodiment adopts autonomous probabilistic decision-making without communicating with other IoT devices, and selects the representative individuals mentioned above as the solution for this scheduling with different probabilities. Specifically, the probabilistic strategy can be solved by the particle swarm algorithm and the target fitness algorithm including the shared resource competition penalty, that is, the probabilistic strategy is searched by the particle swarm algorithm, and the penalty caused by the shared resource competition is introduced when calculating the fitness.
[0128] Specifically, the optimal strategy is searched for the representative individuals obtained above in high-dimensional space through the particle swarm algorithm: first, the particles are randomly initialized, where the dimensions of the particle position and velocity are the same as the number of representative individuals. It can be understood that the coordinate value of each dimension of the particle position is the probability of being selected for the corresponding representative individual, and the sum of the coordinate values is 1, limiting its velocity boundary range to (-1,1) and the position boundary range to [0,1].
[0129] It should be noted that multiple devices competing for shared resources may increase the energy and time required for the task. Therefore, this embodiment will calculate the loss based on the failure rate of the task. That is, the higher the competition of the task, the higher the failure rate. The fitness formula is: Where E is energy consumption, T is the time required to complete the task, ω is the weight between energy consumption and time, which is generally preferred to be 0.5; Penal is the penalty for shared competitive resources, and its calculation formula is as follows: K i Indicates whether the i-th task is a shared resource competition task. For example, if the i-th task is a shared resource competition task, then K i The value is 1, otherwise the value is 0; failure_i is the failure rate of the ith task, which is related to the competitiveness of the ith task and can be set according to the actual situation, that is, its value is determined based on the competitiveness of the ith task. i 、T iThey represent the energy consumption and time required to complete the i-th task respectively; therefore, after the particle initialization is completed, it is iterated and the fitness is calculated, the individual historical optimal value and the global historical optimal value are obtained, and it is determined whether the end condition is met; if not, the speed update formula and the position update formula are used to update and constrain the speed and position of the particle swarm and the above operations are repeated until the end condition is met; among them, after the position is constrained, it is necessary to scale to ensure that the sum of the coordinate values of each dimension of the position is 1, and the end condition can be that the specified number of iterations is reached or the global historical optimal position of the particle swarm has not been updated for multiple iterations.
[0130] In summary, this embodiment transforms the task scheduling problem into a genetic evolution problem, and combines the dynamic voltage and frequency adjustment technology to propose a task scheduling method for low-power IoT devices that reduces competition for shared resources between clusters, has high robustness, and has guaranteed scheduling results. The method can not only improve the parallel processing capability and high resource utilization, but also effectively reduce energy consumption through dynamic voltage adjustment technology to adapt to system needs, which is conducive to the long-term operation of IoT devices. In addition, in response to the problem of shared resource competition, an autonomous decision-making method is adopted to make task scheduling decisions, which does not require additional communication with other devices, can reduce additional overhead and reduce the difficulty of scheduling control, and can effectively avoid the execution of the task scheduling algorithm being limited by the memory and computing resources of the IoT device, which is particularly suitable for situations where the resources of the central server are limited.
[0131] In a second aspect, an embodiment of the present application also provides a multi-IoT device task scheduling device.
[0132] In one embodiment, a method and apparatus for scheduling tasks of multiple IoT devices includes:
[0133] A preprocessing module, which is used to construct a task priority queue based on task information of different IoT devices, and to construct an initial task order queue according to the task priority queue;
[0134] A genetic evolution module, which is used to randomly sort the tasks with the same priority in the initial task sequence queue multiple times to generate multiple target task sequence queues; construct chromosomes according to each target task sequence queue and its corresponding target processor number list and target DVFS level list to generate an initial population; based on a genetic algorithm, the chromosomes in the initial population are iteratively processed by selection, crossover and mutation to obtain a target population, wherein the optimization target of the iterative processing is energy consumption and task completion time;
[0135] An autonomous decision-making module, which is used to perform probability analysis on the target population according to the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty to generate a probabilistic strategy;
[0136] The task scheduling module is used to determine the target task scheduling plan through the probabilistic strategy and perform task scheduling.
[0137] Furthermore, in one embodiment, the genetic evolution module is also used to:
[0138] Randomly generate a list of target processor numbers based on the number of cores in the multi-core processor;
[0139] The CPU frequency of the multi-core processor is divided into gears, and a target DVFS level list is randomly generated based on the divided gears;
[0140] The length of the target processor number list, the length of the target DVFS level list, and the length of the target task order queue are all the same.
[0141] Furthermore, in one embodiment, the genetic evolution module is specifically used for:
[0142] Two target chromosomes are selected from the initial population based on the binary tournament selection method;
[0143] Perform a crossover operation on the target task sequence queues in the two target chromosomes;
[0144] According to the crossover result, matching adjustment and crossover operation are performed on the target processor number list and the target DVFS level list to generate a post-crossover chromosome;
[0145] Perform mutation operation on the chromosomes after crossover to generate offspring populations;
[0146] The initial subpopulation and the offspring population are merged to obtain a new population, and the iterative process is re-performed based on the new population until a preset iteration termination condition is met to generate a target population.
[0147] Furthermore, in one embodiment, the mutation operation of the target DVFS level list in the chromosome after the crossover is implemented by a uniform mutation method, and the mutation operation of the target processor number list in the chromosome after the crossover is implemented by an adaptive uniform mutation method, wherein the mutation probability in the adaptive uniform mutation method is determined based on the utilization of the core processor.
[0148] Furthermore, in one embodiment, the autonomous decision-making module is specifically used to:
[0149] The optimal chromosome is determined from the target population by using the fast non-dominated sorting method and the crowding degree calculation method;
[0150] Determine the competition congestion coefficient corresponding to the time period in which the shared competition task needs to be executed according to the shared resource attributes of the task;
[0151] Calculating the competition degree of each chromosome in the target population based on the competition crowding coefficient, and determining multiple target chromosomes according to the competition degree;
[0152] Based on the particle swarm algorithm and the target fitness algorithm including the shared resource competition penalty, the probabilities of the optimal chromosome and each target chromosome are determined to generate a probabilistic strategy.
[0153] Furthermore, in one embodiment, the calculation formula of the shared resource competition penalty is:
[0154]
[0155] Where Penal represents the penalty for shared resource competition, K i Indicates whether the i-th task is a shared resource competition task, ω is the weight between energy consumption and time, P failure_i is the failure rate of the i-th task, E i 、T i They represent the energy consumption and time required to complete the i-th task respectively.
[0156] Furthermore, in one embodiment, the preprocessing module is specifically used for:
[0157] Determine the dependencies between tasks based on the task information of different IoT devices, and determine the node number corresponding to each task according to the dependencies to construct a task graph;
[0158] Determine the priority number of each task through the task graph and the task predecessor set;
[0159] The priority number and the node number corresponding to each task are sorted in order from low to high to generate a task priority queue.
[0160] Among them, the functional implementation of each module in the above-mentioned multi-IoT device task scheduling device corresponds to the various steps in the above-mentioned multi-IoT device task scheduling method embodiment, and its functions and implementation processes are no longer repeated here one by one.
[0161] In a third aspect, an embodiment of the present application provides a multi-IoT device task scheduling device, which may be a personal computer (PC), a laptop computer, a server, or other device with data processing capabilities.
[0162] Reference Figure 6 , Figure 6 Schematic diagram of the hardware structure of the multi-IoT device task scheduling device involved in the embodiment of the present application. In the embodiment of the present application, the multi-IoT device task scheduling device may include a processor, a memory, a communication interface and a communication bus.
[0163] The communication bus may be of any type and is used to interconnect the processor, the memory, and the communication interface.
[0164] The communication interface includes input / output (I / O) interface, physical interface and logical interface, etc., which are used to realize the interconnection of devices inside the multi-IoT device task scheduling device, and the interface used to realize the interconnection between the multi-IoT device task scheduling device and other devices (such as other computing devices or user devices). The physical interface can be an Ethernet interface, a fiber optic interface, an ATM interface, etc.; the user device can be a display, a keyboard, etc.
[0165] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.
[0166] The processor may be a general-purpose processor, and the general-purpose processor may call the multi-IoT device task scheduling program stored in the memory and execute the multi-IoT device task scheduling method provided in the embodiment of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the multi-IoT device task scheduling program is called may refer to the various embodiments of the multi-IoT device task scheduling method of the present application, which will not be repeated here.
[0167] Those skilled in the art will understand that Figure 6 The hardware structure shown in the figure does not constitute a limitation on the present application, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0168] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium.
[0169] The readable storage medium of the present application stores a multi-IoT device task scheduling program, wherein when the multi-IoT device task scheduling program is executed by a processor, the steps of the multi-IoT device task scheduling method as described above are implemented.
[0170] Among them, the method implemented when the multi-IoT device task scheduling program is executed can refer to the various embodiments of the multi-IoT device task scheduling method of the present application, and will not be repeated here.
[0171] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit "first", "second" and "third" to different types.
[0172] In the description of the embodiments of the present application, "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.
[0173] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; the “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.
[0174] In some processes described in the embodiments of the present application, multiple operations or steps that appear in a specific order are included, but it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of the present application or in parallel, and the sequence number of the operation is only used to distinguish between different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.
[0175] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present application.
[0176] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A method for scheduling tasks of multiple IoT devices, characterized in that: The following steps are involved: Building a task priority queue based on task information of different IoT devices, and building an initial task order queue based on the task priority queue; Performing multiple random sorting on tasks with the same priority in the initial task sequence queue to generate multiple target task sequence queues; Construct chromosomes according to each target task sequential queue and its corresponding target processor number list and target DVFS level list to generate an initial population; Iteratively processing the chromosomes in the initial population by selecting, crossing over, and mutating based on a genetic algorithm to obtain a target population, wherein the optimization objectives of the iterative processing are energy consumption and task completion time; Probabilistically analyzing the target population according to the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty to generate a probabilistic strategy; The target task scheduling scheme is determined through the probabilistic strategy and the task scheduling is performed.
2. The multi-IoT device task scheduling method according to claim 1, characterized in that: Before the step of constructing a chromosome according to each target task sequence queue and its corresponding target processor number list and target DVFS level list, the step further includes: Randomly generate a list of target processor numbers based on the number of cores in the multi-core processor; The CPU frequency of the multi-core processor is divided into gears, and a target DVFS level list is randomly generated based on the divided gears; The length of the target processor number list, the length of the target DVFS level list, and the length of the target task order queue are all the same.
3. The multi-IoT device task scheduling method according to claim 1, characterized in that: The iterative processing of selecting, crossing over and mutating the chromosomes in the initial population based on the genetic algorithm to obtain the target population includes: Two target chromosomes are selected from the initial population based on the binary tournament selection method; Perform a crossover operation on the target task sequence queues in the two target chromosomes; According to the crossover result, matching adjustment and crossover operation are performed on the target processor number list and the target DVFS level list to generate a post-crossover chromosome; Perform mutation operation on the chromosomes after crossover to generate offspring populations; The initial subpopulation and the offspring population are merged to obtain a new population, and the iterative process is re-performed based on the new population until a preset iteration termination condition is met to generate a target population.
4. The multi-IoT device task scheduling method as claimed in claim 3, characterized in that: The mutation operation of the target DVFS level list in the chromosome after crossover is implemented by a uniform mutation method, and the mutation operation of the target processor number list in the chromosome after crossover is implemented by an adaptive uniform mutation method, in which the mutation probability is determined based on the utilization of the core processor.
5. The multi-IoT device task scheduling method according to claim 1, characterized in that: The method of performing probability analysis on the target population according to the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty to generate a probabilistic strategy includes: The optimal chromosome is determined from the target population by using the fast non-dominated sorting method and the crowding degree calculation method; Determine the competition congestion coefficient corresponding to the time period in which the shared competition task needs to be executed according to the shared resource attributes of the task; Calculating the competition degree of each chromosome in the target population based on the competition crowding coefficient, and determining multiple target chromosomes according to the competition degree; Based on the particle swarm algorithm and the target fitness algorithm including the shared resource competition penalty, the probabilities of the optimal chromosome and each target chromosome are determined to generate a probabilistic strategy.
6. The multi-IoT device task scheduling method according to claim 1 or 5, characterized in that: The calculation formula of the shared resource competition penalty is: Where Penal represents the penalty for shared resource competition, K i Indicates whether the i-th task is a shared resource competition task, ω is the weight between energy consumption and time, P failure_i is the failure rate of the i-th task, E i 、T i They represent the energy consumption and time required to complete the i-th task respectively.
7. The multi-IoT device task scheduling method according to claim 1, characterized in that: The task priority queue is constructed based on the task information of different IoT devices, including: Determine the dependencies between tasks based on the task information of different IoT devices, and determine the node number corresponding to each task according to the dependencies to construct a task graph; Determine the priority number of each task through the task graph and the task predecessor set; The priority number and the node number corresponding to each task are sorted in order from low to high to generate a task priority queue.
8. A task scheduling device for multiple IoT devices, characterized in that: include: A preprocessing module, which is used to construct a task priority queue based on task information of different IoT devices, and to construct an initial task order queue according to the task priority queue; A genetic evolution module, which is used to randomly sort the tasks with the same priority in the initial task sequence queue multiple times to generate multiple target task sequence queues; construct chromosomes according to each target task sequence queue and its corresponding target processor number list and target DVFS level list to generate an initial population; based on a genetic algorithm, the chromosomes in the initial population are iteratively processed by selection, crossover and mutation to obtain a target population, wherein the optimization target of the iterative processing is energy consumption and task completion time; An autonomous decision-making module, which is used to perform probability analysis on the target population according to the shared resource attributes of the task, the particle swarm algorithm, and the target fitness algorithm including the shared resource competition penalty to generate a probabilistic strategy; The task scheduling module is used to determine the target task scheduling plan through the probabilistic strategy and perform task scheduling.
9. A multi-IoT device task scheduling device, characterized in that: The multi-IoT device task scheduling device includes a processor, a memory, and a multi-IoT device task scheduling program stored in the memory and executable by the processor, wherein when the multi-IoT device task scheduling program is executed by the processor, the steps of the multi-IoT device task scheduling method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a multi-IoT device task scheduling program, wherein when the multi-IoT device task scheduling program is executed by a processor, the steps of multi-IoT device task scheduling as described in any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Intelligent scheduling method and system based on equipment use frequency, equipment and medium
CN120197911A
Task scheduling method and system based on priority transformation in heterogeneous platform
CN120295741A
A task scheduling method and system based on priority transformation in heterogeneous platforms
CN120295741B
Humanoid robot task scheduling method and device in humanoid robot training ground
CN120598286A
Gradient scheduling method and system based on cloud platform
CN120849059A
