A parallel processor scheduling method with preemption granularity limit

Through mathematical planning formulas and Gurobi optimizer calculations, the optimal solution algorithm solves the problem of large-scale parallel processor scheduling, and realizes efficient solution to the optimal scheduling solution within a limited time.

CN119003154BActive Publication Date: 2025-07-25CHENGDU UNIVERSITY OF TECHNOLOGY
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411016639.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Priority Date
2024-04-19
Filing Date
2024-07-29
Publication Date
2025-07-25
Estimated Expiration
2044-07-29

AI Technical Summary

Technical Problem

The prior art cannot effectively solve the optimal solution in the large-scale parallel processor scheduling problem, resulting in a sharp increase in solution time and it is difficult to output the results in a limited time.

Method used

Mathematical planning formulas are used to encode task attributes and scheduling objectives, and Python's gurobipy library calls the Gurobi mathematical optimizer to calculate the optimal solution, and seven mathematical planning formulas are proposed to solve the parallel processor scheduling problem with preemptive granularity limitations.

Benefits of technology

When dealing with larger-scale problems, the optimal solution can be effectively obtained, which significantly improves the solution efficiency and reduces the running time.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119003154B_ABST
    Figure CN119003154B_ABST
Patent Text Reader

Abstract

The present invention discloses a parallel processor scheduling method with preemption granularity limitation, which mainly solves the problem that the efficiency of the existing optimal algorithm drops sharply as the problem scale increases. The method includes: (S1) According to the restrictive preemption attribute constraint of the scheduling problem and the scheduling objective of minimizing the makespan, seven mathematical programming formulas are proposed; (S2) Call the gurobipy library of Python and pass the mathematical programming formulas obtained in step (S1) into the Gurobi mathematical optimizer of gurobipy; (S3) Calculate the optimal solution of the problem by calling the Gurobi mathematical optimizer to obtain the optimal scheduling scheme. Through the above scheme, the scheme of the present invention can ensure the output of the optimal solution of the problem. Compared with the existing optimal solution algorithm, it can support the solution of larger-scale problems.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of computer applications. Specifically, it relates to a parallel processor scheduling method with preemption granularity limitation. Background Art

[0002] Preemption is a key factor in improving task schedulability. It allows resources to be released to tasks that need immediate processing more by suspending the execution of the current task. To reduce preemption overhead while maintaining task schedulability, the scheduling model needs to constrain the preemption timing, preemption times, or preemption granularity to avoid waste of system resources caused by frequent preemption. Common restricted preemption scheduling models include the preemption model with fixed time points and the scheduling model with preemption granularity limitation. The restricted preemption scheduling problem with fixed time points fixes the preemption timing at pre-set time points. Although this method can control the overhead caused by infinite preemption, it lacks flexibility. This patent focuses on the scheduling model with preemption granularity limitation, introduces the parameter k to characterize the "granularity" of preemption, and requires that preemption must occur after a task has been continuously executed for at least k time units, so as to avoid resource waste caused by excessive preemption while ensuring the flexibility of preemption timing.

[0003] The parallel processor scheduling problem with preemption granularity limitation is an NP-hard problem. In practical applications, heuristic algorithms are often used to obtain feasible solutions. These algorithms can obtain optimal solutions in special cases, but the approximate solutions obtained under general circumstances cannot stably approach the optimal solution. Considering that accurate scheduling algorithms can not only predict benefits and avoid risks in the early stage of system design, but also play a guiding role in the evaluation of approximate algorithms, some accurate algorithms have been proposed to study how to solve the optimal solution of the parallel processor scheduling problem with preemption granularity limitation, such as SAT (Boolean Satisfiability) and PMS (Partial Maximum Satisfiability) methods. However, the problem scales that these optimal scheduling algorithms can solve are very small. As the number of tasks or the execution duration of tasks increases, the time required to solve the optimal solution of the problem increases sharply, making it difficult to output the problem solution within a limited time. Therefore, it is of great theoretical significance and practical value to design a deterministic method applicable to restricted preemption scheduling of medium and large-scale processors. Summary of the Invention

[0004] The purpose of the present invention is to provide a parallel processor scheduling method with preemption granularity limitation, mainly to solve the problem that the prior art cannot ensure the output of the optimal solution.

[0005] To achieve the above purpose, the technical solution adopted by the present invention is as follows:

[0006] A parallel processor scheduling method with preemption granularity limit, comprising the following steps:

[0007] (S1) According to the restricted preemption attribute constraint of the scheduling problem and the scheduling objective of minimizing the makespan, seven mathematical programming formulas are proposed;

[0008] (S2) Invoke the gurobipy library of Python and pass the mathematical programming formulas obtained in step (S1) into the Gurobi mathematical optimizer of gurobipy;

[0009] (S3) Calculate the optimal solution of the problem by invoking the Gurobi mathematical optimizer to obtain the optimal scheduling scheme.

[0010] Furthermore, according to the restricted preemption attribute constraint of the scheduling problem and the scheduling objective of minimizing the makespan, seven mathematical programming formulas are proposed; the rules are as follows:

[0011] Rule 1: The task slices of each task are executed sequentially, and this attribute is encoded as a formula:

[0012]

[0013] where Γ is the task set, T j represents the j-th task in the set Γ, represents the i-th task slice of task T j , represents the start execution time of task slice , represents the execution duration of task slice , L max is the maximum completion time of a feasible scheduling scheme calculated by any heuristic algorithm (for example: improved LPT algorithm [1], 2RS algorithm [2]), p j is the execution duration of task T j ;

[0014] [1] K.Ecker and R.Hirschberg. Task scheduling with restricted preemptions. PARLE In 1993 Parallel Architectures and Languages Europe, pages 464 - 475, Berlin, Heidelberg, 06 1993. Springer.

[0015] [2] K. Pie_nkosz and A. Prus. Task scheduling with restricted preemptions on two parallel processors. In 2015 20th International Conference on Methods and Models in Automation and Robotics (MMAR), pages 58 - 61, Poland, 08 2015. IEEE.

[0016] Rule 2: If two task fragments from different tasks are scheduled on the same machine, then these two task fragments must be executed sequentially. Encode this property as a formula:

[0017]

[0018] where, Μ represents the set of machines, M u represents the u - th machine in Μ, is a decision variable, represents the task fragment executed on machine M u and represents that the task fragment is not executed on machine M u . ∧ represents the logical AND operation, ∨ represents the logical OR operation, and → represents the implication operation;

[0019] Rule 3: Except for the last task fragment, the execution duration of each task fragment is either not less than k or equal to 0. Encode this property as a formula:

[0020]

[0021] where, k is the preemption granularity. When a task is preempted, it must be executed continuously for k time units, otherwise it cannot be preempted. p j is the execution duration of task T j , is the last task fragment of task T j ;

[0022] Rule 4: If the execution duration of a task fragment is 0, then it cannot be assigned to any machine for execution. Encode this property as a formula:

[0023]

[0024] Rule 5: If the execution duration of a task shard is greater than 0, it should be assigned to a machine for execution. Encode this property as a formula:

[0025]

[0026] Rule 6: When a task is preempted to form multiple task shards, the sum of the execution durations of all its task shards is equal to the execution duration of the task. Encode this property as a formula:

[0027]

[0028] Rule 7: The scheduling objective is to minimize the maximum completion time of all tasks. Encode this objective constraint as a formula:

[0029]

[0030] (S2) Write the hard clauses and soft clauses obtained in step (S1) into a file with the suffix.wcnf to obtain the PMS problem;

[0031] (S3) Calculate the optimal solution of the PMS problem by calling the LSUPlus solver to obtain the optimal scheduling plan.

[0032] Furthermore, in the step (S2), use the Python code import gurobipy as gp to import the gurobipy library, use the code m = gp.Model('mp') to create a mathematical programming model, and then pass the mathematical programming formula obtained in (S1) into the created mathematical programming model m;

[0033] Furthermore, in the step (S3), use the Python code m.optimize() to call the Gurobi mathematical optimizer to obtain the optimal solution of the model m.

[0034] Compared with the prior art, the present invention has the following beneficial effects:

[0035] (1) The present invention encodes the task attributes and scheduling objectives as mathematical programming formulas, and then uses the mathematical optimizer Gurobi to find the optimal scheduling plan. The formalization of the formula and the call of the mathematical optimizer are both completed through the third-party library gurobipy of Python, and the method is easy to understand and implement;

[0036] (2) Compared with the existing optimal algorithms, the present invention can handle larger problem scales, so it has higher practical application value. Description of the Drawings

[0037] Figure 1 It is the workflow diagram of the present invention.

[0038] Figure 2 The comparison results of the success rates of different optimal scheduling methods in finding the optimal solution within 300 seconds for different numbers of tasks.

[0039] Figure 3 The comparison results of the running times of different optimal scheduling methods for different numbers of tasks.

[0040] Figure 4 The comparison results of the success rates of different optimal scheduling methods in finding the optimal solution within 300 seconds for different task execution durations.

[0041] Figure 5 The comparison results of the running times of different optimal scheduling methods for different task execution durations. Detailed implementation manners

[0042] The present invention will be further described below in conjunction with the accompanying drawings and embodiments. The implementation manners of the present invention include but are not limited to the following embodiments.

[0043] Embodiment

[0044] As Figure 1 shown, a parallel processor scheduling method with preemption granularity limitation includes the following steps:

[0045] (S1) According to the restrictive preemption attribute constraint of the scheduling problem and the scheduling objective of minimizing the makespan, seven mathematical programming formulas are proposed; the rules are as follows:

[0046] Rule 1: The task slices of each task are executed sequentially, and this attribute is encoded as a formula:

[0047]

[0048] where Γ is the set of tasks, T j represents the j-th task in the set Γ, represents the i-th task slice of task T j , represents the start execution time of task slice , represents the execution duration of task slice , L max is the makespan of any feasible scheduling scheme calculated by a heuristic algorithm (e.g., improved LPT algorithm [1], 2RS algorithm [2]), p j is the execution duration of task T j ;

[0049] [1] K.Ecker and R.Hirschberg. Task scheduling with restricted preemptions. PARLE In 1993 Parallel Architectures and Languages Europe, pages 464 - 475, Berlin, Heidelberg, 06 1993. Springer.

[0050] [2] K.Pie_nkosz and A.Prus. Task scheduling with restricted preemptions on two parallel processors. In 2015 20th International Conference on Methods and Models in Automation and Robotics (MMAR), pages 58 - 61, Poland, 08 2015. IEEE.

[0051] Rule 2: If two task fragments from different tasks are scheduled on the same machine, then these two task fragments must be executed sequentially. Encode this property as a formula:

[0052]

[0053] where Μ represents the set of machines, M u represents the u - th machine in Μ, is a decision variable, 1 means that the task fragment is executed on machine M u and means that the task fragment is not executed on machine M u . ∧ represents the logical AND operation, ∨ represents the logical OR operation, and → represents the implication operation;

[0054] Rule 3: Except for the last task fragment, the execution duration of each task fragment is either not less than k or equal to 0. Encode this property as a formula:

[0055]

[0056] where k is the preemption granularity. When a task is preempted, it must execute continuously for k time units, otherwise it cannot be preempted. p j is the execution duration of task T j , is task Tj The last task shard;

[0057] Rule 4: If the execution duration of a task shard is 0, it cannot be assigned to any machine for execution. Encode this property as a formula:

[0058]

[0059] Rule 5: If the execution duration of a task shard is greater than 0, it should be assigned to a machine for execution. Encode this property as a formula:

[0060]

[0061] Rule 6: When a task is preempted to form multiple task shards, the sum of the execution durations of all its task shards is equal to the execution duration of the task. Encode this property as a formula:

[0062]

[0063] Rule 7: The scheduling objective is to minimize the maximum completion time of all tasks. Encode this objective constraint as a formula:

[0064]

[0065] (S2) Use the Python code import gurobipy as gp to import the GurobiPy library. Use the code m = gp.Model('mp') to create a mathematical programming model, and then pass the mathematical programming formula obtained in (S1) into the created mathematical programming model m;

[0066] (S3) Use the Python code m.optimize() to call the Gurobi mathematical optimizer to obtain the optimal solution of the model m.

[0067] The above embodiments are only the preferred embodiments of the present invention, and do not limit the protection scope of the present invention. Any changes made using the design principle of the present invention and non-creative labor based on this shall fall within the protection scope of the present invention.

[0068] The following uses two simple examples to illustrate the advantages of the method proposed by the present invention in dealing with medium-scale problems. For the sake of description, use MP to represent the method proposed by the present invention, and SAT and PMS are both methods proposed in paper [1].

[0069] In the first application example, let the number of tasks included in each problem instance be n, and the value of n is enumerated in increments of 5 from 10 to 30 to test the running performance of three optimal algorithms when the number of tasks increases. These tasks need to be scheduled to 4 parallel identical machines for processing, and the processing time of each task is randomly selected within the range of [10, 20]. The value of the preemption granularity is set to 9 to ensure that each task can be preempted at least once. 10 problem instances are generated for each set of parameters, so a total of 50 instances are evaluated. Figure 2 shows the success rate of the three optimal algorithms in finding the optimal solution within a 300 - second timeout limit for different numbers of tasks. Figure 3 shows the time taken for the three methods to successfully find the optimal solution for different numbers of tasks. It can be clearly seen from Figure 2 that as the value of the number of tasks n increases, the performance of the SAT and PMS algorithms drops sharply, while the performance degradation of MP can be controlled to a certain extent. Specifically, when the number of tasks reaches 20, the success rate of SAT and PMS in finding the optimal solution within 300 seconds drops to no more than 0.7; when the number of tasks reaches 25, the success rate of SAT and PMS in finding the optimal solution within 300 seconds drops to 0. In contrast, for the MP method, when the number of tasks n reaches 30, it can still find the optimal solution for all problems with a 100% success rate, and the running time is less than 40 seconds. Therefore, the MP method has a more significant performance advantage than SAT and PMS when the number of tasks increases.

[0070] In the second application example, let each problem instance contain 10 tasks, which need to be scheduled to 4 parallel identical machines for processing. The processing time of each task is randomly selected within the range of [t, 2*t]. The value of the preemption granularity is set to 0.9*t to ensure that each task can be preempted at least once. In this example, the value of t is enumerated in increments of 10 from 10 to 50 to test the running performance of different optimal algorithms when the value of t increases. 10 problem instances are generated for each set of parameters, so a total of 50 instances are evaluated. Figure 4 shows the comparison results of the success rate of the three optimal scheduling methods in finding the optimal solution within 300 seconds for different task execution durations. It can be clearly seen from Figure 4 that as the value of the task execution duration t increases, both the MP and SAT algorithms can find the optimal solution for all problems within a 300 - second timeout, while the PMS algorithm reaches a solution success rate of 0.7 when the task execution duration range is [30, 60], and the solution success rate drops to 0 for larger task execution duration ranges. Figure 5It shows the time taken for the three methods to successfully find the optimal solution under different task execution durations. Obviously, when the t value increases, the running time of the SAT method increases significantly, while the running time of the MP method is hardly affected. This is because the MP method treats the task execution duration as an integer variable, while SAT and PMS represent the task execution duration using binary numbers. As the task execution duration increases, the number of required binary digits also increases, resulting in the problem of the expansion of the problem-solving scale.

[0071] The above application example shows that by using the exact algorithm provided by the present invention, the optimal solution of the restricted preemption problem can be obtained, and it has a higher solution efficiency than the existing optimal algorithm when the number of tasks increases or the task execution duration increases.

[0072] References:

[0073] [1]Xiaojuan Liao, Hui Zhang, Miyuki Koshimura, Rong Huang, Fagen Li, Solving Restricted Preemptive Scheduling on Parallel Machines with SAT and PMS, Journal of Universal Computer Science, 2023, vol.29, no.8, 911 - 937.

Claims

1. A parallel processor scheduling method with preemption granularity limit, characterized in that, It includes the following steps: (S1) According to the restricted preemption property constraints of the scheduling problem and the scheduling objective of minimizing the makespan, seven mathematical programming formulas are proposed; the rules are as follows: Rule 1: The task slices of each task are executed sequentially, and this property is encoded as a formula: Among them, Γ is the task set, T j represents the j-th task in the set Γ, represents the i-th task shard of task T j , represents the start execution time of the task shard , represents the execution duration of the task shard , L max is the maximum completion time of a feasible scheduling scheme calculated by any heuristic algorithm, p j is the execution duration of task T j ; Rule 2: If two task slices from different tasks are scheduled on the same machine, these two task slices must be executed sequentially, and this property is encoded as a formula: where, Μ represents the set of machines, and M u represents the u-th machine of Μ, is a decision variable, represents task sharding executed on machine M u ; represents task sharding not executed on machine M u ; ∧ represents the logical AND operation, ∨ represents the logical OR operation, represents the implication operation; Rule 3: Except for the last task slice, the execution duration of each task slice is either not less than k or equal to 0, and this property is encoded as a formula: where k is the preemption granularity, and a task must execute continuously for k time units when it is preempted, otherwise it cannot be preempted. p j is the execution duration of task T j , and is the last task fragment of task T j . Rule 4: If the execution duration of a task slice is 0, it cannot be assigned to any machine for execution, and this property is encoded as a formula: Rule 5: If the execution duration of a task slice is greater than 0, it should be assigned to a machine for execution, and this property is encoded as a formula: Rule 6: When a task is preempted to form multiple task slices, the sum of the execution durations of all its task slices is equal to the execution duration of the task, and this property is encoded as a formula: Rule 7: The scheduling objective is to minimize the maximum completion time of all tasks, and this objective constraint is encoded as a formula: (S2) Call the gurobipy library of Python and pass the mathematical programming formula obtained in step (S1) into the Gurobi mathematical optimizer of gurobipy; (S3) Calculate the optimal solution of the problem by calling the Gurobi mathematical optimizer to obtain the optimal scheduling plan.

2. The parallel processor scheduling method with preemption granularity limit according to claim 1, wherein, In step (S2), the gurobipy library is imported using the Python code import gurobipy as gp, and a mathematical programming model is created using the code m = gp.Model('mp'), and then the mathematical programming formula obtained in (S1) is passed into the created mathematical programming model m.

3. A parallel processor scheduling method with preemption granularity limitation according to claim 1, characterized in that, In step (S3), the optimal solution of model m is obtained by calling the Gurobi mathematical optimizer using the Python code m.optimize().

Citation Information

Patent Citations

  • Double-layer scheduling method for precast concrete members in supply chain environment

    CN111401616A

  • Workflow scheduling method with multiple timing constraints in hybrid cloud environment

    CN115237593A