Heterogeneous multi-core energy-saving task scheduling method based on improved genetic algorithm
By improving genetic algorithms and dynamic voltage frequency adjustment technology, the problem of high energy consumption of task scheduling in heterogeneous multi-core systems is solved, and efficient and energy-saving task scheduling is achieved, ensuring that tasks are executed in the optimal order and reducing energy consumption.
Patent Information
- Application Number
- CN202411412381.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-01-17
AI Technical Summary
In heterogeneous multi-core systems, traditional task scheduling methods are difficult to ensure task execution efficiency while reducing energy consumption. Especially due to the different performance characteristics of different processing units, it is difficult to find the optimal or close to the optimal scheduling solution simply by relying on genetic algorithms.
Using a heterogeneous multi-core energy-saving task scheduling method based on improved genetic algorithms, by generating task DAG maps, initializing population information, determining task priority and scheduling sequence, combining dynamic voltage and frequency adjustment technology, dynamic compression and scaling voltage to balance energy consumption and execution Time, the population information is updated using the fitness function and cross-mutation operation until the termination condition is met.
It realizes efficient and energy-saving task scheduling in heterogeneous multi-core systems. By clarifying the task dependencies and optimizing the scheduling sequence, it reduces communication delay and energy consumption, ensures that tasks are executed in the optimal order, minimizes energy consumption, and achieves energy saving and efficiency balance.
Smart Images

Figure CN119322668A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of computer science and technology, and in particular to a heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm. Background Art
[0002] With the continuous advancement of computer hardware technology, modern computing platforms are gradually moving towards heterogeneous multi-core architectures, which not only improves computing power but also brings challenges to achieving efficient energy management. On heterogeneous multi-core platforms, task scheduling strategies directly affect the performance and energy consumption of the system. Traditional task scheduling methods usually focus on improving execution efficiency while ignoring energy consumption issues, which is not comprehensive enough today when energy is becoming an increasingly important factor. Therefore, in recent years, researchers have begun to explore how to reduce energy consumption as much as possible while ensuring task execution efficiency.
[0003] Although genetic algorithms and their improved versions have been widely used in the field of task scheduling, in heterogeneous multi-core systems, since different processing units have different performance characteristics, it is difficult to find the optimal or near-optimal scheduling solution relying solely on genetic algorithms. In order to overcome the above shortcomings, the present invention proposes a heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm. Summary of the invention
[0004] In view of the above existing problems, the present invention is proposed.
[0005] Therefore, the present invention provides a heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm to solve the problem of efficient and energy-saving task scheduling in a heterogeneous multi-core system.
[0006] In order to solve the above technical problems, the present invention provides the following technical solutions:
[0007] In a first aspect, an embodiment of the present invention provides a heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm, which includes generating a task DAG graph according to a current task set and initializing population information;
[0008] The population information after initialization enters the loop body and determines the task priority through the improved genetic algorithm to obtain the partitioning strategy;
[0009] Determine the scheduling order of tasks on the processor based on the task DAG graph and partitioning strategy;
[0010] Dynamic voltage and frequency scaling technology based on processors saves energy and prolongs the time of computing tasks;
[0011] According to the relationship between task energy saving and extended time, dynamic voltage scaling is performed based on feasible task scheduling;
[0012] Define a fitness function to calculate the current group fitness and sort it;
[0013] An improved genetic algorithm is used to update the population information and determine the new task priority. If the termination condition is met, the algorithm exits, otherwise it continues to iterate.
[0014] As a preferred solution of the heterogeneous multi-core energy-saving task scheduling method based on the improved genetic algorithm described in the present invention, a DAG graph is generated, and its expression is:
[0015] G = (V, E);
[0016] V={v 1 ,v 2 ,…,v n};
[0017] E={(v i ,v j )|v i ,v j ∈V and v i Must be in v j before completed};
[0018] Where G represents a DAG graph with n tasks, V represents the set of all tasks, E represents the edge set, and v n Represents the last task in the V set;
[0019] Select a one-dimensional bit string form to encode the task priority, and the encoding length is the number of task nodes in the task graph;
[0020] According to the number of tasks and the number of processors, the population size is determined, and its expression is:
[0021]
[0022] Among them, P represents the population size, n represents the number of tasks, and m represents the number of processors;
[0023] Initialize the population according to the population size P, and generate a corresponding number of individuals based on the number of individuals in the population. Each individual consists of a series of chromosomes, and each chromosome corresponds to the scheduling priority of a task;
[0024] Evaluate the fitness of the initialized population and calculate the fitness value of each individual;
[0025] First, we need to calculate the energy consumption of an individual, which is expressed as:
[0026]
[0027] Where Z represents the total energy consumption of the individual scheduling scheme, N(j) represents the number of different voltage modes of processor j, P(j, k) represents the power consumption of processor j in voltage mode k, texe(v, j, k) represents the execution time of task v on processor j in voltage mode k, θ(v, j, k) represents the selection function, k represents the voltage mode, m represents the number of processors, n represents the number of tasks, v represents the task, and j represents the processor;
[0028] Then calculate the individual execution time, the expression is:
[0029]
[0030] Where T represents the total execution time of the individual scheduling scheme, and tc represents the total communication time between tasks under the current division;
[0031] Finally, the fitness is obtained based on the energy consumption Z and execution time T, and its expression is:
[0032] F = α·Z + (1-α)·T;
[0033] Among them, F represents the fitness of the individual, α represents the weighting factor of energy consumption and execution time;
[0034] The population is sorted in ascending order according to the fitness value F, and the one with the lowest energy consumption is at the front of the queue. The quick sort algorithm is used to sort the individuals in the population in ascending order according to the fitness value F to complete the population information initialization.
[0035] As a preferred solution of the heterogeneous multi-core energy-saving task scheduling method based on the improved genetic algorithm described in the present invention, a part of individuals are selected as parents from the initialized population information, and the expression is:
[0036] S={T(N sel / 2),R(N sel / 2)};
[0037] Among them, S represents the set of selected parent individuals, T(Nsel / 2) represents selecting the top Nsel / 2 individuals from the population information, and R(Nsel / 2) represents randomly selecting Nsel / 2 individuals from the remaining individuals;
[0038] The selected individuals are subjected to crossover and mutation operations. The mutation operation randomly transforms a gene in the individual within the valid value range to randomly change the execution priority of the task. The expression is:
[0039] O=C(H 1 ,H 2 ,CH 1 ,CH 2 );
[0040] MG = RV (LB, UB);
[0041] Among them, O represents the offspring individual produced by crossover, H represents the parent individual used for crossover, CH represents the position of the crossover point, C represents the crossover operation, MG represents the value after mutation, RV represents the mutation operation, LB represents the minimum possible value of the gene, and UB represents the maximum possible value of the gene;
[0042] Update population information based on new individuals after crossover and mutation;
[0043] Calculate the scheduling energy consumption of the newly generated individual, and its expression is:
[0044]
[0045] Among them, E child represents the scheduling energy consumption of the newly generated individual, P i represents the processor power consumption, t i represents the task execution time, E comm,i represents the communication energy consumption associated with the task;
[0046] The updated population information expression is:
[0047] U=A(C,P,E child ,E parent ,E avg ,σ);
[0048] Among them, U represents the updated population information, C represents the newly generated individual, P represents the parent individual, and E parent Indicates that E avg represents the average execution energy consumption of the group, and σ represents the standard deviation of the group energy consumption;
[0049] Check whether the loop meets the termination condition. If the termination condition is met, the current optimal task scheduling solution is output. The check formula expression is:
[0050]
[0051] Among them, K represents the Boolean value of whether to terminate, CC represents the check termination condition, CI represents the number of current iterations, MI represents the maximum number of iterations, BS represents the partitioning strategy, and PR represents the performance requirement.
[0052] As a preferred solution of the heterogeneous multi-core energy-saving task scheduling method based on the improved genetic algorithm described in the present invention, the scheduling order of tasks on the processor is determined according to the task DAG graph and the partitioning strategy, and its expression is:
[0053]
[0054] Among them, S represents the scheduling order, G represents the DAG graph, BS represents the partitioning strategy, π represents the order of task execution, Π represents the set of all possible scheduling orders, and T π represents the total execution time of the task when it is executed according to the scheduling order π, E π (t) represents the energy consumption of the task at time t when it is executed according to the scheduling order π, S ij represents the communication cost from task i to task j, D ij represents the dependency delay of task i on task j, T ij represents the execution time of task i on the processor.
[0055] As a preferred solution of the heterogeneous multi-core energy-saving task scheduling method based on the improved genetic algorithm described in the present invention, the linear approximation model in the DVFS technology is selected as the relationship model between energy consumption and execution time, and the energy consumption of the task under different voltages and frequencies is calculated, and its expression is:
[0056]
[0057] Where Q(v,f) represents the energy consumption of the task at voltage v and frequency f, T(v,f) represents the execution time of the task at voltage v and frequency f, and P(v,f) represents the power consumption of the task at voltage v and frequency f;
[0058] The execution time of the calculation task under a given voltage v and frequency f is expressed as:
[0059]
[0060] Where D(v, f) represents the execution time of the task at voltage v and frequency f, c(v, f) represents the computational complexity of the task at voltage v and frequency f, f represents the operating frequency of the processor, and τ(v, f) represents the clock cycle time of the task at voltage v and frequency f;
[0061] The energy saving of the task is expressed as:
[0062]
[0063] Among them, S E (v, f) represents the energy saving of the task at voltage v and frequency f, α represents the weight factor of energy consumption, and dt represents the time increment;
[0064] The extended time of the task is expressed as:
[0065] S T (v,f) = -β·T(v,f);
[0066] Among them, S T(v, f) represents the extended time of the task at voltage v and frequency f, and β represents the weight factor of the execution time.
[0067] As a preferred solution of the heterogeneous multi-core energy-saving task scheduling method based on the improved genetic algorithm described in the present invention, wherein: according to the results of task energy saving and time extension, dynamic voltage scaling is performed on the basis of feasible task scheduling;
[0068] The comprehensive effect of energy saving and time extension is calculated based on the task energy saving and time extension, and the expression is:
[0069]
[0070] Where S(v, f) represents the combined effect of energy saving and time extension of the task at voltage v and frequency f;
[0071] The best comprehensive effect is selected as the dynamic voltage and frequency adjustment strategy, and its expression is:
[0072]
[0073] Among them, (v opt , f opt ) represents the optimal voltage and frequency combination, V represents the set of all possible voltage values, and F represents the set of all possible frequency values.
[0074] As a preferred solution of the heterogeneous multi-core energy-saving task scheduling method based on the improved genetic algorithm described in the present invention, wherein: a fitness function is defined to calculate the fitness of the current group and sort it;
[0075] First, it is necessary to evaluate the fitness of each individual in the group. The individual here represents a specific task scheduling strategy. The expression for evaluating individual fitness is:
[0076]
[0077] Where F(x) represents the fitness of individual x, T(x) represents the total execution time of the task scheduling scheme corresponding to individual x, Q(v(f), f) represents the energy consumption of the task under voltage v(f) and frequency f, dt is the time increment, σ represents the standard deviation of the individual execution time in the group, μ represents the average execution time of the individuals in the group, v(f) represents the voltage corresponding to frequency f, f is the frequency, and t is the time variable;
[0078] Then the group fitness is calculated, and its expression is:
[0079]
[0080] Among them, G(X) represents the fitness of group X, X represents the group, It represents the average value of the reciprocal of individual fitness in the group;
[0081] Finally, the group is sorted, and the expression is:
[0082] X sorted =sort(X,F(x));
[0083] Among them, X sorted represents a population sorted by fitness, and sort(X, F(x)) represents a function that sorts the population X according to the individual fitness F(x).
[0084] As a preferred solution of the heterogeneous multi-core energy-saving task scheduling method based on the improved genetic algorithm described in the present invention, the improved genetic algorithm is used to update the population information, and its expression is:
[0085]
[0086] Among them, H(x) represents the improved fitness function, T(x) represents the total time required for individual x to perform all tasks, -γ represents the energy consumption penalty coefficient, Q represents the energy consumption quality function, μ x represents the average execution time of individual x, σ x represents the standard deviation of the execution time of individual x, and dt represents a small increment of time;
[0087] Calculate the improved group fitness of the updated population, which is expressed as:
[0088]
[0089] in, represents the improved population fitness of the updated population, and P′ represents the updated population;
[0090] Determine the new task priority, the expression is:
[0091]
[0092] Among them, B(x) represents the new task priority, β represents the penalty coefficient for extending the time;
[0093] If the termination condition is met, exit, otherwise continue to iterate. The expression is:
[0094]
[0095] Among them, K indicates whether to continue iteration, C I Indicates the current iteration number, M I represents the maximum number of iterations, BS represents the current best solution, P R Indicates performance requirements.
[0096] In a second aspect, an embodiment of the present invention provides a computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: when the computer program is executed by the processor, any step of the heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm as described in the first aspect of the present invention is implemented.
[0097] In a third aspect, an embodiment of the present invention provides a computer-readable storage medium having a computer program stored thereon, wherein: when the computer program is executed by a processor, any step of the heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm as described in the first aspect of the present invention is implemented.
[0098] The beneficial effects of the present invention are as follows: by constructing a task dependency graph and applying an improved genetic algorithm, the dependency relationship between tasks is clarified, thereby improving the feasibility and efficiency of scheduling. By determining task priorities and partitioning strategies, the understanding space is effectively explored and understood, and tasks are reasonably allocated to different processors, thereby reducing communication delays. Determining the optimal scheduling sequence ensures that tasks are executed in the optimal order, thereby reducing waiting time. By calculating the energy saved and the extended time through the DVFS technology, energy consumption is minimized while ensuring task completion, thereby achieving a balance between energy saving and efficiency. These steps together ensure efficient and energy-saving task scheduling in a heterogeneous multi-core system. BRIEF DESCRIPTION OF THE DRAWINGS
[0099] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying creative work.
[0100] Figure 1 This is a flow chart of the heterogeneous multi-core energy-saving task scheduling method based on the improved genetic algorithm in Example 1.
[0101] Figure 2 The decision diagram for the population information entering the loop to find the best partitioning strategy in Example 1. DETAILED DESCRIPTION
[0102] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the specific implementation methods of the present invention are described in detail below in conjunction with the accompanying drawings.
[0103] In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention may also be implemented in other ways different from those described herein, and those skilled in the art may make similar generalizations without violating the connotation of the present invention. Therefore, the present invention is not limited to the specific embodiments disclosed below.
[0104] Secondly, the term "one embodiment" or "embodiment" as used herein refers to a specific feature, structure, or characteristic that may be included in at least one implementation of the present invention. The term "in one embodiment" that appears in different places in this specification does not necessarily refer to the same embodiment, nor does it refer to a separate or selective embodiment that is mutually exclusive with other embodiments.
[0105] Example 1, reference Figure 1 and Figure 2 , which is the first embodiment of the present invention, and provides a heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm, comprising the following steps:
[0106] S1. First, generate a DAG graph based on the currently ongoing task, and its expression is:
[0107] G = (V, E);
[0108] V={v 1 ,v 2 ,…,v n};
[0109] E={(v i ,v j )|v i ,v j ∈V and v i Must be in v j before completed};
[0110] Among them, G represents a DAG graph with n tasks, V represents a node set, E represents an edge set, and v n Indicates the last element in the V set and also indicates the number of tasks;
[0111] A one-dimensional bit string is selected to encode the task priority, and the encoding length is the number of task nodes in the task graph; each gene represents the scheduling priority of the corresponding task, and the value range is [0, n-1]. The lower the value, the higher the priority.
[0112] According to the number of tasks and the number of processors, the population size is determined, and its expression is:
[0113]
[0114] Among them, P represents the population size, n represents the number of tasks, and m represents the number of processors;
[0115] Initialize the population according to the population size P, and generate a corresponding number of individuals based on the number of individuals in the population. Each individual consists of a series of chromosomes, and each chromosome corresponds to the scheduling priority of a task. For each individual, a chromosome of length n is randomly generated, in which the value of each gene is randomly selected from [0, n-1] to ensure that the values are not repeated, so as to ensure that each task has a unique priority.
[0116] Once the population size P is determined, the population can be initialized according to this size. This means generating a corresponding number of individuals based on the number of individuals in the population, each of which represents a different task scheduling strategy. The initialization method is usually to randomly generate these individuals to ensure that they are evenly distributed in the solution space.
[0117] Evaluate the fitness of the initialized population and calculate the fitness value of each individual;
[0118] First, we need to calculate the energy consumption of an individual, which is expressed as:
[0119]
[0120] Where Z represents the total energy consumption of the individual scheduling scheme, N(j) represents the number of different voltage modes of processor j, P(j, k) represents the power consumption of processor j under voltage mode k, texe(v, j, k) represents the execution time of task v on processor j in voltage mode k, θ(v, j, k) represents the selection function, which is 1 when task v is assigned to processor j and executed in voltage mode k, otherwise it is 0, k represents the voltage mode, representing the kth voltage mode of the jth processor, m represents the number of processors, that is, how many processors there are in the system, n represents the number of tasks, that is, the total number of tasks in the task set, v represents the task, representing the vth task in the task set, j represents the processor, representing the jth processor;
[0121] The range of energy consumption E is determined by the power consumption of the processor and the task execution time, and the range of execution time T is determined by the task execution time plus the communication time.
[0122] Then calculate the individual execution time, the expression is:
[0123]
[0124] Where T represents the total execution time of the individual scheduling scheme, and tc represents the total communication time between tasks under the current division;
[0125] The range of execution time T is determined by the task execution time plus the communication time;
[0126] Finally, the fitness is obtained based on the energy consumption Z and execution time T, and its expression is:
[0127] F = α·Z + (1-α)·T;
[0128] Among them, F represents the fitness of the individual, α represents the weighting factor of energy consumption and execution time, and α is a weighting factor between 0 and 1, which is used to balance the relative importance of energy consumption and execution time. When α is larger, the system will pay more attention to reducing energy consumption; conversely, when α is smaller, the system will be more inclined to reduce execution time;
[0129] The range of the fitness value F depends on the range of the energy consumption E and the execution time T. Generally speaking, the larger the value of F, the worse the scheduling scheme of the individual, because it means higher energy consumption or longer execution time. Sort the population in ascending order according to the fitness value F, with the one with the lowest energy consumption at the front of the queue. Use the quick sort algorithm to sort the individuals in the population in ascending order according to the fitness value F, and complete the population information initialization.
[0130] S2. Select a part of individuals from the initialized population information as parents. According to the sorting results of the previous sorting, select Nsel / 2 individuals at the front of the queue as excellent individuals. Use a random algorithm to evenly generate Nsel / 2 individuals from the remaining individuals in the queue. Calculate the total execution value of the newly selected individuals, and use the newly selected Nsel individuals as the objects of crossover and mutation.
[0131] Crossover requires selecting one or more crossover points to split the gene sequence of the parent individuals. The crossover point can be a single point, multiple points, or uniform crossover. In the task scheduling problem, the crossover point can correspond to a position in the task list;
[0132] Randomly select one or more gene positions as the mutation positions. In the task scheduling problem, this is equivalent to randomly selecting one or several tasks for position change.
[0133] The expression for selecting some individuals as parents is:
[0134] S={T(N sel / 2),R(N sel / 2)};
[0135] Among them, S represents the set of selected parent individuals, T(Nsel / 2) represents selecting the top Nsel / 2 individuals from the population information, and R(Nsel / 2) represents randomly selecting Nsel / 2 individuals from the remaining individuals;
[0136] The selected individuals are subjected to crossover and mutation operations. The mutation operation randomly transforms a gene in the individual within the valid value range to randomly change the execution priority of the task. The expression is:
[0137] O=C(H 1 ,H 2 ,CH 1 ,CH 2 );
[0138] MG = RV (LB, UB);
[0139] Among them, O represents the offspring individual produced by crossover, H represents the parent individual used for crossover, CH represents the position of the crossover point, C represents the crossover operation, i.e., the crossover operator, MG represents the value after mutation, RV represents the mutation operation, i.e., the mutation operator, LB represents the minimum possible value of the gene, and UB represents the maximum possible value of the gene; the gene fragments of the two parent individuals after the crossover point are exchanged to generate two new offspring individuals.
[0140] For example, for the task scheduling problem, if the task orders of two parent individuals are [A, B, C, D, E] and [A, C, B, E, D] respectively, and the crossover point is at the second position, then the offspring after the crossover may be [A, B, C, E, D] and [A, C, B, D, E].
[0141] The value range of O is the set of individuals in the population. This value range represents the offspring individuals produced after the crossover operation and is used for subsequent mutation operations;
[0142] Change the value of the selected gene position. For the task scheduling problem, this means swapping the selected task with another randomly selected task.
[0143] For example, if the order of tasks before mutation is [A, B, C, D, E], and we choose the mutation position as the third task C, and randomly select another task E to swap with it, then the order of tasks after mutation becomes [A, B, E, D, C].
[0144] The value range of MG is [0, n-1], which represents the value range of the gene after mutation and is used to update the chromosome of the individual;
[0145] Update population information based on new individuals after crossover and mutation;
[0146] Calculate the scheduling energy consumption of the newly generated individual, and its expression is:
[0147]
[0148] Among them, E child represents the scheduling energy consumption of the newly generated individual, P irepresents the processor power consumption, t i represents the task execution time, E comm,i represents the communication energy consumption associated with the task;
[0149] The updated population information expression is:
[0150] U=A(C,P,E child ,E parent ,E avg ,σ);
[0151] Among them, U represents the updated population information, C represents the newly generated individual, P represents the parent individual, and E parent Indicates that E avg represents the average execution energy consumption of the group, and σ represents the standard deviation of the group energy consumption;
[0152] Check whether the loop meets the termination condition. If the termination condition is met, the current optimal task scheduling solution is output. The check formula expression is:
[0153]
[0154] Among them, K represents the Boolean value of whether to terminate, CC represents the check termination condition, CI represents the number of current iterations, MI represents the maximum number of iterations, BS represents the partitioning strategy, and PR represents the performance requirement.
[0155] The partition strategy represents the solution that performs best within a preset number of cycles or the solution that meets the preset performance requirements. For example, in a heterogeneous multi-core system with three tasks and two processors, the partition strategy BS may be as follows:
[0156] Task 1 is assigned to processor 1 and executed in voltage mode 1 and frequency configuration 1;
[0157] Task 2 is assigned to processor 2 and executed in voltage mode 2 and frequency configuration 2;
[0158] Task 3 is assigned to processor 1 and executed in voltage mode 3 and frequency configuration 3;
[0159] This partitioning strategy defines the processor allocation, voltage and frequency configuration, and execution order of each task, so that the overall performance and energy consumption of the system are optimal or near-optimal.
[0160] The value range of K is {True, False}. This value range indicates whether the termination condition is met and is used to decide whether to stop the iteration process;
[0161] The termination condition is to reach the predetermined number of iterations or find a solution that meets specific performance requirements. For example, if the predetermined number of iterations is 100, the iteration will automatically exit after 100 iterations, and the current optimal task scheduling solution will be output, or a solution that meets specific performance requirements. For example, the total energy consumption of the task is less than or equal to 50 units, and the task completion time is within 120 minutes. When the solution is iterated to meet the total energy consumption and completion time of the task, the iteration is terminated in advance. The above content gradually optimizes the task scheduling solution to achieve the purpose of saving energy and meeting the execution time limit.
[0162] S3. According to the task DAG graph and partitioning strategy, determine the scheduling order of tasks on the processor, which is expressed as:
[0163]
[0164] Among them, S represents the scheduling order, G represents the DAG graph, BS represents the partitioning strategy, π represents the order of task execution, Π represents the set of all possible scheduling orders, and T π represents the total execution time of the task when it is executed according to the scheduling order π, E π (t) represents the energy consumption of the task at time t when it is executed according to the scheduling order π, S ij represents the communication cost from task i to task j, D ij represents the dependency delay of task i on task j, T ij represents the execution time of task i on the processor.
[0165] This step can minimize energy consumption. Minimizing energy consumption by optimizing the scheduling order is very useful for energy-sensitive applications, such as mobile devices or embedded systems. Minimizing execution time. Minimizing execution time by optimizing the scheduling order can improve system throughput and responsiveness. Reducing communication overhead. Reducing communication overhead between tasks by optimizing the scheduling order is especially important for distributed systems. Managing dependencies. Efficiently handling dependencies between tasks by optimizing the scheduling order ensures that all tasks can be executed in the correct order.
[0166] Further, this step helps to design an efficient scheduling strategy that can achieve better task scheduling based on energy consumption, execution time, communication overhead, and dependencies. This can significantly improve the overall performance of the system, especially in resource-constrained environments.
[0167] S4. The linear approximation model in DVFS technology is selected as the relationship model between energy consumption and execution time, because the linear approximation model is widely used in DVFS applications and can provide good approximation results in most cases. The linear approximation model is easy to understand and calculate, and can well balance the relationship between energy consumption reduction and execution time increase.
[0168] The energy consumption of the computing task at different voltages and frequencies is expressed as:
[0169]
[0170] Where Q(v,f) represents the energy consumption of the task at voltage v and frequency f, T(v,f) represents the execution time of the task at voltage v and frequency f, and P(v,f) represents the power consumption of the task at voltage v and frequency f;
[0171] The execution time of the calculation task under a given voltage v and frequency f is expressed as:
[0172]
[0173] Where D(v, f) represents the execution time of the task at voltage v and frequency f, c(v, f) represents the computational complexity of the task at voltage v and frequency f, f represents the operating frequency of the processor, and τ(v, f) represents the clock cycle time of the task at voltage v and frequency f;
[0174] The energy saving of the task is expressed as:
[0175]
[0176] Among them, S E (v, f) represents the energy saving of the task at voltage v and frequency f, α represents the weight factor of energy consumption, where α represents the sensitivity of energy consumption to time, and dt represents the time increment;
[0177] The extended time of the task is expressed as:
[0178] S T (v,f) = -β·T(v,f);
[0179] Among them, S T (v, f) represents the extended time of the task at voltage v and frequency f, β represents the weight factor of the execution time, S T The higher it is, the shorter the execution time is, which is more beneficial to performance.
[0180] It is further explained that the above content helps to achieve efficient task scheduling when energy consumption and execution time need to be optimized.
[0181] S5. Perform dynamic voltage scaling based on feasible task scheduling according to the results of task energy saving and time extension;
[0182] The comprehensive effect of energy saving and time extension is calculated based on the task energy saving and time extension, and the expression is:
[0183]
[0184] Where S(v, f) represents the combined effect of energy saving and time extension of the task at voltage v and frequency f;
[0185] The value range of S(v,f) is a positive real number, representing the comprehensive effect of energy saving and time extension of the task at a given voltage and frequency. The larger the value, the better the comprehensive effect.
[0186] The best comprehensive effect is selected as the dynamic voltage and frequency adjustment strategy, and its expression is:
[0187]
[0188] Among them, (v opt , f opt ) represents the optimal voltage and frequency combination, V represents the set of all possible voltage values, and F represents the set of all possible frequency values.
[0189] Further explanation: this step effectively calculates the energy saving and time extension of the task under different voltage and frequency settings, and selects the optimal voltage and frequency combination, thereby achieving dynamic voltage scaling.
[0190] S6. Define a fitness function to calculate the current group fitness and sort it;
[0191] First, it is necessary to evaluate the fitness of each individual in the group. The individual here represents a specific task scheduling strategy. The expression for evaluating individual fitness is:
[0192]
[0193] Where F(x) represents the fitness of individual x, T(x) represents the total execution time of the task scheduling scheme corresponding to individual x, Q(v(f), f) represents the energy consumption of the task under voltage v(f) and frequency f, dt is the time increment, σ represents the standard deviation of the individual execution time in the group, μ represents the average execution time of the individuals in the group, v(f) represents the voltage corresponding to frequency f, f is the frequency, and t is the time variable;
[0194] The value range of F(X) is a positive real number, representing the fitness of individual x. The larger the value, the higher the fitness of the individual.
[0195] Then the group fitness is calculated, and its expression is:
[0196]
[0197] Among them, G(X) represents the fitness of group X, X represents the group, It represents the average value of the reciprocal of individual fitness in the group;
[0198] The value range of G(X) is a positive real number, representing the fitness of the group X. The larger the value, the better the overall fitness of the group.
[0199] Finally, the individuals in the group are sorted according to the fitness F(x) of each individual, and the expression is:
[0200] X sorted =sort(X,F(x));
[0201] Among them, X sorted represents a population sorted by fitness, and sort(X, F(x)) represents a function that sorts the population X according to the individual fitness F(x).
[0202] S7. The goal of the improved fitness function is to minimize the total energy consumption while keeping the task execution time close to the average value. The improved genetic algorithm is used to update the population information. Its expression is:
[0203]
[0204] Among them, H(x) represents the improved fitness function, T(x) represents the total time required for individual x to perform all tasks, -γ represents the energy consumption penalty coefficient, Q represents the energy consumption quality function, μ x represents the average execution time of individual x, σ x represents the standard deviation of the execution time of individual x, and dt represents a small increment of time;
[0205] The value range of H(x) is (0, ∞), and the smaller the value, the higher the fitness of the individual.
[0206] Calculate the average value of the inverse of the improved fitness of individuals in the group, which is expressed as:
[0207]
[0208] in, It represents the average value of the inverse of the improved fitness of individuals in the group, and |P′| represents the size of the updated population P′.
[0209] Calculate the improved group fitness of the updated population to evaluate the overall performance, which is expressed as:
[0210]
[0211] in, represents the improved population fitness of the updated population, and P′ represents the updated population;
[0212] The value range of is (0, ∞), and the smaller the value, the higher the overall fitness of the population.
[0213] Determine the new task priority, the expression is:
[0214]
[0215] Among them, B(x) represents the new task priority, β represents the penalty coefficient for extending the time;
[0216] The value range of B(x) is (0, ∞), and the smaller the value, the higher the individual fitness after the update.
[0217] If the termination condition is met, exit, otherwise continue to iterate. The expression is:
[0218]
[0219] Among them, K indicates whether to continue iteration, C I Indicates the current iteration number, M I represents the maximum number of iterations, B S represents the current best solution, P R Indicates performance requirements.
[0220] B S It means that through the iterative process of the genetic algorithm, the algorithm continuously explores different task scheduling schemes to find the optimal solution. In a heterogeneous multi-core system, there are three tasks and two processors. The optimal solution B S It might look like this:
[0221] Task 1 is assigned to processor 2 and executed in voltage mode 2 and frequency configuration 3.
[0222] Task 2 is assigned to processor 2 and executed in voltage mode 1 and frequency configuration 2.
[0223] Task 3 is assigned to processor 1 and executed in voltage mode 3 and frequency configuration 1.
[0224] Through the best solution B S The allocation makes the overall performance and energy consumption of the system optimal or close to optimal.
[0225] The value range of K is {True, False}. This value range indicates whether the termination condition is met and is used to decide whether to stop the iteration process;
[0226] If the current number of iterations CI is greater than or equal to the maximum number of iterations MI, the termination condition is met and the function K returns True;
[0227] If the current optimal solution BS meets the performance requirement PR, the termination condition is also met, and the function K returns True;
[0228] At the end of each iteration, the termination condition is judged. If K returns True, the algorithm stops iterating and outputs the current optimal solution BS as the final result; if K returns False, the algorithm continues to the next iteration. If neither of the above two conditions is met, the function K returns false, indicating that the algorithm should continue to iterate.
[0229] This embodiment also provides a computer device, which is suitable for the case of a heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm, including: a memory and a processor; the memory is used to store computer executable instructions, and the processor is used to execute computer executable instructions to implement the heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm as proposed in the above embodiment.
[0230] The computer device may be a terminal, and the computer device includes a processor, a memory, a communication interface, a display screen and an input device connected via a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The communication interface of the computer device is used to communicate with an external terminal in a wired or wireless manner, and the wireless manner can be achieved through WIFI, an operator network, NFC (near field communication) or other technologies. The display screen of the computer device may be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer device may be a touch layer covering the display screen, or a key, trackball or touchpad provided on the housing of the computer device, or an external keyboard, touchpad or mouse, etc.
[0231] The present embodiment also provides a storage medium on which a computer program is stored. When the program is executed by a processor, the heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm proposed in the above embodiment is implemented; the storage medium can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (Static Random Access Memory, referred to as SRAM), electrically erasable programmable read-only memory (Electrically Erasable Programmable Read-Only Memory, referred to as EEPROM), erasable programmable read-only memory (Erasable Programmable Read Only Memory, referred to as EPROM), programmable read-only memory (Programmable Red-Only Memory, referred to as PROM), read-only memory (Read-Only Memory, referred to as ROM), magnetic storage, flash memory, disk or optical disk.
[0232] In summary, the present invention clarifies the dependencies between tasks and improves the feasibility and efficiency of scheduling by constructing a task dependency graph and applying an improved genetic algorithm. By determining task priorities and partitioning strategies, the understanding space is effectively explored and tasks are reasonably allocated to different processors, reducing communication delays. Determining the optimal scheduling sequence ensures that tasks are executed in the optimal order, reducing waiting time. By calculating the energy saved and the extended time through the DVFS technology, energy consumption is minimized while ensuring task completion, achieving a balance between energy saving and efficiency. These steps together ensure efficient and energy-saving task scheduling in heterogeneous multi-core systems.
[0233] Example 2, referring to Table 1, is the second example of the present invention. To further verify the advancement of the present invention, experimental simulation data of a heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm is provided.
[0234] The experiment used a simulated environment and set up several groups of experimental data for comparison. The specific steps are as follows:
[0235] Experimental environment configuration:
[0236] The experiments are conducted on a server equipped with an Intel Xeon E5-2690 v4 CPU and 32GB RAM.
[0237] Use Python programming language and NumPy library for data processing and algorithm implementation.
[0238] The simulation environment used includes a set of heterogeneous multi-core processors, including 4 high-performance cores and 4 low-power cores.
[0239] Experimental data settings:
[0240] The task set contains 16 tasks, and there are dependencies between these tasks, forming a directed acyclic graph (DAG).
[0241] Each task has different computational requirements, communication requirements, and energy consumption characteristics.
[0242] The processor's voltage and frequency have different adjustable options to allow for dynamic voltage and frequency scaling (DVFS).
[0243] Population initialization:
[0244] The population size P is calculated to be 32 according to the formula.
[0245] 32 individuals are initialized, each of which represents a task scheduling strategy.
[0246] Fitness evaluation:
[0247] Calculate the energy consumption Z and execution time T for each individual, and then calculate the fitness F.
[0248] The formula F=α·Z+(1-α)·T is used, where α is set to 0.7 to emphasize the importance of energy consumption.
[0249] Genetic manipulation:
[0250] A portion of individuals are selected from the population as parents for crossover and mutation.
[0251] Crossover and mutation operations are performed to generate new individuals, and the fitness of these individuals is calculated.
[0252] Iteration process:
[0253] The experiment was carried out for 50 rounds of iterations, in each round the population was updated according to the fitness value and the best individual was selected.
[0254] After each round of iteration, the energy consumption and execution time of the optimal individual are recorded.
[0255] Termination conditions:
[0256] The experiment terminates when the number of iterations reaches 50 or the optimal individual meets the performance requirements.
[0257] Performance comparison:
[0258] The method of the present invention is compared with the traditional first-come-first-served (FCFS) scheduling strategy.
[0259] The performance of the two scheduling strategies in terms of energy consumption and execution time is recorded.
[0260] The details are shown in Table 1:
[0261]
[0262]
[0263] From the data in the above table, we can clearly see the advantages of the heterogeneous multi-core energy-saving task scheduling method of the present invention compared with the traditional FCFS scheduling strategy:
[0264] Energy consumption:
[0265] The energy consumption of the best solution of the present invention is 2000 joules, while the energy consumption of the best solution of the traditional FCFS is 2800 joules.
[0266] On average, the energy consumption of the solution of the present invention is also significantly lower than that of the FCFS solution.
[0267] This shows that the method of the present invention can significantly reduce energy consumption while maintaining a reasonable execution time.
[0268] Execution time:
[0269] The optimal solution execution time of the present invention is 250 seconds, while the optimal solution execution time of the traditional FCFS is 320 seconds.
[0270] Although the execution time increases, this increase is limited and the energy savings from reduced energy consumption more than make up for it.
[0271] Overall fitness:
[0272] The fitness of the best solution of the present invention is 2250, while the fitness of the best solution of the traditional FCFS is 3180.
[0273] Lower fitness means better performance, which shows that the method of the present invention not only performs well in energy consumption, but also has better overall performance.
[0274] In summary, the method of the present invention achieves the goal of significantly reducing energy consumption while ensuring task execution efficiency by utilizing an improved genetic algorithm for task scheduling. This method is particularly suitable for application scenarios that require a balance between energy consumption and performance, such as task management in mobile devices and embedded systems. By dynamically adjusting voltage and frequency, the present invention can effectively control energy consumption while ensuring that tasks are completed in a timely manner, thereby demonstrating better performance and energy-saving effects than existing technologies.
[0275] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solutions of the present invention may be modified or replaced by equivalents without departing from the spirit and scope of the technical solutions of the present invention, which should all be included in the scope of the claims of the present invention.
Claims
1. A heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm, characterized in that: include: Generate a task DAG graph based on the current task set and initialize population information; The population information after initialization enters the loop body and determines the task priority through the improved genetic algorithm to obtain the partitioning strategy; Determine the scheduling order of tasks on the processor based on the task DAG graph and partitioning strategy; Dynamic voltage and frequency scaling technology based on processors saves energy and prolongs the time of computing tasks; According to the relationship between task energy saving and extended time, dynamic voltage scaling is performed based on feasible task scheduling; Define a fitness function to calculate the current group fitness and sort it; An improved genetic algorithm is used to update the population information and determine the new task priority. If the termination condition is met, the algorithm exits, otherwise it continues to iterate.
2. The heterogeneous multi-core energy-saving task scheduling method based on improved genetic algorithm according to claim 1, characterized in that: Generate a DAG graph, whose expression is: G = (V, E); V={v1,v2,…,v n }; E={(v i ,v j )|v i ,v j ∈V and v i Must be in v j before completed}; Where G represents a DAG graph with n tasks, V represents the set of all tasks, E represents the edge set, and v n Represents the last task in the V set; Select a one-dimensional bit string form to encode the task priority, and the encoding length is the number of task nodes in the task graph; According to the number of tasks and the number of processors, the population size is determined, and its expression is: Among them, P represents the population size, n represents the number of tasks, and m represents the number of processors; Initialize the population according to the population size P, and generate a corresponding number of individuals based on the number of individuals in the population. Each individual consists of a series of chromosomes, and each chromosome corresponds to the scheduling priority of a task; Perform fitness evaluation on the initialized population and calculate the fitness value of each individual, including the following steps: Calculate the energy consumption of an individual, the expression is: Where Z represents the total energy consumption of the individual scheduling scheme, N(j) represents the number of different voltage modes of processor j, P(j, k) represents the power consumption of processor j in voltage mode k, texe(v, j, k) represents the execution time of task v on processor j in voltage mode k, θ(v, j, k) represents the selection function, k represents the voltage mode, m represents the number of processors, n represents the number of tasks, v represents the task, and j represents the processor; Calculate the execution time of an individual, the expression is: Where T represents the total execution time of the individual scheduling scheme, and tc represents the total communication time between tasks under the current division; The fitness is obtained based on the energy consumption Z and execution time T, and its expression is: F = α·Z + (1-α)·T; Among them, F represents the fitness of the individual, α represents the weighting factor of energy consumption and execution time; The population is sorted in ascending order according to the fitness value F, and the one with the lowest energy consumption is at the front of the queue. The quick sort algorithm is used to sort the individuals in the population in ascending order according to the fitness value F to complete the population information initialization.
3. The heterogeneous multi-core energy-saving task scheduling method based on improved genetic algorithm according to claim 2, characterized in that: Select a part of individuals as parents from the initialized population information, and its expression is: S ={T(N sel / 2),R(N sel / 2)}; Among them, S represents the set of selected parent individuals, T(Nsel / 2) represents selecting the top Nsel / 2 individuals from the population information, and R(Nsel / 2) represents randomly selecting Nsel / 2 individuals from the remaining individuals; The selected individuals are subjected to crossover and mutation operations. The mutation operation randomly transforms a gene in the individual within the valid value range to randomly change the execution priority of the task. The expression is: O=C(H1,H2,CH1,CH2); MG = RV (LB, UB); Among them, O represents the offspring individual produced by crossover, H represents the parent individual used for crossover, CH represents the position of the crossover point, C represents the crossover operation, MG represents the value after mutation, RV represents the mutation operation, LB represents the minimum possible value of the gene, and UB represents the maximum possible value of the gene; Update population information based on new individuals after crossover and mutation; Calculate the scheduling energy consumption of the newly generated individual, and its expression is: Among them, E child represents the scheduling energy consumption of the newly generated individual, P i represents the processor power consumption, t i represents the task execution time, E comm,i represents the communication energy consumption associated with the task; The updated population information expression is: U=A(C,P,E child ,AND parent ,AND avg ,σ); Among them, U represents the updated population information, C represents the newly generated individual, P represents the parent individual, and E parent Indicates that E avg represents the average execution energy consumption of the group, and σ represents the standard deviation of the group energy consumption; Check whether the loop meets the termination condition. If the termination condition is met, the current optimal task scheduling solution is output. The check formula expression is: Among them, K represents the Boolean value of whether to terminate, CC represents the check termination condition, CI represents the number of current iterations, MI represents the maximum number of iterations, BS represents the partitioning strategy, and PR represents the performance requirement.
4. The heterogeneous multi-core energy-saving task scheduling method based on improved genetic algorithm according to claim 3, characterized in that: According to the task DAG graph and partitioning strategy, the scheduling order of tasks on the processor is determined, and its expression is: Among them, S represents the scheduling order, G represents the DAG graph, BS represents the partitioning strategy, π represents the order of task execution, Π represents the set of all possible scheduling orders, and T π represents the total execution time of the task when it is executed according to the scheduling order π, E π (t) represents the energy consumption of the task at time t when it is executed according to the scheduling order π, S ij represents the communication cost from task i to task j, D ij represents the dependency delay of task i on task j, T ij represents the execution time of task i on the processor.
5. The heterogeneous multi-core energy-saving task scheduling method based on improved genetic algorithm according to claim 4, characterized in that: The linear approximation model in DVFS technology is selected as the relationship model between energy consumption and execution time. The energy consumption of the task under different voltages and frequencies is calculated. The expression is: Where Q(v,f) represents the energy consumption of the task at voltage v and frequency f, T(v,f) represents the execution time of the task at voltage v and frequency f, and P(v,f) represents the power consumption of the task at voltage v and frequency f; The execution time of the calculation task under a given voltage v and frequency f is expressed as: Where D(v, f) represents the execution time of the task at voltage v and frequency f, c(v, f) represents the computational complexity of the task at voltage v and frequency f, f represents the operating frequency of the processor, and τ(v, f) represents the clock cycle time of the task at voltage v and frequency f; The energy saving of the task is expressed as: Among them, S E (v, f) represents the energy saving of the task at voltage v and frequency f, α represents the weight factor of energy consumption, and dt represents the time increment; The extended time of the task is expressed as: S T (v,f)=-β·T(v,f); Among them, S T (v, f) represents the extended time of the task at voltage v and frequency f, and β represents the weight factor of the execution time.
6. The heterogeneous multi-core energy-saving task scheduling method based on improved genetic algorithm according to claim 5, characterized in that: Dynamic voltage scaling is performed based on feasible task scheduling according to the results of task energy saving and time extension; The comprehensive effect of energy saving and time extension is calculated based on the task energy saving and time extension, and the expression is: Where S(v, f) represents the combined effect of energy saving and time extension of the task at voltage v and frequency f; The best comprehensive effect is selected as the dynamic voltage and frequency adjustment strategy, and its expression is: Among them, (v opt , f opt ) represents the optimal voltage and frequency combination, V represents the set of all possible voltage values, and F represents the set of all possible frequency values.
7. The heterogeneous multi-core energy-saving task scheduling method based on improved genetic algorithm according to claim 6, characterized in that: Define a fitness function to calculate the current group fitness and sort it; First, it is necessary to evaluate the fitness of each individual in the group. The individual here represents a specific task scheduling strategy. The expression for evaluating individual fitness is: Where F(x) represents the fitness of individual x, T(x) represents the total execution time of the task scheduling scheme corresponding to individual x, Q(v(f), f) represents the energy consumption of the task under voltage v(f) and frequency f, dt is the time increment, σ represents the standard deviation of the individual execution time in the group, μ represents the average execution time of the individuals in the group, v(f) represents the voltage corresponding to frequency f, f is the frequency, and t is the time variable; Then the group fitness is calculated, and its expression is: Among them, G(X) represents the fitness of group X, X represents the group, It represents the average value of the reciprocal of individual fitness in the group; Finally, the group is sorted, and the expression is: X sorted =sort(X,F(x)); Among them, X sorted represents a population sorted by fitness, and sort(X, F(x)) represents a function that sorts the population X according to the individual fitness F(x).
8. The heterogeneous multi-core energy-saving task scheduling method based on improved genetic algorithm according to claim 7, characterized in that: The improved genetic algorithm is used to update the population information, and its expression is: Among them, H(x) represents the improved fitness function, T(x) represents the total time required for individual x to perform all tasks, -γ represents the energy consumption penalty coefficient, Q represents the energy consumption quality function, μ x represents the average execution time of individual x, σ x represents the standard deviation of the execution time of individual x, and dt represents a small increment of time; Calculate the improved group fitness of the updated population, which is expressed as: in, represents the improved population fitness of the updated population, and P′ represents the updated population; Determine the new task priority, the expression is: Among them, B(x) represents the new task priority, β represents the penalty coefficient for extending the time; If the termination condition is met, exit, otherwise continue to iterate. The expression is: Among them, K indicates whether to continue iteration, C I Indicates the current number of iterations, M I represents the maximum number of iterations, B S represents the current best solution, P R Indicates performance requirements.
9. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the heterogeneous multi-core energy-saving task scheduling method based on an improved genetic algorithm according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Heterogeneous multi-core energy-saving task schedule method based on improved genetic algorithm
CN102508708A
NSGA2-based processor power consumption perception scheduling method with deadline constraint
CN109753137A
Heterogeneous multi-core processor task allocation and scheduling strategy based on genetic algorithm
CN111061569A
Joint task execution method and system based on end-side resource scheduling
CN114168353A
Multi-target task unloading method based on unmanned aerial vehicle
CN118227331A
Cited By
Cyclic feedback scheduling method and system for energy-limited parallel application
CN119557106A
Distributed heterogeneous task scheduling method and system based on evolutionary algorithm
CN119987975A