CN110780985A - Parallel task scheduling method and device with limited time - Google Patents

Parallel task scheduling method and device with limited time Download PDF

Info

Publication number
CN110780985A
CN110780985A CN201910924541.6A CN201910924541A CN110780985A CN 110780985 A CN110780985 A CN 110780985A CN 201910924541 A CN201910924541 A CN 201910924541A CN 110780985 A CN110780985 A CN 110780985A
Authority
CN
China
Prior art keywords
task
slave processor
task allocation
combination
scheduling
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
CN201910924541.6A
Other languages
Chinese (zh)
Inventor
张源
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Suzhou Wave Intelligent Technology Co Ltd
Original Assignee
Suzhou Wave Intelligent Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Suzhou Wave Intelligent Technology Co Ltd filed Critical Suzhou Wave Intelligent Technology Co Ltd
Priority to CN201910924541.6A priority Critical patent/CN110780985A/en
Publication of CN110780985A publication Critical patent/CN110780985A/en
Withdrawn legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/48Program initiating; Program switching, e.g. by interrupt
    • G06F9/4806Task transfer initiation or dispatching
    • G06F9/4843Task transfer initiation or dispatching by program, e.g. task dispatcher, supervisor, operating system
    • G06F9/4881Scheduling strategies for dispatcher, e.g. round robin, multi-level priority queues
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5027Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals
    • G06F9/5038Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resource being a machine, e.g. CPUs, Servers, Terminals considering the execution order of a plurality of tasks, e.g. taking priority or time dependency constraints into consideration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5061Partitioning or combining of resources
    • G06F9/5066Algorithms for mapping a plurality of inter-dependent sub-tasks onto a plurality of physical CPUs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/12Computing arrangements based on biological models using genetic models
    • G06N3/126Evolutionary algorithms, e.g. genetic algorithms or genetic programming

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Health & Medical Sciences (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Biophysics (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Evolutionary Biology (AREA)
  • Physiology (AREA)
  • Genetics & Genomics (AREA)
  • Artificial Intelligence (AREA)
  • Biomedical Technology (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Evolutionary Computation (AREA)
  • General Health & Medical Sciences (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention discloses a parallel task scheduling method and a parallel task scheduling device with limited time, wherein the method comprises the following steps: generating a task allocation mode for splitting the task into a plurality of subtasks with the same number as that of the slave processors, and generating a slave processor scheduling mode corresponding to the task allocation mode based on the task allocation mode; performing cross and variation processing for a plurality of times of iteration aiming at the combination of the task allocation mode and the slave processor scheduling mode by using a genetic algorithm to generate a new combination of the task allocation mode and the slave processor scheduling mode; the task completion times of the combinations of the plurality of task allocation manners and the slave processor scheduling manners are calculated respectively, and the tasks are scheduled by using the combination of the task allocation manner with the minimum task completion time and the slave processor scheduling manner. The invention can execute the parallel task scheduling based on the time window model, optimize the scheduling execution speed and efficiency and further improve the product quality.

Description

Parallel task scheduling method and device with limited time
Technical Field
The present invention relates to the field of task scheduling, and more particularly, to a method and an apparatus for scheduling parallel tasks within a limited time.
Background
A complete Web software project is provided with a layer of strict functional logic and task scheduling code implementation below a UI layer, so that under the condition of multi-task concurrency, how to execute each task orderly and efficiently is a very outstanding problem, and the length of the task execution time even directly influences the market competitiveness of a product. Generally, the scheduling problem assumes a set of resources and a set of consumers served by these resources according to a particular policy. The nature of consumers and resources, and their limitations, affect the search of effective strategies for managing the manner in which consumers access and use resources to optimize certain desired performance indicators.
For a heterogeneous multiprocessor system, the instruction sets are different between cores, and there are differences in performance and structure. Each processor core of the heterogeneous multiprocessor system is heterogeneous, so that tasks need to be divided firstly, the tasks are distributed to each processor core, and then the task queues distributed to each processor core are scheduled. After the tasks are divided, the scheduling strategy of the tasks is similar to that of the single processor to a certain extent, and the tasks can be scheduled by multiple processors by using some research results of the single processor for reference, but the task scheduling difficulty of the multiple processors is greatly increased due to the relevance among the tasks. In recent years, due to the widespread use of multiple processors, how to fully utilize the computing performance of multiple processors becomes a focus of academic attention, and the task scheduling problem of multiple processors becomes more and more prominent.
Aiming at the problem that an effective and efficient parallel task scheduling method is lacked in the prior art, no effective solution is available at present.
Disclosure of Invention
In view of this, an object of the embodiments of the present invention is to provide a method and an apparatus for scheduling parallel tasks with limited time, which can execute parallel task scheduling based on a time window model, optimize scheduling execution speed and efficiency, and further improve product quality.
Based on the above object, a first aspect of the embodiments of the present invention provides a method for scheduling parallel tasks in a limited time, including the following steps:
generating a task allocation mode for splitting the task into a plurality of subtasks with the same number as that of the slave processors, and generating a slave processor scheduling mode corresponding to the task allocation mode based on the task allocation mode;
performing cross and variation processing for a plurality of times of iteration aiming at the combination of the task allocation mode and the slave processor scheduling mode by using a genetic algorithm to generate a new combination of the task allocation mode and the slave processor scheduling mode;
the task completion times of the combinations of the plurality of task allocation manners and the slave processor scheduling manners are calculated respectively, and the tasks are scheduled by using the combination of the task allocation manner with the minimum task completion time and the slave processor scheduling manner.
In some embodiments, the task allocation comprises splitting the task into a number of sub-tasks equal to the number of slave processors; the processor scheduling mode includes establishing a one-to-one correspondence between the plurality of subtasks and the plurality of slave processors.
In some embodiments, performing the intersection and mutation process for a plurality of iterations using a genetic algorithm for a combination of the task assignment pattern and the slave processor scheduling pattern to generate a combination of a new task assignment pattern and the slave processor scheduling pattern comprises:
determining genetic algorithm parameters and performing the following steps in a loop according to the genetic algorithm parameters:
performing cross-point-based gene exchange between different task allocation modes according to genetic algorithm parameters to generate a combination of a new task allocation mode and a slave processor scheduling mode;
performing a variation point-based gene exchange on the combination of the task allocation mode and the slave processor scheduling mode according to the genetic algorithm parameters to generate a combination of a new task allocation mode and the slave processor scheduling mode;
and calculating adaptive values of a plurality of new combinations of the task allocation modes and the slave processor scheduling modes respectively, and reserving the combination of the task allocation mode with a higher adaptive value and the slave processor scheduling mode to the next cycle.
In some embodiments, further comprising: when cross-point-based gene swapping is performed between different task allocation manners according to genetic algorithm parameters, normalization processing is performed on swapped genes so that respective task amounts of the different task allocation manners remain unchanged.
In some embodiments, genetic algorithm parameters include genetic algebra, population size, crossover probability, mutation probability;
the loop execution according to the genetic algorithm parameters comprises: performing genetic algebra circularly or reaching the population scale;
performing crossover-based gene swapping between different task allocation patterns according to genetic algorithm parameters includes: performing cross-point based gene swapping according to the cross probability;
performing a mutation point-based gene exchange on a combination of a task allocation manner and a slave processor scheduling manner according to genetic algorithm parameters includes: performing mutation point-based gene exchange according to the mutation probability.
In some embodiments, the crossover-based gene exchange comprises: randomly determining two cross points and exchanging genes of different task allocation modes within a range limited by the two cross points;
the mutation point-based gene exchange includes: randomly determining two variation points and exchanging the combined genes of the task distribution mode and the slave processor scheduling mode on the two variation points.
In some embodiments, calculating the adaptive values for the combination of the plurality of new task assignment patterns and the slave processor scheduling patterns, respectively, comprises:
respectively calculating the subtask completion time of each slave processor in the combination of the plurality of new task allocation modes and the slave processor scheduling modes;
respectively taking the maximum value of the subtask completion time of the slave processor in the combination of the plurality of new task allocation modes and the slave processor scheduling modes to obtain the task completion time of the combination of the plurality of new task allocation modes and the slave processor scheduling modes;
and determining the reciprocal of the task completion time of the combination of the plurality of new task allocation modes and the slave processor scheduling modes as the adaptive value of the combination of the plurality of new task allocation modes and the slave processor scheduling modes.
In some embodiments, the retaining the combination of the task allocation mode with the higher adaptation value and the slave processor scheduling mode into the next cycle comprises: and randomly determining one or more combinations of the task allocation modes and the slave processor scheduling modes to be reserved in the next cycle by taking the adaptive value as the accumulated probability in the combinations of the new task allocation modes and the slave processor scheduling modes.
In some embodiments, separately calculating the subtask completion time of each slave processor in the combination of the plurality of new task allocation patterns and the slave processor scheduling patterns comprises:
determining the sum of the task receiving starting time of the front subtask of the slave processor, the transmission starting cost of the front subtask and the task transmission time of the front subtask as the task receiving completion time of the front subtask;
taking the maximum value of the release time of the subtask of the slave processor and the task reception completion time of the front subtask as the task reception start time of the subtask of the slave processor;
and determining the sum of the task receiving starting time of the subtask of the slave processor, the transmission starting cost of the subtask, the calculation starting cost of the subtask and the task calculation time of the subtask as the subtask completion time.
A second aspect of an embodiment of the present invention provides a parallel task scheduling apparatus with limited time, including:
a processor; and
a memory storing program code executable by the processor, the program code, when executed, performing the above-described method.
The invention has the following beneficial technical effects: according to the parallel task scheduling method and device with limited time, the task is divided into a plurality of subtasks with the same number as that of the slave processors by generating a task allocation mode, and the slave processor scheduling mode corresponding to the task allocation mode is generated based on the task allocation mode; performing cross and variation processing for a plurality of times of iteration aiming at the combination of the task allocation mode and the slave processor scheduling mode by using a genetic algorithm to generate a new combination of the task allocation mode and the slave processor scheduling mode; the technical scheme of respectively calculating the task completion time of the combination of the plurality of task allocation modes and the slave processor scheduling modes and scheduling the tasks by using the combination of the task allocation mode with the minimum task completion time and the slave processor scheduling mode can execute the parallel task scheduling based on the time window model, optimize the scheduling execution speed and efficiency and further improve the product quality.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a schematic flow chart of a limited-time parallel task scheduling method provided by the present invention;
FIG. 2 is a schematic diagram of a connection relationship between slave processors according to the method for scheduling parallel tasks with limited time provided by the present invention;
fig. 3 is a bar diagram illustrating slave processor subtask execution time in the method for scheduling a parallel task with limited time according to the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention are described in further detail with reference to the accompanying drawings.
It should be noted that all expressions using "first" and "second" in the embodiments of the present invention are used for distinguishing two entities with the same name but different names or different parameters, and it should be noted that "first" and "second" are merely for convenience of description and should not be construed as limitations of the embodiments of the present invention, and they are not described in any more detail in the following embodiments.
In view of the above, a first aspect of the embodiments of the present invention proposes an embodiment of a method capable of performing parallel task scheduling based on a time window model. Fig. 1 is a flow chart illustrating a limited-time parallel task scheduling method provided by the present invention.
The method for scheduling parallel tasks in a limited time, as shown in fig. 1, includes the following steps:
step S101: generating a task allocation mode for splitting the task into a plurality of subtasks with the same number as that of the slave processors, and generating a slave processor scheduling mode corresponding to the task allocation mode based on the task allocation mode;
step S103: performing cross and variation processing for a plurality of times of iteration aiming at the combination of the task allocation mode and the slave processor scheduling mode by using a genetic algorithm to generate a new combination of the task allocation mode and the slave processor scheduling mode;
step S105: the task completion times of the combinations of the plurality of task allocation manners and the slave processor scheduling manners are calculated respectively, and the tasks are scheduled by using the combination of the task allocation manner with the minimum task completion time and the slave processor scheduling manner.
The invention mainly aims at the problem of parallel subtask scheduling with time window constraint in a computer Web project, and aims to minimize the completion time of a total task. The invention finds out the optimal task allocation scheme by using different processor scheduling sequences, finding out an optimal solution in the different processor scheduling sequences and respectively changing the task amount allocated to each slave processor. Firstly, explaining the concept of an available time window of a processor, establishing a clear task scheduling model, and designing a global optimization scheme to solve the model based on a genetic algorithm; the scheduling sequence of the slave processors and the task amount distributed on each slave processor are coded simultaneously, iterative optimization is carried out by using two different crossover operators, and then the individuals are randomly changed through mutation operation. In addition, two reasonable optimization schemes are proposed and designed: the processing does not satisfy the correction operator constrained by the time window available from the processor, and the local search operator is introduced to speed up the convergence speed of the algorithm.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), a Random Access Memory (RAM), or the like. Embodiments of the computer program may achieve the same or similar effects as any of the preceding method embodiments to which it corresponds.
In some embodiments, the task allocation comprises splitting the task into a number of sub-tasks equal to the number of slave processors; the processor scheduling mode includes establishing a one-to-one correspondence between the plurality of subtasks and the plurality of slave processors.
In some embodiments, performing the crossover and mutation processes for a combination of the task allocation pattern and the slave processor scheduling pattern for a plurality of iterations using a genetic algorithm to generate a combination of a new task allocation pattern and the slave processor scheduling pattern includes determining genetic algorithm parameters and performing the following steps in a loop based on the genetic algorithm parameters:
performing cross-point-based gene exchange between different task allocation modes according to genetic algorithm parameters to generate a combination of a new task allocation mode and a slave processor scheduling mode;
performing a variation point-based gene exchange on the combination of the task allocation mode and the slave processor scheduling mode according to the genetic algorithm parameters to generate a combination of a new task allocation mode and the slave processor scheduling mode;
and calculating adaptive values of a plurality of new combinations of the task allocation modes and the slave processor scheduling modes respectively, and reserving the combination of the task allocation mode with a higher adaptive value and the slave processor scheduling mode to the next cycle.
In some embodiments, when cross-point-based gene swapping is performed between different task allocation patterns according to genetic algorithm parameters, normalization processing is also performed on the swapped genes so that the respective task amounts of the different task allocation patterns remain unchanged.
In some embodiments, genetic algorithm parameters include genetic algebra, population size, crossover probability, mutation probability; performing in a loop according to the genetic algorithm parameters, including performing genetic algebra in a loop or achieving population size; performing crossover point-based gene swapping between different task allocation patterns according to genetic algorithm parameters includes performing crossover point-based gene swapping according to crossover probability; performing a mutation point-based gene exchange on a combination of the task allocation pattern and the slave processor scheduling pattern according to the genetic algorithm parameters includes performing a mutation point-based gene exchange according to a mutation probability.
In some embodiments, crossover-based gene swapping comprises randomly determining two crossover points and swapping genes of different assignment patterns within the range defined by the two crossover points; the mutation point-based gene exchange includes randomly determining two mutation points and exchanging genes of a combination of a task allocation pattern and a slave processor scheduling pattern at the two mutation points.
In some embodiments, calculating the adaptive values for the combination of the plurality of new task assignment patterns and the slave processor scheduling patterns, respectively, comprises:
respectively calculating the subtask completion time of each slave processor in the combination of the plurality of new task allocation modes and the slave processor scheduling modes;
respectively taking the maximum value of the subtask completion time of the slave processor in the combination of the plurality of new task allocation modes and the slave processor scheduling modes to obtain the task completion time of the combination of the plurality of new task allocation modes and the slave processor scheduling modes;
and determining the reciprocal of the task completion time of the combination of the plurality of new task allocation modes and the slave processor scheduling modes as the adaptive value of the combination of the plurality of new task allocation modes and the slave processor scheduling modes.
In some embodiments, the retaining the combination of the task allocation mode with the higher adaptation value and the slave processor scheduling mode into the next cycle comprises: and randomly determining one or more combinations of the task allocation modes and the slave processor scheduling modes to be reserved in the next cycle by taking the adaptive value as the accumulated probability in the combinations of the new task allocation modes and the slave processor scheduling modes.
In some embodiments, separately calculating the subtask completion time of each slave processor in the combination of the plurality of new task allocation patterns and the slave processor scheduling patterns comprises:
determining the sum of the task receiving starting time of the front subtask of the slave processor, the transmission starting cost of the front subtask and the task transmission time of the front subtask as the task receiving completion time of the front subtask;
taking the maximum value of the release time of the subtask of the slave processor and the task reception completion time of the front subtask as the task reception start time of the subtask of the slave processor;
and determining the sum of the task receiving starting time of the subtask of the slave processor, the transmission starting cost of the subtask, the calculation starting cost of the subtask and the task calculation time of the subtask as the subtask completion time.
The method disclosed according to an embodiment of the present invention may also be implemented as a computer program executed by a CPU, which may be stored in a computer-readable storage medium. The computer program, when executed by the CPU, performs the above-described functions defined in the method disclosed in the embodiments of the present invention. The above-described method steps and system elements may also be implemented using a controller and a computer-readable storage medium for storing a computer program for causing the controller to implement the functions of the above-described steps or elements.
The following further illustrates embodiments of the invention in terms of specific examples.
In the dispatching process of the separable tasks, the tasks to be completed are divided into a plurality of subtasks and are respectively transmitted to the slave processors, and each processor executes one subtask respectively. It is noted that when a new task arrives, not all the processors are idle, and there may be processors that are processing the previous task, and therefore it may be necessary to wait for the processors to complete the task that is being computed before they can receive and process the new task, and we refer to this waiting time as the release time of the processors. Any handler will go offline when it has finished processing a task and no new task arrives. The time interval between the handler release time and the down time, we refer to as the availability time of the handler. When allocating tasks to each processor, the available time of the processor should be fully considered, because it not only determines how much the processor allocates the amount of tasks, but also determines the scheduling order of each processor, and finally affects the completion time of the total tasks.
The task scheduling system may be represented simply as a master processor and n slave processors in fig. 2, with the processors connected by a communication link.
Host processor P 0The task is not involved in the calculation of the task, and is only responsible for distributing the task to the slave processing machine through the communication link. First, the overall task W totalIs divided into n subtasks, where the subtasks are denoted as a ═ a 1,a 2,a 3,…,a n}. Wherein each subtask is not 0 and is smaller than W totalThe sum of all subtasks equals W total. Then, P 0And respectively transmitting each subtask to the slave processors according to a certain sequence, receiving one subtask by each processor, and after the slave processors receive the tasks, concurrently calculating the tasks until all the subtasks are calculated.
Recording the transmission starting overhead as e, calculating the starting overhead as f, the release time as r (waiting time of the sub-processor from a non-idle state to an idle state), and the offline time as o. In addition, in the heterogeneous system, the time ratio of the same task calculated by the slave processor to the standard processor is denoted by ω, and the time ratio of the same task transmitted by the communication link to the standard link is denoted by g. It is possible to obtain an operation of the slave processor at different times as shown in fig. 3.
Consider the startup overhead, so the total task a iThe transmission and calculation time are respectively as follows: e.g. of the type i+g ia i、f iia iLet s be the time from the start of the task received by the processor, s for the first processor 1=r 1For the 2 nd to nth processors, the analysis may result in: if the release time of the slave processor is greater than the task reception completion time of the slave processor which has received the last task, s i=r iOtherwise, the time for receiving the task from the processorIs the task reception completion time of the last processor, i.e.
s i=max{r i,s i-1+e i-1+g i-1a i-1}
The single slave processor processes the task time as
T i=s i+e i+f iia i
Obviously, the completion time of the total task, i.e., the task completion time of the slave processor whose task completion time is the latest among all the slave processors, i.e., T ═ max { T { (T) i(i ═ 1,2,3, …, n). Therefore, it is not only easy to use
T=max{s i+e i+f iia i}(i=1,2,3,…,n)
Based on the research content herein and the problems described previously, a new separable task scheduling model based on genetic algorithms is established that considers the processor available time window.
Figure BDA0002218513870000101
Wherein A ═ { a ═ a 1,a 2,…,a nIs a task allocation scheme; σ ═ σ [ σ ] 12,…,σ nIs a scheduling order of the slave processors and satisfies
Figure BDA0002218513870000102
If j ≠ k, then σ j≠σ k;0≤a i≤W total;a 1+a 2+…+a n=W total;s i=max{r i,s i-1+e i-1+g i-1a i-1}。
One specific implementation of the embodiment of the invention is as follows:
1. initialization
Initializing a genetic algebra t to be 0, wherein the total genetic algebra to be evolved is 60000; randomly generating an initial population of 100 individuals, with the population size popsize being 100; cross deviceRate p c0.6; probability of variation p m0.02; and finally, setting parameters of the processor.
2. Task completion time and calculation of adaptive value
And setting the adaptive value of the individual as the reciprocal of the task completion time, firstly calculating the time for each slave processor in each individual to complete the task, solving the maximum value of the time as the time for the individual to complete the task, and finally, taking the reciprocal of the task completion time of each individual as the adaptive value. The fitness of each individual is the inverse of its task completion time. Namely, it is
T i=s i+e i+f iia i
T=max{T i}(i=1,2,3…,n)
Fit=1/T
3. Selecting
And calculating the sum of the adaptive values. And then, the proportion of each adaptive value to the sum of the adaptive values is obtained. A series of operations are performed according to this ratio, thereby selecting excellent individuals in the population. The method comprises the following specific steps:
(1) and calculating the individual fitness.
(2) Calculating the cumulative probability of each individual, for example, as follows:
assuming that there are four individuals, the fitness degrees are 0.1 respectively; 0.2; 0.3; 0.4
Their cumulative probabilities are respectively
0.1/(0.1+0.2+0.3+0.4);
(0.1+0.2)/(0.1+0.2+0.3+0.4);
(0.1+0.2+0.3)/(0.1+0.2+0.3+0.4);
(0.1+0.2+0.3+0.4)/(0.1+0.2+0.3+0.4)
Namely 0.1; 0.3; 0.6; 1.
(3) and generating a random number r with uniform distribution in the interval of [0,1 ].
(4) And determining whether the individual is selected according to r and the accumulated probability.
If r <0.1, selecting individual 1;
if 0.1< r <0.3, selecting individual 2;
if 0.3< r <0.6, selecting individual 3;
if 0.6< r <1, individual 4 is selected.
(5) And repeating the above operations.
4. Crossover and mutation
First, two different random integers p, q are generated, with p 1 ≦ and q ≦ n, with p, q as the crossover point. Handle A 1、A 2Gene exchange between p and q. It is noted that since the total task volume of each different task assignment scheme is constant, a after the swap 1、A 2The sum of the genes, i.e.the total task size, may be changed, so that this time a step is added, before the exchange A 1、A 2The genes in the crossover region are scaled up or down, e.g. A 1The sum of the task amounts of the switching areas is x, A 2If the sum of the task amount of the switching area is y, A is added 1Multiplying each gene in the crossover region by y/x, adding A 2Each gene in the crossover region is multiplied by x/y, and A is ensured by this method 1,A 2The total task volume is unchanged. Such as (assuming p-3, q-5):
A 1=(0.1,0.2,0.2,0.1,0.2,0.1,0.1)
A 2=(0.3,0.1,0.1,0.1,0.1,0.2,0.1)
then (0.2,0.1,0.2) × (0.1+0.1+0.1)/(0.2+0.1+0.2) is first calculated
And (0.1,0.1,0.1) × (0.2+0.1+0.2)/(0.1+0.1+0.1)
Then, carrying out exchange, and after the exchange operation:
A 1=(0.1,0.2,0.167,0.167,0.167,0.1,0.1)
A 2=(0.3,0.1,0.12,0.06,0.12,0.2,0.1)
it can be seen that A 1、A 2The sum of the data of (1) is still 1, but the proportional relationship between the genes in the crossover region has been interchanged. The two individuals enter a new population of the next generation to continue reproduction, are born in the previous generation of individuals but are different from the previous generation of individuals, accord with the parent-child genetic law in nature, and wait for the offspring to be more and more adapted to the ring in the later period of multi-generation inheritanceAnd optimizing the task allocation scheme.
In order to increase the diversity of the generated offspring solutions in the algorithm, mutation operators are designed, and different from crossover operators, only one mutation operator is needed. First, a parent I is given 1=(σ 1,A 1) Then, 2 different integers p and q are randomly generated, wherein p is more than or equal to 1, and q is more than or equal to n, and p and q are used as variation points. Handle A 1、σ 1Gene exchange at both p and q. I.e. for A 1In other words, the task volumes of the pth and qth subtasks are swapped for σ 1In other words, the execution order of the pth and qth slave processors is swapped. Such as (p ═ 2, q ═ 6):
A 1=(0.1,0.2,0.2,0.1,0.2,0.1,0.1)
σ 1=(4,2,1,3,6,5,7)
after mutation operation
A 1=(0.1,0.1,0.2,0.1,0.2,0.2,0.1)
σ 1=(4,5,1,3,6,2,7)
Then generation of progeny individuals through mutation is completed.
Every two parent individuals form a group, a number between 0 and 1 is randomly generated, and if the number is smaller than the cross probability, the two individuals are crossed according to a cross operator. And similarly, calculating whether the individual needs to be mutated or not according to the mutation probability.
5. Correction
The algorithm can obtain the optimal solution, but has a very obvious defect. If a slave processor is allocated too many tasks and the processing completion time is longer than the offline time of the slave processor, the constraint of the time window required in the title is not satisfied, and generally, the solution of the problem is to schedule the processor to complete the tasks which are not completed after the processor reaches the offline time, but then the task does not meet the completion goal designed herein, therefore, a method for eliminating the situation needs to be provided, and a correction operator is introduced to solve the problem.
First, a slave processor is checkedWhether the task completion time is greater than the offline time, i.e., whether the inequality s is satisfied i+e i+f iia i≥o i. If the inequality is true, the amount of tasks processed by the slave processor exceeding the offline time is allocated to the next slave processor. Then, similarly, the next slave handler is checked, and so on. The (n-1) th is checked from the first slave processor, so that the condition that the constraint condition is not met can be prevented to the maximum extent.
Therefore, the task completion time and the offline time are compared from the first slave processor of each individual, and if the task completion time and the offline time do not meet the constraint condition, correction is performed.
6. Local search
The convergence rate is an important embodiment of the performance of the algorithm, the convergence rate and the finding of the global optimal result are generally mutually balanced, the convergence rate is high, and the convergence rate is easy to converge to a local optimal point. Then, in order to optimize the algorithm herein, we also consider whether there is room for further optimization for the convergence speed of the algorithm.
The local search operator is introduced according to the task sharing idea. The task amount of the slave processor with the longest task completion time and the task amount of the slave processor with the shortest task completion time are properly adjusted and balanced, so that the processors meeting the offline time constraint can complete tasks as simultaneously as possible, the total task completion time is reduced, and the convergence speed of the algorithm is accelerated.
The specific execution process comprises the following steps:
(1) finding out T maxAnd T minI.e., the longest task completion time and the shortest task completion time from the handler.
(2) Calculating T maxAnd T minI.e. Δ T ═ T max-T min
(3) Finding out the maximum one of all the slave processors and recording as omega maxThus, the task amount required to be adjusted is calculated.
(4) The task amount Δ a to be adjusted is (Δ T/2)/ω max(ii) a For longest task completion timeThe task amount of the slave processor is decreased by Δ a, and the task amount of the slave processor having the shortest task completion time is increased by Δ a.
7. Iteration
The cycle of 60000 passages was performed.
8. Finding the optimal solution
Finding a certain individual with the shortest task completion time from all the descendants to the individuals in the 60000 th generation, wherein the individual is the optimal solution of the problem.
9. Complexity analysis of algorithms
When initializing the population, obviously, the time complexity of initialization of each individual is o (n), so the time complexity of initializing S individuals is o (n S). In the iteration process, the time complexity of the algorithm is replaced by the number of times of calculating the individual fitness, and in each iteration process, the cross operator calculates 2S multiplied by p cNext, the mutation operator will calculate 2S × p mAnd (2) calculating (n-1) S times at most in the correction operator, and calculating S times at most in the local search operator, so that the algorithm complexity of one iteration is O (nS). The total number of iterations of the algorithm is t, so the total time complexity is o (n t s).
As can be seen from the foregoing embodiments, in the parallel task scheduling method for limited time provided in the embodiments of the present invention, a task allocation manner is generated to split a task into a plurality of subtasks having the same number as that of slave processors, and a slave processor scheduling manner corresponding to the task allocation manner is generated based on the task allocation manner; performing cross and variation processing for a plurality of times of iteration aiming at the combination of the task allocation mode and the slave processor scheduling mode by using a genetic algorithm to generate a new combination of the task allocation mode and the slave processor scheduling mode; the technical scheme of respectively calculating the task completion time of the combination of the plurality of task allocation modes and the slave processor scheduling modes and scheduling the tasks by using the combination of the task allocation mode with the minimum task completion time and the slave processor scheduling mode can execute the parallel task scheduling based on the time window model, optimize the scheduling execution speed and efficiency and further improve the product quality.
The invention designs and realizes the problem based on a parallel task scheduling algorithm considering limited time, establishes a clear and accurate time window model, establishes a mathematical model on the basis, then takes a genetic algorithm as the basis of solving the problem, and carries out the improvement on accurate condition constraint and convergence speed, successfully designs a correct and efficient solving algorithm, and perfectly solves the problem of parallel task scheduling based on the time window model. The method can be used for most Web projects, such as virtualization, cloud computing platforms; the storage server service page and the like can optimize the execution speed and efficiency of the software product on a logic code layer to the maximum extent, further improve the product quality and enhance the product competitiveness.
It should be particularly noted that, the steps in the embodiments of the limited-time parallel task scheduling method described above may be mutually intersected, replaced, added, or deleted, and therefore, the limited-time parallel task scheduling method for these reasonable permutation and combination transformations shall also fall within the scope of the present invention, and shall not limit the scope of the present invention to the described embodiments.
In view of the above object, according to a second aspect of the embodiments of the present invention, an embodiment of an apparatus capable of performing parallel task scheduling based on a time window model is provided. The device for scheduling the parallel tasks in the limited time comprises:
a processor; and
a memory storing program code executable by the processor, the program code, when executed, performing the above method.
The various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the disclosed embodiments of the present invention.
As can be seen from the foregoing embodiments, the parallel task scheduling apparatus with limited time according to the embodiments of the present invention generates a task allocation manner that splits a task into a plurality of subtasks having the same number as that of slave processors, and generates a slave processor scheduling manner corresponding to the task allocation manner based on the task allocation manner; performing cross and variation processing for a plurality of times of iteration aiming at the combination of the task allocation mode and the slave processor scheduling mode by using a genetic algorithm to generate a new combination of the task allocation mode and the slave processor scheduling mode; the technical scheme of calculating the task completion time of the combination of the task allocation mode and the slave processor scheduling mode and scheduling the tasks by using the combination of the task allocation mode with the minimum task completion time and the slave processor scheduling mode can execute the parallel task scheduling based on the time window model, optimize the scheduling execution speed and efficiency and further improve the product quality.
It should be particularly noted that the above-mentioned embodiment of the limited-time parallel task scheduling apparatus adopts the embodiment of the limited-time parallel task scheduling method to specifically describe the working process of each module, and those skilled in the art can easily think that these modules are applied to other embodiments of the limited-time parallel task scheduling method. Of course, since the steps in the embodiment of the limited-time parallel task scheduling method may be mutually intersected, replaced, added, or deleted, the limited-time parallel task scheduling apparatus that is transformed by these reasonable permutations and combinations shall also belong to the scope of the present invention, and shall not limit the scope of the present invention to the embodiment.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the present disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments of the invention may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that, as used herein, the singular forms "a", "an" and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items. The numbers of the embodiments disclosed in the embodiments of the present invention are merely for description, and do not represent the merits of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program instructing relevant hardware, where the program may be stored in a computer-readable storage medium, and the above-mentioned storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will understand that: the discussion of any embodiment above is meant to be exemplary only, and is not intended to intimate that the scope of the disclosure, including the claims, of embodiments of the invention is limited to these examples; within the idea of an embodiment of the invention, also technical features in the above embodiment or in different embodiments may be combined and there are many other variations of the different aspects of an embodiment of the invention as described above, which are not provided in detail for the sake of brevity. Therefore, any omissions, modifications, substitutions, improvements, and the like that may be made without departing from the spirit and principles of the embodiments of the present invention are intended to be included within the scope of the embodiments of the present invention.

Claims (10)

1. A method for scheduling parallel tasks in a limited time, comprising:
generating a task allocation mode for splitting a task into a plurality of subtasks with the same number as that of slave processors, and generating a slave processor scheduling mode corresponding to the task allocation mode based on the task allocation mode;
performing cross and variation processing for a plurality of times of iteration aiming at the combination of the task allocation mode and the slave processor scheduling mode by using a genetic algorithm to generate a combination of a new task allocation mode and a slave processor scheduling mode;
and respectively calculating the task completion time of a plurality of combinations of the task allocation modes and the slave processor scheduling modes, and scheduling the tasks by using the combination of the task allocation mode with the minimum task completion time and the slave processor scheduling mode.
2. The method according to claim 1, wherein the task allocation manner comprises splitting the task into a plurality of subtasks with the same number of slave processors; the processor scheduling mode comprises establishing one-to-one correspondence between the plurality of subtasks and the plurality of slave processors.
3. The method of claim 1, wherein performing a crossover and mutation process for a plurality of iterations of the combination of the task allocation pattern and the slave processor scheduling pattern using a genetic algorithm to generate a new combination of task allocation pattern and slave processor scheduling pattern comprises:
determining genetic algorithm parameters and performing the following steps in a loop according to the genetic algorithm parameters:
performing cross-point-based gene exchange between different task allocation modes according to the genetic algorithm parameters to generate a combination of a new task allocation mode and a slave processor scheduling mode;
executing gene exchange based on variation points on the combination of the task allocation mode and the slave processor scheduling mode according to the genetic algorithm parameters to generate a new combination of the task allocation mode and the slave processor scheduling mode;
and respectively calculating adaptive values of a plurality of new task allocation modes and the combination of the slave processor scheduling modes, and reserving the combination of the task allocation mode with higher adaptive value and the slave processor scheduling mode to the next cycle.
4. The method of claim 3, further comprising: and when cross-point-based gene exchange is performed between different task allocation modes according to the genetic algorithm parameters, normalization processing is performed on the exchanged genes so that the respective task amounts of the different task allocation modes are kept unchanged.
5. The method of claim 3, wherein the genetic algorithm parameters include genetic algebra, population size, cross probability, mutation probability;
the loop execution according to the genetic algorithm parameters comprises: performing the genetic algebra circularly or reaching the population scale;
performing crossover-based gene swapping between different ones of the task allocation patterns according to the genetic algorithm parameters comprises: performing a crossover-based gene exchange according to the crossover probability;
performing a mutation point-based gene exchange on a combination of the task allocation manner and the slave processor scheduling manner according to the genetic algorithm parameters includes: performing a mutation point-based gene exchange according to the mutation probability.
6. The method of claim 5, wherein the crossover-based gene exchange comprises: randomly determining two cross points and exchanging genes of different task allocation modes within a range defined by the two cross points;
the mutation point-based gene exchange includes: and randomly determining two variation points and exchanging the combined genes of the task allocation mode and the slave processor scheduling mode on the two variation points.
7. The method of claim 3, wherein calculating the adaptive values for the combination of the plurality of new task allocation patterns and the slave processor scheduling patterns, respectively, comprises:
respectively calculating the subtask completion time of each slave processor in the combination of the new task allocation mode and the slave processor scheduling mode;
respectively taking the maximum value of the subtask completion time of the slave processor in the combination of the plurality of new task allocation modes and the slave processor scheduling modes to obtain the task completion time of the combination of the plurality of new task allocation modes and the slave processor scheduling modes;
and determining the reciprocal of the task completion time of the combination of the plurality of new task allocation modes and the slave processor scheduling modes as the adaptive value of the combination of the plurality of new task allocation modes and the slave processor scheduling modes.
8. The method of claim 7, wherein reserving the combination of the task allocation pattern and the slave processor scheduling pattern with the higher adaptation value into the next cycle comprises: and randomly determining one or more combinations of the task allocation modes and the slave processor scheduling modes to be reserved in the next cycle by taking the adaptive value as the accumulated probability in the combination of the new task allocation modes and the slave processor scheduling modes.
9. The method of claim 7, wherein calculating a subtask completion time for each slave processor in each of a plurality of new combinations of the task allocation scheme and the slave processor scheduling scheme comprises:
determining the sum of the task receiving starting time of the front subtask of the slave processor, the transmission starting cost of the front subtask and the task transmission time of the front subtask as the task receiving completion time of the front subtask;
taking the maximum value of the release time of the subtask of the slave processing machine and the task reception completion time of the pre-subtask as the task reception start time of the subtask of the slave processing machine;
and determining the sum of the task receiving starting time of the subtasks of the slave processor, the transmission starting cost of the subtasks, the calculation starting cost of the subtasks and the task calculation time of the subtasks as the subtask completion time.
10. A limited-time parallel task scheduler, comprising:
a processor; and
a memory storing program code executable by a processor, the program code when executed performing the method of any of claims 1-9.
CN201910924541.6A 2019-09-25 2019-09-25 Parallel task scheduling method and device with limited time Withdrawn CN110780985A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910924541.6A CN110780985A (en) 2019-09-25 2019-09-25 Parallel task scheduling method and device with limited time

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910924541.6A CN110780985A (en) 2019-09-25 2019-09-25 Parallel task scheduling method and device with limited time

Publications (1)

Publication Number Publication Date
CN110780985A true CN110780985A (en) 2020-02-11

Family

ID=69384778

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910924541.6A Withdrawn CN110780985A (en) 2019-09-25 2019-09-25 Parallel task scheduling method and device with limited time

Country Status (1)

Country Link
CN (1) CN110780985A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111400050A (en) * 2020-03-30 2020-07-10 绿盟科技集团股份有限公司 Method and device for allocating resources to execute tasks
CN112631745A (en) * 2020-12-02 2021-04-09 微梦创科网络科技(中国)有限公司 Timed task execution method, device and system based on time window
CN113568731A (en) * 2021-09-24 2021-10-29 苏州浪潮智能科技有限公司 Task scheduling method, chip and electronic equipment
WO2022033241A1 (en) * 2020-08-10 2022-02-17 腾讯科技(深圳)有限公司 Object processing method and apparatus, storage medium, and electronic device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111400050A (en) * 2020-03-30 2020-07-10 绿盟科技集团股份有限公司 Method and device for allocating resources to execute tasks
CN111400050B (en) * 2020-03-30 2023-09-19 绿盟科技集团股份有限公司 Method and device for allocating resources to execute tasks
WO2022033241A1 (en) * 2020-08-10 2022-02-17 腾讯科技(深圳)有限公司 Object processing method and apparatus, storage medium, and electronic device
CN112631745A (en) * 2020-12-02 2021-04-09 微梦创科网络科技(中国)有限公司 Timed task execution method, device and system based on time window
CN113568731A (en) * 2021-09-24 2021-10-29 苏州浪潮智能科技有限公司 Task scheduling method, chip and electronic equipment

Similar Documents

Publication Publication Date Title
CN110780985A (en) Parallel task scheduling method and device with limited time
CN111381950B (en) Multi-copy-based task scheduling method and system for edge computing environment
He et al. A novel task-duplication based clustering algorithm for heterogeneous computing environments
CN113821318B (en) Internet of things cross-domain subtask combination collaborative computing method and system
CN112416585A (en) GPU resource management and intelligent scheduling method for deep learning
Xiao et al. A cooperative coevolution hyper-heuristic framework for workflow scheduling problem
CN114647515A (en) GPU cluster-oriented dynamic resource scheduling method
CN109871270B (en) Scheduling scheme generation method and device
CN115237580B (en) Intelligent calculation-oriented flow parallel training self-adaptive adjustment system and method
CN106201681B (en) Method for scheduling task based on pre-release the Resources list under Hadoop platform
CN111831415A (en) Multi-queue multi-cluster task scheduling method and system
Li et al. Efficient online scheduling for coflow-aware machine learning clusters
Nikravan et al. A genetic algorithm for process scheduling in distributed operating systems considering load balancing
CN115994567A (en) Asynchronous scheduling method for parallel computing tasks of deep neural network model
CN114610474A (en) Multi-strategy job scheduling method and system in heterogeneous supercomputing environment
CN114237869A (en) Ray double-layer scheduling method and device based on reinforcement learning and electronic equipment
Li et al. Endpoint-flexible coflow scheduling across geo-distributed datacenters
CN112286686A (en) Edge calculation task scheduling algorithm based on PSO optimization
CN115421885A (en) Distributed multi-target cloud task scheduling method and device and cloud service system
Tang et al. Collaborative cloud-edge-end task offloading with task dependency based on deep reinforcement learning
CN118312312A (en) Cloud data center load balancing intelligent optimization method based on multi-objective reinforcement learning
CN116862206A (en) Method and system for adaptively optimizing distributed manufacturing execution of production plan
CN112596879A (en) Method for quantum cloud computing platform task scheduling
Wang et al. Geoclone: Online task replication and scheduling for geo-distributed analytics under uncertainties
CN110928648A (en) Heuristic and intelligent computing-fused cloud workflow segmentation online scheduling optimization method

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
WW01 Invention patent application withdrawn after publication

Application publication date: 20200211

WW01 Invention patent application withdrawn after publication