Thread distribution method and electronic equipment
By abstracting the microservice interface into a directed acyclic graph, calculating the priority score of nodes and dynamically allocating threads, the problem of inaccurate node processing priority decision-making under limited thread resources in existing technologies is solved, achieving minimization of time consumption and resource optimization without timeout constraints.
Patent Information
- Application Number
- CN202511082918.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-08-04
- Publication Date
- 2025-11-21
AI Technical Summary
Existing technologies cannot accurately determine the processing priority of multiple DAG nodes under limited thread resources, resulting in the inability to meet the timeout constraint for task processing. Furthermore, the node processing time is affected by the client data format and system load, leading to inaccurate priority decisions.
By abstracting the microservice interface into a directed acyclic graph (DAG), calculating the priority score of nodes, and considering the mean, standard deviation, and execution probability of the execution time, threads are dynamically allocated to minimize the execution time under the constraint that each DAG does not time out.
It improved the accuracy of thread allocation, reduced the timeout rate, optimized the processing time of microservice interfaces, and saved machine resources.
Smart Images

Figure CN120994375A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of resource allocation technology, and in particular to a thread allocation method and an electronic device. Background Technology
[0002] The system service can provide multiple microservice interfaces, some of which have reusable nodes. Therefore, abstracting the microservice interfaces into multiple nodes enables flexible arrangement and combination of interfaces, reducing development and maintenance costs.
[0003] Each node requires a certain amount of time to process, and the system has a limited number of threads that can process nodes in parallel. The problem that needs to be solved is how to complete the processing of all nodes as quickly as possible with a limited number of threads.
[0004] Existing solutions abstract microservice interfaces into DAGs (Directed Acyclic Graphs) and then prioritize tasks for each individual DAG, failing to uniformly prioritize the processing of nodes across multiple DAGs under limited resources. Furthermore, existing solutions only consider minimizing the processing time of a single DAG, neglecting to prioritize ensuring that each DAG's processing doesn't time out when multiple DAGs are being processed simultaneously, and then minimizing the overall processing time. Additionally, existing solutions assume the processing time of each node is static, but in real-world applications, the time required for each task node is typically affected by factors such as the complexity of client data, current system load, and network fluctuations, leading to inaccurate task prioritization decisions. Summary of the Invention
[0005] The main objective of this application is to propose a thread allocation method and an electronic device, which aims to calculate the priority score of each node in the ready node queue based on the average time consumption, standard deviation of time consumption, and execution probability of each node. This satisfies the constraint that each DAG processing does not time out, while minimizing the time consumption, thereby improving the accuracy of priority decision-making.
[0006] To achieve the above objectives, a first aspect of this application proposes a thread allocation method, the method comprising:
[0007] The microservice interface is abstracted into a directed acyclic graph containing multiple nodes, where one microservice interface corresponds to one directed acyclic graph.
[0008] Determine if the number of nodes in the currently executable ready node queue is greater than the number of idle threads;
[0009] If the number of nodes in the ready node queue is less than or equal to the number of idle threads, then one thread is assigned to each node in the ready node queue.
[0010] If the number of nodes in the ready node queue is greater than the number of idle threads, then the priority score of each node in the ready node queue is calculated based on the average time consumption, standard deviation of time consumption, and execution probability of each node.
[0011] Threads are allocated to each node according to its priority score, with priority given to nodes with higher priority scores.
[0012] In one embodiment of this application, the priority score of each node in the ready node queue is calculated based on the average time consumption, standard deviation of time consumption, and execution probability corresponding to each node, including:
[0013] Based on the average execution time and execution probability of each node, as well as the position of each node in its directed acyclic graph, the expected earliest start time of each node is calculated.
[0014] Based on the expected earliest start time of each node and the position of the target node in its directed acyclic graph, the expected latest start time of the target node is calculated.
[0015] The time slack of the target node is obtained by subtracting the expected earliest start time of the target node from the expected latest start time.
[0016] Based on the execution probability of each node and the position of the target node in the directed acyclic graph, the expected time of the probabilistic critical path of the target node is calculated, wherein the expected time of the probabilistic critical path of the target node represents the expected time from the target node to the end node of the directed acyclic graph to which the target node belongs.
[0017] The timeout pressure factor of the target node is calculated based on the maximum timeout capacity of the directed acyclic graph to which the target node belongs, the time from the start of processing the directed acyclic graph to the target node, and the expected time of the probabilistic critical path of the target node.
[0018] The priority score of the target node is calculated based on its time slack, expected time of the probabilistic critical path, standard deviation of time, and timeout pressure factor. The higher the priority score, the higher the priority.
[0019] In one embodiment of this application, the step of calculating the expected earliest start time of each node based on the average execution time and execution probability of each node, as well as the position of each node in its respective directed acyclic graph, includes:
[0020] When the target node is the starting node in the directed acyclic graph, the earliest start time of the target node is expected to be 0.
[0021] When the target node is not the starting node in the directed acyclic graph to which it belongs, and the target node has one and only one direct predecessor node, the execution probability of the direct predecessor node is multiplied by the average time consumption of the direct predecessor node to obtain the expected processing time of the direct predecessor node.
[0022] The earliest expected start time of the target node is obtained by adding the expected processing time of the direct predecessor node to the earliest expected start time of the direct predecessor node.
[0023] When the target node is not the starting node in the directed acyclic graph to which it belongs, and the target node has multiple direct predecessor nodes, the maximum value of the sum of the earliest expected start time of the direct predecessor nodes and the expected processing time of the direct predecessor nodes is selected as the earliest expected start time of the target node.
[0024] In one embodiment of this application, calculating the latest start time expectation of the target node based on the earliest expected start time of each node and the position of the target node in its directed acyclic graph includes:
[0025] When the target node is the terminal node in the directed acyclic graph to which it belongs, the smaller value between the maximum timeout capacity of the directed acyclic graph to which the target node belongs and the sum of the earliest expected start time of the target node and the expected processing time of the target node is selected as the latest expected completion time of the target node.
[0026] When the target node is not the terminal node in the directed acyclic graph to which it belongs, and the target node has one and only one direct successor node, the expected latest completion time of the target node is obtained by subtracting the expected processing time of the direct successor node from the expected latest completion time of the direct successor node.
[0027] When the target node is not the terminal node in the directed acyclic graph to which it belongs, and the target node has multiple direct successor nodes, the minimum value of the difference between the expected latest completion time of the direct successor node and the expected processing time of the direct successor node is selected as the expected latest completion time of the target node.
[0028] The expected latest start time of the target node is obtained by subtracting the expected processing time of the target node from the expected latest completion time of the target node.
[0029] In one embodiment of this application, calculating the expected probabilistic critical path time of the target node based on the execution probability of each node and the position of the target node in its directed acyclic graph includes:
[0030] When the target node is the terminal node in the directed acyclic graph, the execution probability of the target node is multiplied by the average time of the target node to obtain the expected processing time of the target node, and the expected processing time of the target node is used as the expected time of the probabilistic critical path of the target node.
[0031] When the target node is not the terminal node in the directed acyclic graph to which it belongs, and the target node has one and only one direct successor node, the expected processing time of the target node is added to the product of the execution probability of the direct successor node and the expected time of the probabilistic critical path of the direct successor node, so as to obtain the expected time of the probabilistic critical path of the target node.
[0032] When the target node is not the terminal node in the directed acyclic graph to which it belongs, and the target node has multiple direct successor nodes, the expected processing time of the target node is obtained by adding the maximum value of the product of the execution probability of the direct successor node and the expected time of the probabilistic critical path of the direct successor node among the multiple direct successor nodes.
[0033] In one embodiment of this application, the calculation of the timeout pressure factor of the target node based on the maximum timeout capacity of the directed acyclic graph to which the target node belongs, the time from the start of processing the directed acyclic graph to the target node, and the expected time of the probabilistic critical path of the target node is performed by the following formula:
[0034]
[0035] In the formula, U i PCP represents the timeout pressure factor for target node i. i The timeout represents the expected critical path time for target node i. k currtime represents the maximum timeout capacity of the directed acyclic graph to which target node i belongs. i This represents the time from the start of processing the directed acyclic graph to which the target node i belongs to the end of the time until the target node i is reached. τ is a constant value used to prevent the denominator from being 0, and K is a fixed value.
[0036] In one embodiment of this application, the priority score of the target node is calculated based on the target node's time slack, expected time of the probabilistic critical path, standard deviation of time consumption, and timeout pressure factor using the following formula:
[0037]
[0038] In the formula, Priorityi Slack represents the priority score of target node i. i σ represents the time relaxation of target node i. i PCP represents the standard deviation of the time taken at target node i. i U represents the expected critical path time for target node i. i Let τ represent the timeout pressure factor of target node i, where τ is a constant value to prevent the denominator from being 0, α is the influence weight coefficient corresponding to the time relaxation, β is the influence weight coefficient corresponding to the standard deviation of time consumption, γ is the influence weight coefficient corresponding to the expected time consumption of the probabilistic critical path, and δ is the influence weight coefficient corresponding to the timeout pressure factor. α+β+γ+δ=1.
[0039] In one embodiment of this application, a data update cycle is set, and in each data update cycle, the actual time consumed by each node and the execution probability of each node within the preset time closest to the present are recorded;
[0040] Based on the actual time spent by each node within the preset time period closest to the present and the execution probability of each node, update the mean time spent, standard deviation of time spent, and execution probability of each node respectively, so as to calculate the priority score of the node in subsequent processing based on the updated mean time spent, standard deviation of time spent, and execution probability of each node respectively.
[0041] In one embodiment of this application, updating the mean time, standard deviation of time, and execution probability of each node based on the actual time spent by each node within the most recent preset time and the execution probability of each node includes:
[0042] The average actual time of the node within the nearest preset time period is calculated based on the actual time of the node within the nearest preset time period.
[0043] The average time of the nodes used in the current calculation is updated based on the average actual time of the nodes within the most recent preset time and the first smoothing factor.
[0044] The standard deviation of the time consumption of the nodes currently used in the calculation is updated based on the average actual time consumption of the nodes within the most recent preset time and the second smoothing factor.
[0045] The execution probability of the node currently being used in the calculation is updated based on the actual number of times the node is executed within the preset time period closest to the present, the total number of times the node is scheduled, and the third smoothing factor.
[0046] To achieve the above objectives, a second aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described in any embodiment of this application.
[0047] In the technical solution provided in this application embodiment, the microservice interface is abstracted into a directed acyclic graph (DAG) including multiple nodes, where one microservice interface corresponds to one DAG. Then, it is determined whether the number of nodes in the currently executable ready node queue is greater than the number of idle threads. If the number of nodes in the ready node queue is less than or equal to the number of idle threads, a thread can be directly assigned to each node in the ready node queue. However, if the number of nodes in the ready node queue is greater than the number of idle threads, a priority score for each node in the ready node queue needs to be calculated based on the average execution time, standard deviation of execution time, and execution probability of each node. Threads are then assigned to each node according to its priority score, prioritizing nodes with higher priority scores. Calculating the priority score for each node in the ready node queue based on the average execution time, standard deviation of execution time, and execution probability of each node satisfies the constraint that each DAG processing should not time out, while minimizing execution time, thus improving the accuracy of priority decision-making. Meanwhile, with limited thread resources, priority strategies can automatically optimize the processing time of microservice interfaces, reduce timeout rates, improve interface response speed, and save machine resources. Attached Figure Description
[0048] Figure 1 This is a flowchart of a thread allocation method provided in an embodiment of this application.
[0049] Figure 2 This is an example diagram of the microservice interface provided by the service system.
[0050] Figure 3 yes Figure 2 The diagram shows a directed acyclic graph corresponding to the microservice interface.
[0051] Figure 4 This is a flowchart of the steps for calculating the priority score of each node in the ready node queue based on the average time consumption, standard deviation of time consumption, and execution probability of each node, according to an embodiment of this application.
[0052] Figure 5 This is a flowchart of the steps provided in one embodiment of the present application to calculate the expected earliest start time of each node based on the average time consumption and execution probability of each node and the position of each node in the directed acyclic graph to which it belongs.
[0053] Figure 6This is a flowchart of the steps for calculating the latest start time expectation of a target node based on the earliest expected start time of each node and the position of the target node in its directed acyclic graph, according to an embodiment of this application.
[0054] Figure 7 This is a flowchart of the steps in one embodiment of the present application to calculate the expected critical path time of a target node based on the execution probability of each node and the position of the target node in its directed acyclic graph.
[0055] Figure 8 This is a flowchart of the steps performed after allocating threads to each node according to the priority score corresponding to each node, as provided in an embodiment of this application.
[0056] Figure 9 This is a flowchart of the steps provided in an embodiment of the present application to update the mean time, standard deviation of time, and execution probability of each node based on the actual time spent by each node within the preset time closest to the present and the execution probability of each node.
[0057] Figure 10 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0058] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0059] It should be noted that although functional modules are divided in the device schematic diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the device or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0060] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0061] The system service can provide multiple microservice interfaces, some of which have reusable nodes. Therefore, abstracting the microservice interfaces into multiple nodes enables flexible arrangement and combination of interfaces, reducing development and maintenance costs.
[0062] Each node requires a certain amount of time to process, and the system has a limited number of threads that can process nodes in parallel. The problem that needs to be solved is how to complete the processing of all nodes as quickly as possible with a limited number of threads.
[0063] Existing solutions abstract microservice interfaces into DAGs (Directed Acyclic Graphs) and prioritize task processing nodes by calculating the earliest start time (EST) and latest start time (LST). However, existing solutions suffer from the following problems, leading to inaccurate task processing priority decisions.
[0064] 1. Task processing priority decisions are made for individual DAGs, without uniformly deciding the processing priority of nodes in multiple DAGs under limited resources;
[0065] 2. Existing solutions assume that the processing time of each node is static. In actual applications, the time required for each task node is usually affected by factors such as the complexity of the customer data, the current system load, and network fluctuations.
[0066] 3. Existing solutions assume that DAGs are static. In reality, due to the nature of customer data, some nodes within the same DAG may not require processing. For example, in the DAG of repayment interface conversion, if the customer is not overdue, there is no need to process the overdue aging reduction node.
[0067] 4. Existing solutions only consider minimizing the processing time of a single DAG. When multiple DAGs are not processed simultaneously, priority is given to ensuring that the processing of each DAG does not time out, and then the processing time is minimized.
[0068] Based on this, this application proposes a thread allocation method, which aims to calculate the priority score of each node in the ready node queue according to the average time consumption, standard deviation of time consumption and execution probability of each node. This method can satisfy the constraint that each DAG processing does not time out, while minimizing the time consumption, thereby improving the accuracy of priority decision-making.
[0069] Reference Figure 1 , Figure 1 This is a flowchart of a thread allocation method provided in an embodiment of this application, including but not limited to steps S110 to S150.
[0070] Step S110: Abstract the microservice interface into a directed acyclic graph that includes multiple nodes, where one microservice interface corresponds to one directed acyclic graph.
[0071] In this embodiment of the application, the system service (such as the loan system service) can provide multiple microservice interfaces. Among these microservice interfaces, there are reusable nodes. Therefore, the processing of each microservice interface is abstracted into a directed acyclic graph containing multiple nodes, which enables flexible arrangement and combination of interfaces and reduces development and maintenance costs.
[0072] For example, loan system services are provided as follows Figure 2 The two microservice interfaces shown can be abstracted into a directed acyclic graph containing multiple nodes, as shown below. Figure 3 The diagram shows a directed acyclic graph.
[0073] Step S120: Determine whether the number of nodes in the currently executable ready node queue is greater than the number of idle threads.
[0074] In this embodiment, during the processing of each node task, a ready node queue is first maintained. This queue contains nodes whose preceding nodes have been completed or skipped, and currently executable nodes are stored there. Then, it is necessary to determine whether the number of nodes in the currently executable ready node queue is greater than the number of idle threads. For example, if the number of nodes in the currently executable ready node queue is N, the total number of threads is K, and the number of idle threads is M, then it is necessary to determine whether the number of nodes in the currently executable ready node queue, N, is greater than the number of idle threads, M; that is, whether N is greater than M.
[0075] Step S130: If the number of nodes in the ready node queue is less than or equal to the number of idle threads, then assign a thread to each node in the ready node queue.
[0076] In this embodiment of the application, if the number of nodes in the ready node queue is less than or equal to the number of idle threads, then a thread is directly assigned to each node in the ready node queue. For example, using... Figure 3 Taking the directed acyclic graph shown as an example, the currently executable ready node queue includes two nodes, A1 and A2. Assuming that the current number of idle threads is 3, then one thread can be directly assigned to each of nodes A1 and A2.
[0077] Step S140: If the number of nodes in the ready node queue is greater than the number of idle threads, calculate the priority score of each node in the ready node queue based on the average time consumption, standard deviation of time consumption, and execution probability of each node.
[0078] In this embodiment, if the number of nodes in the ready node queue is greater than the number of idle threads, the priority score of each node in the ready node queue needs to be calculated based on the average time consumption, standard deviation of time consumption, and execution probability of each node, and under the constraint that each directed acyclic graph processing does not time out, and then by minimizing the time consumption strategy. For example, similarly... Figure 3Taking the directed acyclic graph shown as an example, the currently executable ready node queue includes 5 nodes: B1, C1, D1, F2, and C2, while the number of idle threads is 3. At this time, it is necessary to calculate the priority score of these 5 nodes in the ready node queue, so as to allocate threads according to the priority score, to ensure that the processing of all nodes is completed as quickly as possible with a limited number of threads.
[0079] Reference Figure 4 , Figure 4 This is a flowchart of the steps for calculating the priority score of each node in the ready node queue based on the average time consumption, standard deviation of time consumption, and execution probability of each node, as provided in an embodiment of this application, including but not limited to steps S410 to S460.
[0080] Step S410: Calculate the expected earliest start time for each node based on the average execution time and execution probability of each node, as well as the position of each node in its directed acyclic graph.
[0081] In this embodiment of the application, considering that there may be situations in a directed acyclic graph that are not necessarily executed, such as... Figure 3 In the directed acyclic graph shown, if node G2 (corresponding to checking the repayment plan) cannot find a loan agreement after its direct predecessor node F2 (corresponding to checking the loan agreement), then the repayment plan can be skipped, meaning node G2 can be skipped, and node G2 will not be executed. However, if its direct predecessor node F2 (corresponding to checking the loan agreement) finds a loan agreement after execution, then the repayment plan cannot be skipped, and node G2 must be executed. It is evident that in a directed acyclic graph, some nodes may or may not be executed, because this embodiment defines an execution probability p for each node. i , where p represents the probability that node i may be executed. The execution probability p of each node can be determined based on its historical processing data (such as the actual number of times the node was executed and the total number of times it was called). i In addition, each node requires a certain processing time T. i The average time u of each node can be determined based on the historical time of each node. i and the standard deviation of time σ i Among them, T i Follows a normal distribution
[0082] For example, with Figure 3 Taking the two directed acyclic graphs (DAGs) shown as examples, referring to Table 1, based on the historical processing data of each node, it can be determined that... Figure 3 The average time u for each node in the two directed acyclic graphs (DAGs) shown. i Standard deviation of time consumption σ i and the probability of execution pi .
[0083] Table 1
[0084]
[0085]
[0086] In this embodiment of the application, the average time consumption u of node i is... i The probability p of the node being executed i Multiplying them together gives the expected processing time ET for node i. i ET i =μ i *p i Based on the expected processing time ET of each node. i Given the position of the target node in its directed acyclic graph, the expected earliest start time of the target node can be calculated.
[0087] Reference Figure 5 , Figure 5 This is a flowchart of steps provided in an embodiment of the present application to calculate the expected earliest start time of each node based on the average time consumption and execution probability of each node and the position of each node in the directed acyclic graph to which it belongs, including but not limited to steps S510 to S540.
[0088] Step S510: When the target node is the starting node in the directed acyclic graph, the earliest start time of the target node is expected to be 0.
[0089] Step S520: When the target node is not the starting node in the directed acyclic graph to which it belongs, and the target node has one and only one direct predecessor node, multiply the execution probability of the direct predecessor node by the average time consumption of the direct predecessor node to obtain the expected processing time of the direct predecessor node.
[0090] Step S530: Add the expected start time of the direct predecessor node to the expected processing time of the direct predecessor node to obtain the expected start time of the target node.
[0091] Step S540: When the target node is not the starting node in the directed acyclic graph to which it belongs, and the target node has multiple direct predecessor nodes, select the maximum value of the sum of the earliest expected start time of the direct predecessor nodes and the expected processing time of the direct predecessor nodes as the earliest expected start time of the target node.
[0092] In this embodiment, the earliest expected start time of a node refers to the earliest time when the task corresponding to that node can begin, which depends on the expected completion times of all its predecessor tasks. The earliest expected start time of a node can be calculated sequentially from the starting node to the ending node. The earliest expected start time of the starting node is 0. The earliest expected start time of the starting node's direct successor node is equal to the expected processing time of the starting node plus the earliest expected start time of the starting node. This process continues sequentially, with the earliest expected start time of each subsequent node equal to the earliest expected start time of its directly preceding node (i.e., its directly preceding node) plus its expected processing time. When node i has multiple directly preceding nodes, the maximum sum of the earliest expected start time and expected processing time of each of the multiple directly preceding nodes is selected as the earliest expected start time of node i.
[0093] Specifically, the earliest expected start time of a node can be calculated using Equation 1, as follows:
[0094]
[0095] In Equation 1, EEST i EEST represents the expected earliest start time of node i. j ET represents the expected earliest start time of node j. j Let represent the expected processing time of node j, where pred(i) is the set of all direct predecessor nodes of node i, and j∈pred(i) means that node j belongs to the set of all direct predecessor nodes of node i.
[0096] In this embodiment of the application, the earliest start time expected EEST of node i is calculated. i Then, the earliest expected completion time (EEFT) of node i can be calculated. i The earliest completion time of node i is expected to be EEFT. i It equals the expected earliest start time of node i plus the expected processing time of node i, i.e., EEFT. i =EEST i +ET i The earliest expected completion time of a node refers to the earliest time that the task corresponding to that node can be completed.
[0097] Step S420: Calculate the latest expected start time of the target node based on the earliest expected start time of each node and the position of the target node in its directed acyclic graph.
[0098] In this embodiment of the application, after calculating the earliest expected start time of a node, the latest expected start time of the node can be calculated based on the node's position in the directed acyclic graph to which it belongs. The latest expected start time of a node refers to the latest time that the task corresponding to the node must start, and does not affect the fastest processing completion time of the directed acyclic graph to which it belongs.
[0099] Reference Figure 6 , Figure 6 This is a flowchart of the steps for calculating the latest start time of a target node based on the earliest expected start time of each node and the position of the target node in the directed acyclic graph, including but not limited to steps S610 to S640, provided in an embodiment of this application.
[0100] Step S610: When the target node is the terminal node in the directed acyclic graph to which it belongs, select the smaller value between the maximum timeout capacity of the directed acyclic graph to which the target node belongs and the sum of the earliest expected start time of the target node and the expected processing time of the target node as the latest expected completion time of the target node.
[0101] Step S620: When the target node is not the terminal node in the directed acyclic graph to which it belongs, and the target node has one and only one direct successor node, the expected latest completion time of the direct successor node is subtracted from the expected processing time of the direct successor node to obtain the expected latest completion time of the target node.
[0102] Step S630: When the target node is not the terminal node in the directed acyclic graph to which it belongs, and the target node has multiple direct successor nodes, select the minimum value of the difference between the latest expected completion time of the direct successor nodes and the expected processing time of the direct successor nodes as the latest expected completion time of the target node.
[0103] Step S640: Subtract the expected processing time of the target node from the expected latest completion time of the target node to obtain the expected latest start time of the target node.
[0104] In this embodiment, the expected latest completion time of a node refers to the latest expected time when the task corresponding to that node must be completed, without affecting the fastest processing time of the directed acyclic graph (DAG). The expected latest completion time of a node can be calculated sequentially from the terminating node back to the starting node. The expected latest completion time of the terminating node is the sum of its earliest expected start time and its expected processing time. If this time exceeds the maximum timeout capacity of the DAG, then the maximum timeout capacity of the DAG is taken as the expected latest completion time of the terminating node. The expected latest completion time of the terminating node's direct predecessor is equal to the expected latest completion time of the terminating node minus its expected processing time. This process continues backward, with the expected latest completion time of the preceding node equal to the expected latest completion time of its directly succeeding node (i.e., its directly succeeding successor node) minus its expected processing time. When node i has multiple direct successor nodes, the minimum value of the difference between the expected latest completion time of the direct successor nodes and the expected processing time of the direct successor nodes is selected as the expected latest completion time of node i.
[0105] Specifically, the expected latest completion time of a node can be calculated using Equation 2, as follows:
[0106]
[0107] In equation 2, ELFT i The timeout represents the expected latest completion time of node i. k EEST represents the maximum timeout capacity of the directed acyclic graph to which node i belongs. i ET represents the expected earliest start time of node i. i ELFT represents the expected processing time for node i. j ET represents the expected latest completion time of node j. j Let represent the expected processing time of node j, succ(i) represent the set of all direct successor nodes of node i, and j∈succ(i) represent the node that node j belongs to in the set of all direct successor nodes of node i.
[0108] In this embodiment of the application, the expected ELFT of the latest completion time of node i is calculated. i Then, the expected latest start time (ELST) of node i can be further calculated. i The latest start time of node i is expected to be ELST. i Equal to the expected latest completion time of node i (ELFT) i Subtract the expected processing time of node i, i.e., ELST i =ELFT i -ETi .
[0109] Step S430: Subtract the expected earliest start time of the target node from the expected latest start time of the target node to obtain the time slack of the target node.
[0110] In this embodiment of the application, the expected ELST of the latest start time of node i is calculated. i And the earliest expected start time EEST i Then, the latest start time of node i can be expected by ELST. i Subtract the earliest start time expected EEST i The time relaxation Slack of node i is obtained. i Slack i =ELST i -EEST i Among them, the smaller the time slack of node i, the more urgent it is, and the higher its priority should be.
[0111] Step S440: Based on the execution probability of each node and the position of the target node in its directed acyclic graph, calculate the expected time of the probabilistic critical path of the target node, where the expected time of the probabilistic critical path of the target node represents the expected time from the target node to the end node of the directed acyclic graph to which the target node belongs.
[0112] In this embodiment, the expected critical path time of a node represents the expected time from the node to the termination node of its directed acyclic graph. The longer the expected time, the longer the directed acyclic graph is to be processed. In this case, the node should be processed first to ensure that the directed acyclic graph is processed as soon as possible (i.e., higher priority). On the other hand, the shorter the expected time, the shorter the time required for the directed acyclic graph to be processed. Therefore, the node does not need to be processed first (i.e., lower priority).
[0113] Reference Figure 7 , Figure 7 This is a flowchart of the steps provided in an embodiment of the present application to calculate the expected critical path time of a target node based on the execution probability of the node and the position of the target node in the directed acyclic graph to which it belongs, including but not limited to steps S710 to S730.
[0114] Step S710: When the target node is the terminal node in the directed acyclic graph, multiply the execution probability of the target node by the average time of the target node to obtain the expected processing time of the target node, and use the expected processing time of the target node as the expected time of the probabilistic critical path of the target node.
[0115] Step S720: When the target node is not the terminal node in the directed acyclic graph to which it belongs, and the target node has one and only one direct successor node, add the expected processing time of the target node to the product of the execution probability of the direct successor node and the expected time of the probabilistic critical path of the direct successor node, and obtain the expected time of the probabilistic critical path of the target node.
[0116] Step S730: When the target node is not the terminal node in the directed acyclic graph to which it belongs, and the target node has multiple direct successor nodes, the expected processing time of the target node is obtained by adding the maximum value of the product of the execution probability of the direct successor node and the expected time of the probabilistic critical path of the direct successor node among the multiple direct successor nodes.
[0117] In this embodiment, the expected critical path time of a node can be calculated sequentially from the terminating node to the starting node. The expected critical path time of the terminating node is equal to its expected processing time. The expected critical path time of the terminating node's direct predecessor is equal to its expected processing time plus the product of the terminating node's execution probability and its expected critical path time. This process continues backward, with the expected critical path time of each node equal to its own expected processing time plus the product of the execution probability of its direct successor and the expected critical path time of its direct successor. When node i has multiple direct successor nodes, the expected processing time of node i plus the maximum value of the product of the execution probability and the expected critical path time of each direct successor node is taken as the expected critical path time (PCP) of node i. i .
[0118] Specifically, the expected time of the critical path of a node can be calculated using Equation 3, as follows:
[0119]
[0120] In Equation 3, PCP i ET represents the expected critical path time of node i. i p represents the expected processing time for node i. j PCP represents the probability that node j will be executed. j Let represent the expected critical path time of node j, succ(i) represent the set of all direct successor nodes of node i, and j∈succ(i) represent the node that node j belongs to the set of all direct successor nodes of node i.
[0121] In this embodiment, the expected processing time ET for each node can be calculated based on the average processing time, execution probability, and position of the node in its respective directed acyclic graph. i Expected earliest start time for EEST i Expected earliest completion time (EEFT) i Expected latest completion time (ELFT) i Expected latest start time for ELST i Time relaxation Slack i Probability of Critical Path Expected Time (PCP) i For example, with Figure 3 Taking the two directed acyclic graphs (DAGs) shown as examples, referring to Table 2, the results can be calculated respectively according to the above. Figure 3 The expected processing time ET for each node in the two directed acyclic graphs (DAGs) shown is as follows. i Expected earliest start time for EEST i Expected earliest completion time (EEFT) i Expected latest completion time (ELFT) i Expected latest start time for ELST i Time relaxation Slack i Probability of Critical Path Expected Time (PCP) i .
[0122] Table 2
[0123]
[0124]
[0125] Step S450: Calculate the timeout pressure factor of the target node based on the maximum timeout capacity of the directed acyclic graph to which the target node belongs, the time from the start of processing the directed acyclic graph to the target node, and the expected time consumption of the probabilistic critical path of the target node.
[0126] In this embodiment, after calculating the expected timeout of the probabilistic critical path of a node, the timeout pressure factor of the target node can be further calculated based on the maximum timeout capacity of the directed acyclic graph to which the target node belongs, the time from the start of processing the directed acyclic graph to the target node, and the expected timeout of the probabilistic critical path of the target node. The timeout pressure factor represents the timeout pressure corresponding to processing the current node. The higher the timeout pressure, the higher the priority.
[0127] Specifically, the timeout pressure factor of the node can be calculated using Equation 4, as follows:
[0128]
[0129] In Equation 4, U i PCP represents the timeout pressure factor of node i. i The timeout represents the expected critical path time for node i. k currtime represents the maximum timeout capacity of the directed acyclic graph to which node i belongs. i This represents the time from the start of processing the directed acyclic graph to the end of time until node i is reached. τ is a constant value, a local minimum value used to prevent the denominator from being 0. K is a constant value, i.e., when timeout... k <currtime i In other words, if the timeout has already occurred, then give U... i Set a relatively large constant value.
[0130] currtime i The timeout represents the time from the start of processing the directed acyclic graph containing node i up to node i. k Subtract currtime i The difference represents the actual time taken from starting from node i to the maximum end (reaching the maximum timeout capacity corresponding to the directed acyclic graph to which node i belongs at the end). The ratio of the expected time taken from starting from node i to the end node of the directed acyclic graph to which node i belongs to the actual time is used to characterize the timeout pressure. The larger the ratio (i.e., the expected time is greater than the actual time), the greater the timeout pressure (the greater the probability of timeout). The smaller the ratio (i.e., the expected time is less than the actual time), the smaller the timeout pressure (the less likely the probability of timeout).
[0131] Step S460: Calculate the priority score of the target node based on the target node's time slack, expected time of the probabilistic critical path, standard deviation of time, and timeout pressure factor. The higher the priority score, the higher the corresponding priority.
[0132] In this embodiment, the priority of node processing needs to comprehensively consider multiple factors, including: the longer the probabilistic critical path, the higher the priority; the greater the uncertainty of processing time, the higher the priority; the smaller the time slack, the higher the priority; and the greater the timeout pressure, the higher the priority. Therefore, the priority score of a node can be calculated based on its time slack, expected time of the probabilistic critical path, standard deviation of time consumption, and timeout pressure factor.
[0133] Specifically, the priority score of a node can be calculated using Equation 5, as follows:
[0134]
[0135] In the formula, Priority iSlack represents the priority score of node i. i σ represents the time relaxation of node i. i PCP represents the standard deviation of the time consumed by node i. i U represents the expected critical path time for node i. i Let τ represent the timeout pressure factor for node i, where τ is a constant value and a minimum value to prevent the denominator from being zero. α is the influence weight coefficient corresponding to the time relaxation, β is the influence weight coefficient corresponding to the standard deviation of time consumption, γ is the influence weight coefficient corresponding to the expected time consumption of the probabilistic critical path, and δ is the influence weight coefficient corresponding to the timeout pressure factor. α + β + γ + δ = 1. α, β, γ, and δ can be obtained through experiments and training methods, and each represents the importance of different influencing factors.
[0136] For example, if α, β, γ, and δ are all 0.25, and τ is 0.01, then we can obtain by Figure 3 Taking the directed acyclic graph shown as an example, the currently executable ready node queue includes 5 nodes: B1, C1, D1, F2, and C2, while the number of idle threads is 3. At this time, the priority scores of these 5 nodes in the ready node queue can be calculated according to the priority score calculation formula. The calculated priority scores of the 5 nodes B1, C1, D1, F2, and C2 are shown in Table 3.
[0137] Table 3
[0138]
[0139] Step S150: Assign threads to each node according to the priority score of each node, with priority given to nodes with higher priority scores.
[0140] In this embodiment of the application, after calculating the priority score of each node in the ready node queue, threads can be allocated to each node according to the priority score of each node, wherein threads are allocated to nodes with higher priority scores first.
[0141] For example, taking the priority scores of each node in the ready node queue shown in Table 3 as an example, the priority scores of each node are sorted from high to low as F2, D1, C1, C2, and B1. Since the number of idle threads is 3, one thread is allocated to each of the top 3 nodes, F2, D1, and C1.
[0142] In this embodiment, the priority score of each node in the ready node queue is calculated based on the average time consumption, standard deviation of time consumption, and execution probability of each node. This satisfies the constraint that each DAG processing should not time out, while minimizing the time consumption, thus improving the accuracy of priority decision-making. Simultaneously, under limited thread resources, the priority strategy can automatically optimize the processing time of microservice interfaces, reducing timeout rates, improving interface response speed, and saving machine resources.
[0143] In some embodiments, the time required for each task node is typically affected by factors such as the complexity of the customer data, the current system load, and network fluctuations; that is, the processing time of a node fluctuates. Furthermore, the probability that a task node might be executed also fluctuates. Therefore, a data update cycle can be set. For example, when k nodes (a smaller k results in higher recalculation costs but more accurate priority calculation) are completed (resulting in idle threads) or when a new microservice interface is called (adding a new DAG to be processed), the average processing time u of each node can be adjusted based on historical data. i Standard deviation of time consumption σ i and the probability of execution p i The system updates the data to calculate the priority score of each node in subsequent thread allocation processes. By adaptively and dynamically adjusting the priority of each node within the interface, the system can improve the interface processing speed and reduce the probability of interface timeout with limited resources.
[0144] Reference Figure 8 , Figure 8 This is a flowchart of the steps to be executed after allocating threads to each node according to the priority score corresponding to each node, as provided in an embodiment of this application, including but not limited to steps S810 to S820.
[0145] Step S810: Set the data update cycle, and in each data update cycle, record the actual time consumed by each node and the execution probability of each node within the preset time closest to the present.
[0146] Step S820: Update the mean time, standard deviation of time, and execution probability of each node according to the actual time consumed by each node within the preset time closest to the present, so as to calculate the priority score of the node based on the updated mean time, standard deviation of time, and execution probability of each node in subsequent processing.
[0147] In this embodiment, a data update cycle can be set, and in each data update cycle, the actual processing time of each node and the execution probability of each node within the most recent preset time are recorded. For example, the actual processing time T of each node in the last 5 minutes is recorded. i recentAnd the probability p of each node being executed i Then, based on the actual time consumed by each node within the preset time interval closest to the current time and the execution probability of each node, the mean time consumed, standard deviation of time consumed, and execution probability of each node can be updated respectively, so that the priority score of the node can be calculated based on the updated mean time consumed, standard deviation of time consumed, and execution probability of each node in subsequent processing.
[0148] Reference Figure 9 , Figure 9 This is a flowchart of the steps provided in an embodiment of the present application to update the mean time, standard deviation of time, and execution probability of each node based on the actual time spent by each node within the preset time closest to the present and the execution probability of each node, including but not limited to steps S910 to S940.
[0149] Step S910: Calculate the average actual time of the node within the preset time period closest to the current time based on the actual time of the node within the preset time period closest to the current time.
[0150] In this embodiment of the application, the actual time T of the node within the nearest preset time interval can be used as the basis. i recent The average actual time consumed by the node within the preset time interval closest to the current time is calculated.
[0151] For example, taking node G as an example, the time spent by node G in the last 5 minutes is recorded as follows: 9, 8, 6, 7.5, 7.5, 7.8, 8.8, 9.1, 8.2, 8. From this, the average actual time spent by node G in the last 5 minutes can be calculated.
[0152] Step S920: Update the average time consumption of the nodes currently used for calculation based on the average actual time consumption of the nodes within the preset time period closest to the present and the first smoothing factor.
[0153] In this embodiment of the application, the average actual time consumption of the node within the preset time interval closest to the current time is calculated. Then, the average time consumption of the nodes used in the current calculation can be updated based on the average actual time consumption of the nodes within the most recent preset time and the first smoothing factor. Specifically, the update can be performed using Equation 6, as follows:
[0154]
[0155] In Equation 6, Let ε represent the average time taken after updating node i, and ε1 represent the first smoothing factor. This represents the average time taken by node i in the current computation. This represents the average actual time spent by node i within the preset time interval closest to the current time, where 0πε1π1 and ε1 can be obtained through experiments and training.
[0156] For example, taking node G as an example, the time spent by node G in the last 5 minutes is recorded as follows: 9, 8, 6, 7.5, 7.5, 7.8, 8.8, 9.1, 8.2, 8. From this, the average actual time spent by node G in the last 5 minutes can be calculated. Setting the first smoothing factor ε1 to 0.3, and the average time taken by node G in the current calculation to be 8, the average time taken by node G after the update can be calculated.
[0157] Step S930: Update the standard deviation of the time consumption of the node currently used for calculation based on the average actual time consumption of the node within the preset time period closest to the present and the second smoothing factor.
[0158] In this embodiment of the application, the average actual time consumption of the node within the preset time interval closest to the current time is calculated. Then, the standard deviation of the time consumption of the currently used node can be updated based on the average actual time consumption of the node within the most recent preset time and the second smoothing factor. Specifically, the update can be performed using Equation 7, as follows:
[0159]
[0160] In Equation 7, ε represents the standard deviation of the time taken after updating node i, and ε2 represents the second smoothing factor. This represents the standard deviation of the computation time of node i currently being used. ε represents the average actual time spent by node i within the preset time interval closest to the current time, where 0πε2π1 and ε2 can be obtained through experiments and training.
[0161] For example, taking node G as an example, the time spent by node G in the last 5 minutes is recorded as follows: 9, 8, 6, 7.5, 7.5, 7.8, 8.8, 9.1, 8.2, 8. From this, the average actual time spent by node G in the last 5 minutes can be calculated. Setting the second smoothing factor ε2 to 0.3, and the standard deviation of the time consumption of the currently used node G to be 1, the standard deviation of the time consumption after the update of node G is calculated.
[0162] Step S940: Update the execution probability of the node currently being used in the calculation based on the actual number of times the node is executed within the preset time period closest to the present, the total number of times the node is scheduled, and the third smoothing factor.
[0163] In this application, the execution probability of the currently used node can be updated based on the actual execution count of the node within the nearest preset time, the total number of node scheduling times, and the third smoothing factor. Specifically, it can be calculated using Equation 8, as follows:
[0164]
[0165] In Equation 8, ε represents the probability of node i being executed after the update, ε3 represents the third smoothing factor, and sum recent (execute i ) represents the actual number of times node i is executed, sum recent (dispatch i ) represents the number of times node i is scheduled, where scheduling to node i does not guarantee execution, and 0πε3π1, ε3 can be obtained through experiments and training.
[0166] For example, taking node G as an example, the number of times node G was scheduled in the last 5 minutes is recorded as 15, of which 10 were actually executed. Setting the third smoothing factor ε3 to 0.3, and the execution probability of node G currently used in the calculation as 0.6, the updated execution probability of node G can be calculated.
[0167] Therefore, in each data update cycle, by recording the actual time consumed by each node and the execution probability of each node within the most recent preset time, the mean time consumed, standard deviation of time consumed, and execution probability of each node can be updated according to the actual time consumed by each node within the most recent preset time and the execution probability of each node. In subsequent processing, the priority score of each node can be calculated based on the updated mean time consumed, standard deviation of time consumed, and execution probability of each node.
[0168] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the above-described method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0169] Please see Figure 10 , Figure 10 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of this application. The electronic device includes:
[0170] The processor 1001 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0171] The memory 1002 can be implemented as a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 1002 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 1002 and is called and executed by the processor 1001.
[0172] Input / output interface 1003 is used to implement information input and output;
[0173] The communication interface 1004 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0174] Bus 1005 transmits information between various components of the device (e.g., processor 1001, memory 1002, input / output interface 1003, and communication interface 1004);
[0175] The processor 1001, memory 1002, input / output interface 1003 and communication interface 1004 are connected to each other within the device via bus 1005.
[0176] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0177] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0178] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0179] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0180] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0181] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0182] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0183] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0184] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0185] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0186] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. A thread allocation method characterized by, The method comprises: abstracting the microservice interface into a directed acyclic graph comprising a plurality of nodes, wherein one microservice interface corresponds to one directed acyclic graph; determining whether the number of nodes in a ready node queue currently executable is greater than the number of idle threads; if the number of nodes in the ready node queue is less than or equal to the number of idle threads, assigning a thread to each node in the ready node queue; if the number of nodes in the ready node queue is greater than the number of idle threads, calculating the priority score of each node in the ready node queue according to the time consumption mean value, time consumption standard deviation and execution probability of each node respectively; allocating threads to each node according to the priority score corresponding to each node, wherein the node with a higher priority score is given priority in thread allocation.
2. The method of claim 1, wherein, The calculation of the priority score of each node in the ready node queue according to the time consumption mean value, time consumption standard deviation and execution probability of each node respectively comprises: calculating the earliest start time expectation of each node according to the time consumption mean value and execution probability of each node and the position of each node in the directed acyclic graph to which it belongs; calculating the latest start time expectation of the target node according to the earliest start time expectation of each node and the position of the target node in the directed acyclic graph to which it belongs; subtracting the earliest start time expectation of the target node from the latest start time expectation of the target node to obtain the time slack of the target node; calculating the probability critical path time consumption expectation of the target node according to the execution probability of each node and the position of the target node in the directed acyclic graph to which it belongs, wherein the probability critical path time consumption expectation of the target node represents the expected time consumption from the target node to the end of the terminating node of the directed acyclic graph to which the target node belongs; calculating the timeout pressure factor of the target node according to the maximum timeout capacity corresponding to the directed acyclic graph to which the target node belongs, the time from the start of processing the directed acyclic graph to which the target node belongs to the target node, and the probability critical path time consumption expectation of the target node; calculating the priority score of the target node according to the time slack, probability critical path time consumption expectation, time consumption standard deviation and timeout pressure factor of the target node, wherein the larger the priority score, the higher the corresponding priority.
3. The method of claim 2, wherein, The calculation of the earliest start time expectation of each node according to the time consumption mean value and execution probability of each node and the position of each node in the directed acyclic graph to which it belongs comprises: when the target node is the starting node in the directed acyclic graph, the earliest start time expectation of the target node is 0; when the target node is not the starting node in the directed acyclic graph and the target node has only one immediate predecessor node, multiplying the execution probability of the immediate predecessor node by the time consumption mean value of the immediate predecessor node to obtain the expected processing time of the immediate predecessor node; adding the earliest start time expectation of the immediate predecessor node to the expected processing time of the immediate predecessor node to obtain the earliest start time expectation of the target node; When the target node is not a start node in the directed acyclic graph and the target node has multiple immediate predecessor nodes, selecting the maximum value of the sum of the earliest start time expectation of the immediate predecessor node and the expected processing time of the immediate predecessor node as the earliest start time expectation of the target node.
4. The method of claim 3, wherein, The calculation of the latest start time expectation of the target node according to the earliest start time expectation of each node and the position of the target node in the directed acyclic graph comprises: When the target node is a termination node in the directed acyclic graph, selecting the smaller value of the maximum timeout capacity corresponding to the directed acyclic graph to which the target node belongs and the sum of the earliest start time expectation of the target node and the expected processing time of the target node as the latest completion time expectation of the target node; When the target node is not a termination node in the directed acyclic graph and the target node has only one immediate successor node, obtaining the latest completion time expectation of the target node by subtracting the expected processing time of the immediate successor node from the latest completion time expectation of the immediate successor node; When the target node is not a termination node in the directed acyclic graph and the target node has multiple immediate successor nodes, selecting the minimum value of the difference between the latest completion time expectation of the immediate successor node and the expected processing time of the immediate successor node as the latest completion time expectation of the target node; Obtaining the latest start time expectation of the target node by subtracting the expected processing time of the target node from the latest completion time expectation of the target node.
5. The method of claim 2, wherein, The calculation of the probability critical path time consumption expectation of the target node according to the execution probability of each node and the position of the target node in the directed acyclic graph comprises: When the target node is a termination node in the directed acyclic graph, multiplying the execution probability of the target node and the time consumption mean of the target node to obtain the expected processing time of the target node, and taking the expected processing time of the target node as the probability critical path time consumption expectation of the target node; When the target node is not a termination node in the directed acyclic graph and the target node has only one immediate successor node, obtaining the probability critical path time consumption expectation of the target node by adding the expected processing time of the target node and the product of the execution probability of the immediate successor node and the probability critical path time consumption expectation of the immediate successor node; When the target node is not a termination node in the directed acyclic graph and the target node has multiple immediate successor nodes, obtaining the probability critical path time consumption expectation of the target node by adding the expected processing time of the target node and the maximum value of the product of the execution probability of the immediate successor node and the probability critical path time consumption expectation of the immediate successor node.
6. The method of claim 5, wherein, The calculation of the time-out pressure factor of the target node according to the maximum time-out capacity corresponding to the directed acyclic graph to which the target node belongs, the time from the start of processing the directed acyclic graph to which the target node belongs to the target node, and the probability critical path time consumption expectation of the target node is performed by the following formula: where U i represents the timeout pressure factor of the target node i, PCP i represents the probability critical path duration expectation of the target node i, timeout k represents the maximum timeout capacity corresponding to the directed acyclic graph to which the target node i belongs, currtime i represents the time from the start of processing the directed acyclic graph to which the target node i belongs to the target node i, τ is a constant value for preventing the denominator from being 0, and K is a constant value.
7. The method according to claim 2 or 6, characterized in that, The calculation of the priority score of the target node according to the time slack of the target node, the probability critical path time consumption expectation, the time consumption standard deviation, and the time-out pressure factor is performed by the following formula: where Priority i denotes the priority score of target node i, Slack i denotes the time slack of target node i, σ i denotes the time consumption standard deviation of target node i, PCP i denotes the probabilistic critical path time consumption expectation of target node i, U i denotes the overtime pressure factor of target node i, τ is a constant value for preventing the denominator from being 0, α is the influence weight coefficient corresponding to the time slack, β is the influence weight coefficient corresponding to the time consumption standard deviation, γ is the influence weight coefficient corresponding to the probabilistic critical path time consumption expectation, δ is the influence weight coefficient corresponding to the overtime pressure factor, and α + β + γ + δ = 1.
8. The method of claim 1, wherein, The method further comprises: setting a data update period, and recording the actual time consumption of each node and the executed probability of each node within a preset time closest to the current time in each data update period; updating the time consumption mean value, the time consumption standard deviation, and the executed probability of each node respectively according to the actual time consumption of each node and the executed probability of each node within a preset time closest to the current time, so as to calculate the priority score of each node based on the updated time consumption mean value, the time consumption standard deviation, and the executed probability of each node respectively in subsequent processing.
9. The method of claim 8, wherein, The updating of the time consumption mean value, the time consumption standard deviation, and the executed probability of each node respectively according to the actual time consumption of each node and the executed probability of each node within a preset time closest to the current time comprises: calculating the actual time consumption mean value of each node within a preset time closest to the current time according to the actual time consumption of each node within the preset time closest to the current time; updating the time consumption mean value of each node used in the current calculation according to the actual time consumption mean value of each node within a preset time closest to the current time and a first smoothing factor; updating the time consumption standard deviation of each node used in the current calculation according to the actual time consumption mean value of each node within a preset time closest to the current time and a second smoothing factor; updating the executed probability of each node used in the current calculation according to the actual execution times of each node within a preset time closest to the current time, the total scheduling times of each node, and a third smoothing factor.
10. An electronic device, comprising: The electronic device comprises a memory and a processor, the memory stores a computer program, and the processor implements the method of any one of claims 1 to 9 when executing the computer program.