Task scheduling method, device and equipment
By dynamically scheduling tasks based on the dependencies between tasks and resource utilization, traditional task scheduling methods are solved, and the flexibility and efficient execution of task scheduling are achieved.
Patent Information
- Application Number
- CN202510369590.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-26
- Publication Date
- 2025-08-01
AI Technical Summary
Traditional task scheduling methods lack flexibility, cannot adapt to dynamic changes in the environment, and cannot fully utilize system resources.
By determining priority based on the dependencies between tasks, combining the task's resource requirements and resource utilization, dynamically schedule tasks, monitoring task status in real time, and redefining the priority of unscheduled tasks after the task is completed.
It improves the flexibility and accuracy of task scheduling, enables task scheduling to adapt to dynamic changes in the environment, make full use of system resources, and improves execution efficiency.
Smart Images

Figure CN120407101A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of task scheduling, and in particular, to a task scheduling method, apparatus, and device. Background Art
[0002] In today's information technology environment, task scheduling systems are an essential part in multiple fields, and they are responsible for efficiently and orderly allocating computing tasks to processing units for execution.
[0003] Traditional task scheduling methods usually determine the execution order of tasks and resource allocation before the tasks start. This static scheduling strategy is effective when dealing with simple and well-defined task processes. However, traditional task scheduling methods lack flexibility, cannot adapt to dynamic changes in the environment, and cannot fully utilize system resources.
[0004] In summary, how to improve the flexibility of task scheduling, make the task scheduling method adaptable to dynamic changes in the environment, and fully utilize system resources is a technical problem that needs to be solved by those skilled in the art at present. Summary of the Invention
[0005] In view of this, the purpose of the present application is to provide a task scheduling method, apparatus, and device for improving the flexibility of task scheduling, making the task scheduling method adaptable to dynamic changes in the environment, and fully utilizing system resources.
[0006] To achieve the above purpose, the present application provides the following technical solutions:
[0007] A task scheduling method includes: determining the priority of each task according to the dependency relationship between tasks; determining a target task according to the priority of each task, the requirements of each task for various resources, and the current utilization rate of various resources, scheduling the target task, and monitoring the status of the target task; if the target task becomes an end state and there are successor tasks of the target task among the unscheduled tasks, re-determine the priority of each unscheduled task, and execute the step of determining a target task according to the priority of each task, the requirements of each task for various resources, and the current utilization rate of various resources; the successor tasks depend on the target task; if the target task becomes an end state and there are unscheduled tasks but there are no successor tasks of the target task among the unscheduled tasks, execute the step of determining a target task according to the priority of each task, the requirements of each task for various resources, and the current utilization rate of various resources.
[0008] Optionally, determine the priorities of the tasks according to the dependencies between the tasks, including: determining the total dependency metrics of the tasks according to the dependencies between the tasks; determining the weighted scores of the tasks corresponding to the total dependency metrics, the urgency levels, the priority scores, and the resource requirement values of the tasks; performing normalization processing on the weighted scores of the tasks, and determining the priorities of the tasks according to the normalized weighted scores of the tasks and the total system resource utilization rate.
[0009] Optionally, determine the weighted scores of the tasks corresponding to the total dependency metrics, the urgency levels, the priority scores, and the resource requirement values of the tasks, including: using S = w u ·U + w p ·P + w d ·D total + w r ·log(1 + R) to determine the weighted score of the task; where S is the weighted score of the task, U is the urgency level of the task, P is the priority score of the task, D total is the total dependency metric of the task, R is the resource requirement value of the task, and w u , w p , w d and w r are the corresponding weight coefficients.
[0010] Optionally, determine the total dependency metrics of the tasks according to the dependencies between the tasks, including: calculating the total dependency metrics of the tasks according to the direct dependencies between the tasks and the influence function of the environmental variables on the task dependency metrics.
[0011] Optionally, re-determine the priorities of the unscheduled tasks, including: determining the successor tasks of the target task; updating the total dependency metrics of the successor tasks according to the total dependency metrics of the successor tasks and the total dependency metric of the target task; determining the weighted scores of the unscheduled tasks corresponding to the urgency levels, the priority scores, the resource requirement values, the updated total dependency metrics of the successor tasks, and the total dependency metrics of the remaining unscheduled tasks; performing normalization processing on the weighted scores of the unscheduled tasks, and determining the priorities of the unscheduled tasks according to the normalized weighted scores of the unscheduled tasks and the total system resource utilization rate.
[0012] Optionally, according to the total dependency metrics of the subsequent tasks of the target task and the total dependency metric of the target task, update the total dependency metrics of the subsequent tasks, including: updating the total dependency metric of the subsequent task according to the total dependency metric of the subsequent task, the total dependency metric of the target task, and the correlation degree between the subsequent task and the target task.
[0013] Optionally, after determining the total dependency metrics of the tasks according to the dependency relationships between the tasks, it further includes: if a new task and / or an unscheduled task to be deleted are added, determine whether the addition of the new task and / or the deletion of the unscheduled task causes a change in the total dependency metric of the unscheduled tasks; if so, determine the total dependency metrics of the affected tasks among the unscheduled tasks, and determine the total dependency metric of the newly added task when a new task is added, and execute the step of correspondingly determining the weighted scores of the tasks according to the total dependency metrics of the tasks, the urgency levels of the tasks, the priority scores of the tasks, and the resource requirement values of the tasks.
[0014] Optionally, determine a target task according to the priorities of the tasks, the requirements of the tasks for various resources, and the current utilization rates of the various resources, including: constructing a task-resource matrix according to the requirements of the tasks for various resources, and constructing a resource utilization rate matrix according to the current utilization rates of the various resources; constructing a task priority matrix according to the priorities of the tasks and expanding the task priority matrix; the number of rows and columns of the expanded task priority matrix corresponds to the number of rows and columns of the task-resource matrix; obtaining a task-resource dynamic adjustment matrix according to the task-resource matrix, the resource utilization rate matrix, and the expanded task priority matrix; the task-resource dynamic adjustment matrix represents the comprehensive priority of task and resource allocation; determine the target task according to the task-resource dynamic adjustment matrix.
[0015] A task scheduling device, comprising: a first determination module configured to determine the priority of each of the tasks according to the dependency relationship between the tasks; a determination and scheduling module configured to determine a target task according to the priority of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rate of various resources, schedule the target task, and monitor the status of the target task; a second determination module configured to, if the target task becomes an end state and there are successor tasks of the target task among the unscheduled tasks, re-determine the priority of each of the unscheduled tasks, and execute the step of determining a target task according to the priority of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rate of various resources; the successor tasks depend on the target task; an execution module configured to, if the target task becomes an end state and there are unscheduled tasks but there are no successor tasks of the target task among the unscheduled tasks, execute the step of determining a target task according to the priority of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rate of various resources.
[0016] A task scheduling device, comprising: a memory configured to store a computer program; a processor configured to implement the steps of the task scheduling method as described in any one of the above when executing the computer program.
[0017] The present application provides a task scheduling method, device and equipment. Among them, the method includes: determining the priority of each task according to the dependency relationship between the tasks; determining a target task according to the priority of each task, the requirements of each task for various resources, and the current utilization rate of various resources, scheduling the target task, and monitoring the status of the target task; if the target task becomes an end state and there are successor tasks of the target task among the unscheduled tasks, re-determine the priority of each of the unscheduled tasks, and execute the step of determining a target task according to the priority of each task, the requirements of each task for various resources, and the current utilization rate of various resources; the successor tasks depend on the target task; if the current target task becomes an end state and there are unscheduled tasks but there are no successor tasks of the target task among the unscheduled tasks, execute the step of determining a target task according to the priority of each task, the requirements of each task for various resources, and the current utilization rate of various resources.
[0018] In the above technical solution disclosed in this application, the priorities of tasks are determined according to the dependency relationships between tasks, and the target task is determined according to the priorities of tasks, the requirements of tasks for various resources, and the current utilization rates of various resources. Then, the target task is scheduled so that the task can be executed. After scheduling the target task, the status of the target task can be monitored. If the target task becomes the end state and there are unscheduled tasks, and the unscheduled tasks include the successor tasks of the target task (i.e., the tasks that depend on the target task), the priorities of the unscheduled tasks can be re-determined, and the steps of determining the target task and subsequent related steps are executed according to the priorities of tasks, the requirements of tasks for various resources, and the current utilization rates of various resources until the last task is scheduled; if the target task becomes the end state and there are unscheduled tasks but the unscheduled tasks do not include the successor tasks of the target task, the steps of determining the target task can be executed according to the priorities of tasks, the requirements of tasks for various resources, and the current utilization rates of various resources until the last task is scheduled. Through this application, the priorities of tasks are dynamically determined, and based on the priorities of tasks, the requirements of tasks for resources, and the current resource usage status of the system, the scheduling order of tasks is dynamically adjusted to improve the flexibility, rationality, and accuracy of task scheduling, so that the task scheduling method can adapt to the dynamic changes of the environment, make full use of system resources, and improve the execution efficiency of the entire system.
[0019] Additional aspects and advantages of this application will be given in part in the following description, become apparent in part from the following description, or be learned through the practice of this application. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a flowchart of a task scheduling method provided by an embodiment of this application;
[0021] Figure 2 is a schematic structural diagram of a task scheduling device provided by an embodiment of this application;
[0022] Figure 3 is a schematic structural diagram of a task scheduling device provided by an embodiment of this application. DETAILED DESCRIPTION
[0023] In today's information technology environment, task scheduling systems are an indispensable part in multiple fields, and they are responsible for efficiently and orderly allocating computing tasks to processing units for execution. With the increasing computing requirements and the increasingly complex task execution environment, traditional task scheduling systems face various challenges, including how to monitor and respond to the dynamically changing task environment in real time, how to optimize resource allocation to improve execution efficiency under limited resources, and how to handle complex task dependencies to ensure the stability and efficient execution of the task flow.
[0024] Traditional task scheduling methods usually adopt static scheduling strategies, determining the execution order of tasks and resource allocation before the tasks start, and then performing task scheduling according to the pre-determined execution order of tasks and resource allocation. This static scheduling strategy is effective when dealing with simple and well-defined task processes. However, when facing modern computing environments with rapidly changing requirements and complex task dependencies, static scheduling methods often struggle to adapt to the dynamic changes of the environment, cannot fully utilize system resources, and lack flexibility when task priorities are adjusted, resource requirements change, or task dependencies are updated.
[0025] Therefore, this application provides a task scheduling method, device, and system to improve the flexibility of task scheduling, enabling the task scheduling method to adapt to the dynamic changes of the environment and fully utilize system resources.
[0026] The embodiments of this application are described in detail below. The examples of the embodiments are shown in the accompanying drawings, where the same or similar reference numerals represent the same or similar elements or elements with the same or similar functions throughout. The embodiments described by referring to the accompanying drawings are exemplary and are intended to explain this application, but should not be construed as a limitation of this application.
[0027] See Figure 1 , which shows a flowchart of a task scheduling method provided by an embodiment of this application. A task scheduling method provided by an embodiment of this application may include:
[0028] S11: Determine the priorities of each task according to the dependencies between tasks.
[0029] It should be noted that the execution subject of the task scheduling method provided by the embodiments of this application may be a task scheduling system or a task management system. The embodiments of this application will be described by taking the execution subject as a task scheduling system as an example.
[0030] First, a task model can be designed and created, which can be specifically created by object-oriented programming methods. Among them, the task model may include the basic information of the task and the dependencies between tasks.
[0031] The basic information of the task may be, for example, task ID (Identity document, unique identifier), description, estimated execution time, priority score (priority score specified by the user and / or priority score specified by the system), etc.; the task ID is a unique identifier used to distinguish different tasks; the description is used to explain the content and purpose of the task; the estimated execution time represents the time required to complete the task; the priority score is used to determine the urgency of the task.
[0032] The dependencies between tasks indicate which tasks must be completed before the current task. A data structure for setting the dependencies between tasks can be used. Specifically, the dependencies can be represented by a directed acyclic graph, where each node represents a task, and the directed edges between the nodes represent the dependencies between tasks, so as to ensure that the prerequisite and subsequent tasks of the tasks can be clearly identified, that is, a directed acyclic graph can be used to store tasks and task dependencies. Of course, the dependencies between tasks can also be represented by a dependency list.
[0033] After creating the task model, a dynamic task queue can also be established based on the task model. The dynamic task queue supports update operations such as real-time addition and deletion of tasks. Place the unscheduled tasks in the dynamic task queue, and then the dynamic state process of the tasks in the dynamic task queue can be adjusted based on the dependencies between tasks, the priorities of tasks, etc., to achieve intelligent task flow adjustment based on the detection experiment process. That is, a dynamic task queue can be established to manage the tasks to be executed.
[0034] After obtaining the dependencies between tasks, the priorities of each task (i.e., the priorities of each unscheduled task) can be determined according to the dependencies between tasks, so as to achieve dynamic sorting of the tasks in the dynamic task queue based on the priorities and dependencies of the tasks, and ensure that high-priority and independent tasks can be executed first based on the sorting of the priorities and dependencies of the tasks.
[0035] S12: Determine the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources, schedule the target task, and monitor the status of the target task.
[0036] In the embodiments of the present application, the requirements of each task for various resources and the current utilization rates of each resource in the system (i.e., the task scheduling system or the task management system) can also be obtained. Among them, the various resources mentioned here can be, for example, CPU (Central Processing Unit, central processing unit) resources, memory resources, storage resources, bandwidth resources, I / O (Input / Output, input / output) resources, etc.
[0037] After determining the priorities of each task, based on the priority of each task, the requirements of each task for various resources, and the current utilization rate of various resources, a task-resource dynamic balance scheduling algorithm can be adopted to comprehensively evaluate and dynamically adjust tasks and resources to determine the target task (i.e., the task to be scheduled currently). Then, schedule the determined target task to execute the target task (at this time, the status of the target task becomes in execution), so as to achieve dynamic management of tasks. That is, the embodiments of the present application introduce a real-time response mechanism to dynamically manage tasks. During the implementation of the real-time response mechanism, dynamic state process adjustment is performed based on the task status, task priority, and resource status, and finally intelligent task flow adjustment is achieved. The flexibility and response speed of the task scheduling system are improved through the real-time response mechanism, enabling task scheduling to adapt to environmental changes in a timely manner.
[0038] After scheduling the target task, the status of the target task can also be monitored in real time, and the status of other unscheduled tasks can also be monitored in real time. Exemplarily, the status of a task can include waiting, in execution, completed, failed, paused, cancelled, ready, etc. It should be noted that some statuses of a task can be determined as the end status of the task according to different scenarios and / or requirements. For example, the completion of a task can be determined as the end status of the task, or the completion, failure, and cancellation of the task can be determined as the end status of the task, or the completion, failure, cancellation, and pause of the task can be determined as the end status of the task, etc. By monitoring the task execution status in real time, changes in tasks (such as task completion, failure, etc.) can be quickly responded to, and the task flow can be dynamically adjusted based on real-time data.
[0039] In the embodiments of the present application, a monitoring mechanism can be introduced to monitor and track the tasks in the dynamic task queue in real time and obtain the status of the tasks. The implementation process of the monitoring mechanism is as follows:
[0040] First, each task is tracked in real time to obtain the task status. In particular, a unique identifier (ID), such as UUID (Universally Unique Identifier), is assigned to each task instance for easy tracking and reference. Further, a task status update mechanism is introduced. This task status update mechanism is responsible for listening to the types of events during task execution (such as task startup, completion, failure, suspension, cancellation, etc.) and updating the task status according to the event types. Event listeners or callback functions are used during the status update process to receive notifications when the task status changes. For example: Implement the listeners and callback functions using an event-driven framework (such as Java's EventListener or Python's callback function). The task status update mechanism directly responds to the actual situation of task execution and timely updates the task status information, which is the core part of the monitoring mechanism. To further enhance the monitoring ability, the task execution logs are integrated. Whenever the task status changes, in addition to the status update, the task execution logs of the task are also recorded. The task execution logs detail the start time, end time, execution results, and possible error information of the task, providing valuable data support for subsequent analysis and optimization.
[0041] When monitoring the status of a target task, if the status of the target task changes from in-execution to an end status (such as completion), it can be determined whether there are unscheduled tasks in the dynamic task queue and whether the unscheduled tasks include the successor tasks of the target task when there are unscheduled tasks. Among them, the successor tasks of the target task depend on the target task, that is, the successor tasks can only be executed after the target task is completed. The dependencies mentioned here include direct dependencies and indirect dependencies. If there are unscheduled tasks in the dynamic task queue and the unscheduled tasks include the successor tasks of the target task, the direct dependency status of the successor tasks that depend on the target task can be updated (at this time, the status of the unscheduled tasks that directly depend on the target task will change), that is, the embodiment of the present application implements an automatic task status update mechanism to automatically update the status of the dependent tasks of a task when a task ends, and step S13 can be executed; if there are unscheduled tasks in the dynamic task queue but the unscheduled tasks do not include the successor tasks of the target task, the status of these unscheduled tasks can remain unchanged and still be in waiting, and step S14 can be executed; if there are no unscheduled tasks in the dynamic task queue, it indicates that all tasks have been scheduled. At this time, the task scheduling can be ended. Specifically, the dependent list of the target task can be traversed (the dependent list includes all tasks that depend on the current task, that is, these tasks can only be executed after the current task is completed. The dependent list can also be called the successor task list). If the dependent list of the target task exists and is not empty, it is determined that there are successor tasks of the target task among the unscheduled tasks. At this time, the direct dependency status of these tasks in the dependent list can be updated; if there is no dependent list of the target task or the dependent list is empty, but there are still unscheduled tasks in the dynamic task queue, it is determined that there are unscheduled tasks in the dynamic task queue but there are no successor tasks of the target task among the unscheduled tasks. At this time, the status of these unscheduled tasks can remain unchanged and still be in waiting; if there is no dependent list of the target task or the dependent list is empty, and there are no unscheduled tasks in the dynamic task queue, it is determined that there are no unscheduled tasks in the dynamic task queue. At this time, the task scheduling can be ended. Through this process, it is possible to update only the dependency status of the affected tasks and their dependent tasks, rather than recalculating the entire dependency graph, significantly improving the efficiency of task scheduling.
[0042] Among them, when scheduling tasks, the dynamic dependency relationship can also be updated in real time.
[0043] S13: If the target task becomes an end status and there are successor tasks of the target task among the unscheduled tasks, re-determine the priorities of the unscheduled tasks, and execute the step of determining the target task according to the priorities of the tasks, the requirements of the tasks for various resources, and the current utilization rates of various resources; the successor tasks depend on the target task.
[0044] If it is determined that the status of the target task has changed to the end status (e.g., completed) and there are successor tasks of the target task among the unscheduled tasks, the priorities of the unscheduled tasks can be re-determined. Specifically, the priorities of the unscheduled tasks can be re-determined according to the dependency relationships between the tasks. Then, a series of steps such as determining the target task based on the priorities of the tasks, the requirements of the tasks for various resources, and the current utilization rates of various resources can be executed, that is, steps S12 and subsequent related steps can be executed until the last task is scheduled.
[0045] It should be noted that before re-determining the priorities of the unscheduled tasks, for each subsequent task of the target task, it can be determined whether all the directly dependent tasks of the successor task (that is, all the tasks directly dependent on the successor task, that is, these directly dependent tasks must be completed before the successor task) have been completed. If all the directly dependent tasks of the successor task have been completed, the status of the successor task can be updated to ready, the successor task can be determined as the target task, and the steps for scheduling the target task and subsequent related steps can be executed. That is, when implementing the task status automatic update mechanism, if all the dependencies of a task have been completed, the status of the task is updated to ready, so as to ensure that the task status in the dynamic task queue is always accurate and ensure that the tasks are executed in the correct order. If all the directly dependent tasks of all the successor tasks have not been completed, the priorities of the unscheduled tasks can be re-determined, and a series of steps such as determining the target task based on the priorities of the tasks, the requirements of the tasks for various resources, and the current utilization rates of various resources can be executed.
[0046] Among them, in order to refine task management, task dependency management can be introduced. This task dependency management uses the directed acyclic graph data structure in the task model to detect and manage the dependency relationships of tasks. By introducing a dependency resolver, task dependencies are automatically analyzed and the completion status of dependent tasks is tracked. The dependency resolver checks the dependency list of a task (the dependency list contains all the tasks on which the current task depends, that is, the current task can only be executed after these tasks), and determines whether all the dependent tasks have been completed; for tracking the completion status of dependent tasks, the dependency resolver is responsible for tracking the completion status of dependent tasks and automatically updating the status of the tasks to be executed according to the completion status. If all the dependencies have been completed, the task status is updated to ready, otherwise the task remains in the waiting state.
[0047] S14: If the target task becomes the end status and there are unscheduled tasks but there are no successor tasks of the target task among the unscheduled tasks, execute the step of determining the target task based on the priorities of the tasks, the requirements of the tasks for various resources, and the current utilization rates of various resources.
[0048] If it is determined that the status of the target task changes to the end status and there are unscheduled tasks, but there are no successor tasks of the target task among the unscheduled tasks, then a series of steps such as determining the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources can be executed. That is, steps S12 and subsequent related steps can be executed until the last task is scheduled.
[0049] As can be seen from the above, in the embodiment of the present application, the priorities of each task are determined according to the dependency relationships between tasks, and the currently to-be-scheduled task is determined according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources, realizing dynamic scheduling of tasks, improving the flexibility and accuracy of task scheduling, enabling task scheduling to well adapt to the dynamic changes of the environment, and making full use of system resources. Moreover, in the embodiment of the present application, by introducing task dependency relationship management and establishing a dynamic task queue, the dependency relationships and sequence between tasks can be clearly identified, ensuring that tasks are executed in the correct order and improving the accuracy of task management.
[0050] In the above technical solution disclosed in the embodiment of the present application, the priorities of each task are determined according to the dependency relationships between tasks, and the target task is determined according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources. Then, the target task is scheduled so that the task can be executed. After scheduling the target task, the status of the target task can be monitored. If the target task changes to the end status and there are unscheduled tasks, and there are successor tasks of the target task (i.e., tasks that depend on the target task) among the unscheduled tasks, then the priorities of each unscheduled task can be re-determined, and steps such as determining the target task and subsequent related steps according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources can be executed until the last task is scheduled; if the target task changes to the end status and there are unscheduled tasks but there are no successor tasks of the target task among the unscheduled tasks, then the step of determining the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources can be executed until the last task is scheduled. Through the present application, the priorities of tasks are dynamically determined, and based on the priorities of tasks, the requirements of tasks for resources, and the current resource usage status of the system, the scheduling order of tasks is dynamically adjusted to improve the flexibility, rationality, and accuracy of task scheduling, enabling the task scheduling method to adapt to the dynamic changes of the environment, making full use of system resources, and improving the execution efficiency of the entire system.
[0051] A task scheduling method provided by an embodiment of the present application, which determines the priorities of each task according to the dependency relationships between tasks, may include:
[0052] Determine the total dependency metric of each task according to the dependency relationships between tasks;
[0053] According to the total dependency metrics of each task, the urgency of each task, the priority scores of each task, and the resource requirement values of each task, the weighted scores of each task are determined correspondingly;
[0054] Normalize the weighted scores of each task, and determine the priority of each task according to the normalized weighted scores of each task and the total utilization rate of system resources.
[0055] In the embodiments of the present application, when determining the priority of each task according to the dependency relationship between tasks, a multi-dimensional scoring algorithm can be specifically used to determine the priority of each task.
[0056] First, multi-dimensional scoring factors can be set, and the magnitudes of each task in each dimension of the scoring factors can be obtained:
[0057] 1. Urgency of the task (U): The urgency score of the task can be specifically set by the user or an automated system according to the time sensitivity of the task. Specifically, the urgency of the task (U) can be refined as the reciprocal of the difference between the task deadline and the current time, so as to more accurately reflect the urgency of the task. That is, where ΔT is the difference between the task deadline and the current time. On the basis of refining the urgency of the task as the reciprocal of the difference between the task deadline and the current time, in order to improve the accuracy of scheduling, in step S14, before performing the step of determining the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources, the step of determining the priorities of each task according to the dependency relationship between tasks can be first executed to re-determine the priorities of each unscheduled task, improve the accuracy of determining the priorities of each unscheduled task, and thus improve the accuracy of task scheduling.
[0058] 2. Priority score of the task (P): The priority score of the task specified by the user and / or the system; specifically, where P user is the priority score specified by the user, P default is the default priority score of the system, is the weight coefficient. When only P user or only P default exists is 1, and when P user and P default exist simultaneously the magnitude of
[0059] 3. Dependency complexity of the task (D total, or the total dependency metric of the task): A score for the quantity and complexity of task dependencies. Tasks with more or more complex dependencies will have a higher value. The total dependency metric D of each task is determined specifically according to the dependency relationships between tasks. total .
[0060] 4. Resource requirement value (R) of the task: Score according to the resource requirements of the task. Specifically, the resource requirement value of each task can be determined through the expert experience method.
[0061] Then, for each task, considering the above scoring factors comprehensively, that is, comprehensively considering the total dependency metric D total of the task, the urgency U of the task, the priority score P of the task, and the resource requirement value R of the task, determine the weighted score of the corresponding task.
[0062] After that, perform normalization processing and resource utilization adjustment. Specifically, for each task, normalize the weighted score of the task, and adjust the normalized weighted score according to the current total system resource utilization rate (this data can be directly obtained) to determine the priority S final of the task. Specifically, the priority S final of the task is calculated as follows:
[0063]
[0064] Among them, S max and S min are respectively the highest weighted score and the lowest weighted score among all tasks, S is the weighted score of any task, S norm is the normalized weighted score of this task, and S final is the priority of this task; Z is the current total system resource utilization rate, and exp(-Z) in the form of the Sigmoid function is used for adjustment to smooth the impact of the system resource utilization rate on the final score.
[0065] Through the above process, the multi-dimensional scoring algorithm is used to comprehensively consider the task urgency, the priority set by the user and / or the system, the task dependency complexity, and the resource requirements to determine the task priority, and based on the priority, the resource requirements of the task for various resources, and the current utilization rates of various resources, perform task scheduling, realize the optimization of resource allocation, ensure the effective utilization of resources, and improve the execution efficiency of the entire system.
[0066] In combination with the above process, it can be seen that the embodiment of the present application introduces a real-time response mechanism to dynamically manage tasks, and in the process of implementing the real-time response mechanism, dynamic state process adjustment is performed based on task status, task priority, and resource status, and ultimately intelligent task flow adjustment based on the detection experiment process is achieved to achieve dynamic management of tasks; the specific implementation process is as follows:
[0067] First, an event-driven programming model is adopted to continuously collect various status information about task execution, ensuring real-time updates of task status. Event-driven frameworks (such as Java's EventListener and Python's asyncio) are used to capture events indicating task status changes. The event-driven programming model promptly responds to task status changes through event listeners and callback functions. Next, a multidimensional scoring factor is defined for each task using expert experience, and a multidimensional scoring algorithm is used to comprehensively assess task priority and resource requirements. The multidimensional scoring algorithm comprehensively considers task urgency, user and / or system-set priorities, task dependency complexity, and resource requirements. This allows task scheduling to be dynamically adjusted based on actual conditions, thereby improving the adaptability and accuracy of the task scheduling strategy. Next, the multidimensional scoring algorithm is used to determine task priorities. Target tasks are then identified and scheduled based on their priorities, resource requirements, and current resource utilization, achieving dynamic task management.
[0068] The present invention provides a task scheduling method that determines a weighted score for each task based on the total dependency metric of each task, the urgency of each task, the priority score of each task, and the resource requirement value of each task. The method may include:
[0069] Using S=w u U+w p P+w d ·D total +w r log(1+R), which determines the weighted score of the task;
[0070] Among them, S is the weighted score of the task, U is the urgency of the task, P is the priority score of the task, and D total is the total dependency measure of the task, R is the resource requirement value of the task, and w u 、w p 、w d and w r is the corresponding weight coefficient.
[0071] In the embodiment of the present application, when determining the weighted score of each task based on the total dependency metric of each task, the urgency of each task, the priority score of each task, and the resource requirement value of each task, the weighted score of each task can be calculated using the following formula:
[0072] S = w u ·U + w p ·P + w d ·D total + w r ·log(1 + R)
[0073] Wherein, U is the urgency of the task, P is the priority score of the task, D total is the total dependency measure of the task, R is the resource requirement value of the task, w u , w p , w d and w r are the weight coefficients of the urgency, the weight coefficient of the priority score, the weight coefficient of the total dependency measure, and the weight coefficient of the resource requirement value respectively, and S is the weighted score of the task. Among them, log(1 + R) is used to adjust the influence of the resource requirement on the weighted score to ensure that tasks with extremely high resource requirements do not unconditionally obtain too high a priority.
[0074] Through the above method, it is possible to reasonably and reliably calculate the weighted scores of each task, so as to improve the rationality and reliability of task priority determination, and thus improve the rationality and reliability of task scheduling.
[0075] A task scheduling method provided by an embodiment of the present application, which can determine the total dependency measure of each task according to the dependency relationship between tasks, may include:
[0076] Calculate the total dependency measure of each task according to the direct dependency relationship between tasks and the influence function of environmental variables on the task dependency measure.
[0077] In the embodiment of the present application, when determining the total dependency measure of each task according to the dependency relationship between tasks, specifically, according to the direct dependency relationship between tasks and the influence of environmental variables on the task dependency measure, based on the following calculation formula, calculate the total dependency measure of each task:
[0078]
[0079] Wherein, D total (T i ) is the total dependency measure of task T i , representing the complexity of all uncompleted dependent tasks of task T i . When calculating the total dependency measure of task T i , recursively calculate its direct dependent task T j (that is, the direct dependent task T j must be completed before task T i , task T i directly depends on task T jThe total dependency metric D total (T j )(i.e., recursively calculate the total dependency metric of each dependent task) to ensure that D total (T i ) will include the combined impact of all direct and indirect dependent tasks. Then, based on the total dependency metric D j of the direct dependent task T total (T j ) and the impact of environmental variables on the task dependency metric, use the above formula to calculate the total dependency metric D i of task T total (T i ). For the total dependency metric of task T j , calculate the total dependency metric D j-n of its direct dependent task T total (T j-n ), and then use the above formula to calculate the total dependency metric D j of task T total (T j )... until the basic task is found (i.e., the task does not depend on other tasks). Among them, the total metric of the basic task can be initialized to 0 (or only consider the environmental impact and task weight). Then, based on the dependency relationship between tasks and the impact of environmental variables on the task dependency metric, perform recursive calculation based on the above formula until the total dependency metric D j of task T total (T j ) is calculated. Then, use the above formula to calculate the total dependency metric D i of task T total (T i ).
[0080] In the above formula, D i is the set of direct dependent tasks of task T j , which contains all tasks that must be completed before T i . α is the first adjustment factor, used to adjust the impact of indirect dependencies on the total dependency metric. represents the indirect impact of the total dependency complexity of the direct dependent task T i of T j . The importance of indirect dependencies grows slowly through the square root. In particular, indirect dependencies are indirectly transmitted through D total (T j ) of the direct dependent task, that is, reflects the impact of indirect dependencies. The square root function slows down the speed of the dependency metric increasing with the number of dependent tasks, but can still effectively represent the complexity of indirect dependencies. β is the second adjustment factor, used to adjust the impact of task complexity on the total dependency metric; β·log(Dtotal (T j )+1) is used to adjust the complexity of the dependency metric. The logarithmic function ensures that a large number of dependent tasks does not lead to excessive expansion of the dependency metric while maintaining the influence of the dependency relationship. γ is the third adjustment factor, which is used to balance the weight of the influence of environmental variables. f(E) is the influence function of the environmental variable E, which calculates the influence of the environmental variable on the task dependency metric. The influence function is defined based on a variety of environmental parameters (such as resource availability, system load, etc.) according to expert experience to reflect the actual impact of the environmental state on task execution, such as in, Represents the proportion of available resources in the system, represents the current load, and N represents the network delay. j ) part combines the environment variable E and the task weight W(T j ), f(E) is a function that can be defined based on environmental factors such as resource availability and system load, reflecting the comprehensive impact of external factors on task dependency metrics. The weight W(T j ) represents task T j The weight of .
[0081] Specifically, for each task, initialize its total dependency metric D total (T) is 0, first calculate the basic dependency metric. For each task T i , calculate its initial dependency metric, that is, the number of directly dependent tasks plus the impact of the environment and the task weight; then recursively calculate the total dependency metric of each task, for each task T i Total dependency measure D total (T i ) is the combination of the dependency metrics of its directly dependent tasks; the specific implementation of the recursive method includes if task T i If there is no dependent task, then its total dependency measure is 0 (or only considering the environment impact and task weight), for each task T i , calculate its direct dependent tasks T in turn j The total dependency measure D total (T j ), and use the above formula to calculate T i The total dependency measure D total (T i ).
[0082] For example, suppose there are tasks A, B, C, and D, whose dependencies are: B depends on A, C depends on B, and D depends on A, B, and C; initialize the total dependency metric D for each task total (T) = 0;
[0083] Recursively compute dependency metrics:
[0084] (1) Calculate the total dependency metric of computing task A (assuming task A has no dependent tasks): D total (A) = 0;
[0085] (2) Calculate the total dependency metric of computing task B: The set of directly dependent tasks D B = {A}, calculate D total (B):
[0086]
[0087] Since D total (A) = 0, then D total (B) = 1 + γ·f(E)·W(A);
[0088] (3) Calculate the total dependency metric of computing task C: The set of directly dependent tasks D C = {B}, calculate D total (C):
[0089]
[0090] Use the result recursively calculated by D total (B);
[0091] (4) Calculate the total dependency metric of computing task D: The set of directly dependent tasks D D = {A, B, C}, calculate C total (D):
[0092]
[0093] Use the results recursively calculated by D total (A), D total (B), D total (C).
[0094] Through the above process, the calculation accuracy of the total dependency metric of tasks can be improved, thereby improving the determination accuracy of task priorities, and further improving the accuracy of task scheduling. Among them, the influence of environmental variables is introduced during the calculation of the total dependency metric, making resource utilization more efficient. By calculating the influence of environmental variables and combining task weights, environmental factors (such as resource availability, system load, etc.) can be incorporated into the calculation of task dependency metrics, reflecting the comprehensive influence of external factors on task dependencies and improving the overall adaptability of task scheduling.
[0095] A task scheduling method provided by an embodiment of the present application for re-determining the priorities of each unscheduled task may include:
[0096] Determine the successor tasks of the target task;
[0097] Update the total dependency metrics of each successor task according to the total dependency metrics of each successor task and the total dependency metric of the target task;
[0098] Determine the weighted scores of each unscheduled task corresponding to the urgency of each unscheduled task, the priority scores of each unscheduled task, the resource requirement values of each unscheduled task, the updated total dependency metrics of each unscheduled successor task, and the total dependency metrics of the remaining scheduled tasks;
[0099] Normalize the weighted scores of each unscheduled task, and determine the priorities of each unscheduled task according to the normalized weighted scores of each unscheduled task and the total system resource utilization rate.
[0100] In a dynamically changing environment, traditional dependency parsing methods cannot efficiently handle task dependencies, especially when tasks are frequently added or deleted. Therefore, the embodiments of the present application introduce a dynamic dependency parsing algorithm. The specific implementation process of this dynamic dependency parsing algorithm is as follows:
[0101] First, define the data structure of the dependency relationship. For example, use a directed acyclic graph to store tasks and task dependencies as mentioned above. Each node represents a task, and the directed edges between nodes represent the dependency relationships between tasks; use an adjacency list to implement the directed acyclic graph. Each node maintains a list of dependent tasks and a list of tasks that are depended on (i.e., the successor task list). That is, at each node, its task dependency list and the list of tasks that are depended on are included. The dependency list contains all the tasks that the current task depends on, that is, the current task can only be executed after these tasks; the list of tasks that are depended on contains all the tasks that depend on the current task, that is, these tasks can only be executed after the current task is completed. Then update the task dependency metrics. When a new task is added or an existing task is updated, update the dependency metrics of the affected tasks. Among them, the total dependency metric of a task is recursively calculated using the influence function of the direct dependency relationship between tasks and environmental variables mentioned above.
[0102] Whenever the state of a scheduled task changes (such as completion), traverse the successor task list of this task and update the direct dependency status of these tasks. If all the direct dependent tasks of a task have been completed, the task state is updated to ready. For each completed task, update the total dependency metric of its successor tasks. Then, use a multi-dimensional scoring algorithm to re-determine the priorities of each unscheduled task based on the updated total dependency metrics of the successor tasks and the total dependency metrics of the remaining unscheduled tasks. After that, step S12 and related steps can be executed.
[0103] Specifically, when it is determined that the target task has become an end state and there are successor tasks of the target task among the unscheduled tasks, the specific process of re-determining the priorities of the unscheduled tasks can be as follows: First, determine the successor tasks of the target task. Here, the successor tasks depend on the target task, and the dependencies mentioned here include direct dependencies and indirect dependencies. Then, update the total dependency metrics of the successor tasks of the target task according to the total dependency metrics of each subsequent task and the total dependency metric of the target task, and obtain the updated total dependency metric D of each successor task. total-new . After that, according to the urgency of each unscheduled task (including the successor tasks of the target task and the remaining unscheduled tasks), the priority scores of each unscheduled task, the resource requirement values of each unscheduled task, the updated total dependency metric D of each successor task total-new , and the total dependency metric of the remaining unscheduled tasks, the weighted scores of each unscheduled task are determined accordingly. That is, for each successor task of the target task, the weighted scores of each successor task can be determined according to the urgency of each successor task, the priority score of each successor task, the resource requirement value of each successor task, and the updated total dependency metric of each successor task; for each of the remaining unscheduled tasks, the weighted scores of each of the remaining unscheduled tasks can be determined according to the urgency of each of the remaining unscheduled tasks, the priority score of each of the remaining unscheduled tasks, the resource requirement value of each of the remaining unscheduled tasks, and the total dependency metric of each of the remaining unscheduled tasks. And, normalize the weighted scores of each unscheduled task, and then determine the priorities of each unscheduled task according to the normalized weighted scores of each unscheduled task and the total system resource utilization rate. Among them, the specific implementation process from determining the weighted scores of each unscheduled task to determining the priorities of each unscheduled task can refer to the detailed description of the part of determining the priorities of each task using the multi-dimensional scoring algorithm above, which will not be elaborated here. The difference is that here, when calculating the weighted scores of the successor tasks of the target task, the corresponding updated total dependency metric D total-new is involved in the calculation, while when calculating the weighted scores of the remaining unscheduled tasks, the corresponding total dependency metric D total can still be involved in the calculation.
[0104] By implementing the above process to re-determine the priorities of unscheduled tasks, only the total dependency metrics of the successor tasks of the target task are updated, rather than recalculating the total metrics of all unscheduled tasks, so as to reduce the computational amount and significantly improve the task scheduling efficiency. Moreover, the dynamic dependency resolution algorithm ensures that the execution order of tasks is always based on the latest dependency relationship information by precisely tracking and updating the dependency status of tasks, increasing the scheduling accuracy and providing the possibility for flexible adjustment of the scheduling strategy. In the embodiments of the present application, by defining a clear dependency relationship data structure and update rules, the management of task dependency relationships is simplified, enabling developers and system administrators to more easily understand and operate the task scheduling system and reducing the complexity of system management.
[0105] A task scheduling method provided by an embodiment of the present application, which updates the total dependency metrics of each successor task according to the total dependency metrics of each successor task of the target task and the total dependency metric of the target task, may include:
[0106] Update the total dependency metric of the successor task according to the total dependency metric of the successor task, the total dependency metric of the target task, and the association degree between the successor task and the target task.
[0107] In the embodiments of the present application, when updating the total dependency metrics of each successor task according to the total dependency metrics of each successor task of the target task and the total dependency metric of the target task, specifically, the total dependency metric of the successor task may be updated according to the total dependency metric of the successor task, the total dependency metric of the target task, and the association degree between the successor task and the target task.
[0108] Specifically, for each completed task T k , the following formula is used to update the total dependency metric of its successor task T q :
[0109]
[0110] Among them, D total (T q ) is the total dependency metric of task T q , which is expressed as the sum of the number of all uncompleted dependent tasks of task T q plus the weighted sum of other influencing factors; D total (T q ) new is the updated total dependency metric of task T q , reflecting the new value after the completed task T k affects the dependency status of task T q ; α is the first adjustment factor (or the influence factor of indirect dependency) used to adjust the contribution size of indirect dependency to the total dependency metric; D total (T k) is the total dependency metric for ending task T k ; β is the second adjustment factor used to adjust the impact of task complexity on the total dependency metric; δ is the fourth adjustment factor used to balance the impact of task weight and correlation on the dependency metric; W(T k ) is the execution weight of task T k , reflecting the importance or priority of task execution; C(T q ,T k ) is the correlation degree between task T q and task T k , quantifying the correlation strength or dependency depth between two tasks. A higher correlation degree means that task T k has a more direct or stronger impact on task T q , determined based on the task relationship graph and business logic, and calculated by analyzing the dependency relationship and data flow between tasks through empirical methods; if D total (T q ) new is 0, then the status of task T q is updated to ready.
[0111] Through the above process, the total dependency metric of the successor tasks of the target task can be accurately updated to achieve efficient processing of task dependencies and task scheduling.
[0112] A task scheduling method provided by an embodiment of the present application, after determining the total dependency metric of each task according to the dependency relationship between tasks, may further include:
[0113] If a new task and / or an unscheduled task is deleted, it is determined whether the new task and / or the deleted unscheduled task causes a change in the total dependency metric of the unscheduled tasks;
[0114] If so, determine the total dependency metric of the affected tasks among the unscheduled tasks, and determine the total dependency metric of the new task when a new task is added, and execute the step of correspondingly determining the weighted score of each task according to the total dependency metric, the urgency degree, the priority score, and the resource requirement value of each task.
[0115] In an embodiment of the present application, the dynamic task queue supports update operations such as real-time addition and deletion of tasks. After determining the total dependency metric of each task according to the dependency relationship between tasks, if a new task is added to the dynamic task queue and / or an unscheduled task in the dynamic task queue is deleted, it can be determined whether the new task and / or the deleted unscheduled task causes a change in the total dependency metric of the unscheduled tasks. Specifically, whether the total dependency metric of the unscheduled tasks changes can be determined according to the above total dependency metric calculation and update method.
[0116] If the newly added tasks and / or the deleted unscheduled tasks do not cause a change in the total dependency metric of each unscheduled task, then when adding a new task, the total dependency metric of the newly added task can be calculated, and the step of corresponding to determine the weighted score of each task according to the total dependency metric of each task, the urgency of each task, the priority score of each task, and the resource requirement value of each task can be returned. Then, the step of determining the target task according to the priority of each task, the demand of each task for various resources, and the current utilization rate of various resources can be executed, so as to achieve task scheduling in the case of adding and / or deleting unscheduled tasks.
[0117] If the newly added tasks and / or the deleted unscheduled tasks cause a change in the total dependency metric among the unscheduled tasks, then the tasks whose total dependency metric will change accordingly can be determined as affected tasks, and the total dependency metric of the affected tasks among the unscheduled tasks can be determined, and when adding a new task, the total dependency metric of the newly added task can be determined. Then, the step of corresponding to determine the weighted score of each task according to the total dependency metric of each task, the urgency of each task, the priority score of each task, and the resource requirement value of each task can be executed. After that, the step of determining the target task according to the priority of each task, the demand of each task for various resources, and the current utilization rate of various resources can be executed, so as to achieve task scheduling in the case of adding and / or deleting unscheduled tasks.
[0118] Among them, when a task is added to the dynamic task queue, the dependency resolver automatically analyzes the dependencies of the task and decides whether the task should be executed immediately or wait. The dependency resolver will check the dependency list of the task to determine whether all dependent tasks have been completed. And in a dynamic task environment with frequent addition or deletion of tasks, the introduced dynamic dependency resolution algorithm can efficiently handle task dependency relationships.
[0119] In addition, when adding a new task, a topological sorting check can be performed on the directed acyclic graph to ensure that no cycle is formed. If a cycle is detected, the newly added task is rejected. That is, when adding a dependency relationship, a topological sorting check is performed on the directed acyclic graph. If a cycle is detected, the addition of the dependency relationship is rejected.
[0120] By the above method, when adding a new task and / or deleting an unscheduled task, only the total dependency metric of the affected tasks is updated, rather than recalculating the total dependency metric of all tasks, so as to reduce the calculation amount and significantly improve the task scheduling efficiency. And by introducing the dynamic dependency resolution algorithm and the dependency resolver, the task dependency relationship can be efficiently processed. Especially in a dynamic changing environment with frequent addition or deletion of tasks, the affected tasks can be quickly determined and their states can be updated to ensure the efficient processing of the task dependency relationship.
[0121] A task scheduling method provided by an embodiment of the present application determines a target task according to the priorities of tasks, the requirements of tasks for various resources, and the current utilization rates of various resources, and may include:
[0122] Construct a task-resource matrix according to the requirements of each task for various resources, and construct a resource utilization rate matrix according to the current utilization rates of various resources;
[0123] Construct a task priority matrix according to the priorities of each task, and expand the task priority matrix; the number of rows and columns of the expanded task priority matrix corresponds to the number of rows and columns of the task resource matrix;
[0124] Obtain a task-resource dynamic adjustment matrix according to the task-resource matrix, the resource utilization rate matrix, and the expanded task priority matrix; the task-resource dynamic adjustment matrix represents the comprehensive priority of task and resource allocation;
[0125] Determine the target task according to the task-resource dynamic adjustment matrix.
[0126] In the embodiment of the present application, the process of determining the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources may be: according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources, adopt a task resource dynamic balance scheduling algorithm to determine the target task. Among them, the task resource dynamic balance scheduling algorithm performs comprehensive evaluation and dynamic adjustment of tasks and resources through matrix operations, considering the priorities of tasks, resource requirements, and the current resource usage status of the system. The specific implementation process is as follows:
[0127] First, construct a task-resource matrix M according to the requirements of each task for various resources. Each element m ij represents the requirement of task T i for resource R j and is determined according to expert experience; m represents the number of tasks, and n represents the types of resources;
[0128]
[0129] Construct a resource utilization rate matrix L according to the current utilization rates of various resources. Each element l j represents the current utilization rate of resource R j :
[0130]
[0131] Construct a task priority matrix P according to the current utilization rates of various resources. Each element p i represents the priority of task T i , that is, S final (Ti ):
[0132]
[0133] Expand the task priority matrix P: where 1 n is a row vector of all 1s with length n. The expanded task priority matrix P' is an m*n matrix, and its number of rows and columns corresponds to those of the task-resource matrix M.
[0134] According to the task-resource matrix M, the resource utilization matrix L, and the expanded task priority matrix P', calculate the task-resource dynamic adjustment matrix G through matrix operations. This task-resource dynamic adjustment matrix G represents the comprehensive priority of task and resource allocation and is used to dynamically adjust task scheduling and resource allocation:
[0135]
[0136] where L T is the transpose of the resource utilization matrix L. The task-resource dynamic adjustment matrix G is an m*n matrix, and the element g ij represents the comprehensive priority of task T i on resource R j .
[0137] Furthermore, calculate the sum of each row element in the task-resource dynamic adjustment matrix G to obtain the sum of the comprehensive priorities of each task for all resources (that is, in the task-resource dynamic adjustment matrix G, the sum of each row element is the sum of the comprehensive priorities of the corresponding task for all resources), and determine the task with the largest sum of the comprehensive priorities for all resources as the target task.
[0138] As can be seen from the above, this application introduces a monitoring mechanism to track and update the status of tasks in the dynamic task queue in real time. Each task is assigned a unique identifier, ensuring the traceability of tasks and the accuracy of management. The multi-dimensional scoring factors are defined using the expert experience method, and the priority and resource requirements of tasks are comprehensively evaluated through the multi-dimensional scoring algorithm. The multi-dimensional scoring algorithm combines the urgency of tasks, the priority scores of users and / or systems, the dependency complexity, and resource requirements, ensuring that task scheduling can be dynamically adjusted according to the actual situation, improving the adaptability and accuracy of the task scheduling strategy. The task-resource dynamic balance scheduling algorithm is adopted to comprehensively evaluate and dynamically adjust tasks and resources through matrix operations, considering the priority of tasks, resource requirements, and the current resource usage status of the system, and dynamically adjusting the scheduling order of tasks to ensure that high-priority tasks obtain resources first.
[0139] The embodiment of this application also provides a task scheduling device. See Figure 2, which shows a schematic structural diagram of a task scheduling device provided by an embodiment of the present application, may include:
[0140] The first determination module 21 is configured to determine the priorities of each task according to the dependency relationships between tasks;
[0141] The determination and scheduling module 22 is configured to determine a target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources, schedule the target task, and monitor the status of the target task;
[0142] The second determination module 23 is configured to, if the target task becomes an end state and there are successor tasks of the target task among the unscheduled tasks, re-determine the priorities of each unscheduled task, and perform the step of determining the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources; the successor tasks depend on the target task;
[0143] The execution module 24 is configured to, if the target task becomes an end state and there are unscheduled tasks but there are no successor tasks of the target task among the unscheduled tasks, perform the step of determining the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources.
[0144] For a task scheduling device provided by an embodiment of the present application, the first determination module 21 may include:
[0145] The first determination sub-module is configured to determine the total dependency metric of each task according to the dependency relationships between tasks;
[0146] The second determination sub-module is configured to correspondingly determine the weighted score of each task according to the total dependency metric of each task, the urgency of each task, the priority score of each task, and the resource requirement value of each task;
[0147] The third determination sub-module is configured to perform normalization processing on the weighted scores of each task, and determine the priorities of each task according to the normalized weighted scores of each task and the total utilization rate of system resources.
[0148] For a task scheduling device provided by an embodiment of the present application, the second determination sub-module may include:
[0149] The first determination sub-unit is configured to use S = w u ·U + w p ·P + w d ·D total + w r ·log(1 + R) to determine the weighted score of the task;
[0150] where S is the weighted score of the task, U is the urgency of the task, P is the priority score of the task, Dtotal is the total dependency metric of the task, R is the numerical value of the resource requirement of the task, and w u , w p , w d and w r are the corresponding weight coefficients.
[0151] A task scheduling device provided by an embodiment of the present application, the first determination sub-module may include:
[0152] A calculation subunit, configured to calculate the total dependency metric of each task according to the direct dependency relationship between tasks and the influence function of environmental variables on the task dependency metric.
[0153] A task scheduling device provided by an embodiment of the present application, the second determination module 23 may include:
[0154] A fourth determination sub-module, configured to determine the successor tasks of the target task;
[0155] An update sub-module, configured to update the total dependency metric of each successor task according to the total dependency metric of each successor task and the total dependency metric of the target task;
[0156] A fifth determination sub-module, configured to determine the weighted scores of each unscheduled task according to the urgency of each unscheduled task, the priority score of each unscheduled task, the numerical value of the resource requirement of each unscheduled task, the updated total dependency metric of each unscheduled successor task, and the total dependency metric of the remaining scheduled tasks;
[0157] A sixth determination sub-module, configured to perform normalization processing on the weighted scores of each unscheduled task, and determine the priority of each unscheduled task according to the normalized weighted scores of each unscheduled task and the total utilization rate of system resources.
[0158] A task scheduling device provided by an embodiment of the present application, the update sub-module may include:
[0159] An update subunit, configured to update the total dependency metric of the successor task according to the total dependency metric of the successor task, the total dependency metric of the target task, and the association degree between the successor task and the target task.
[0160] A task scheduling device provided by an embodiment of the present application, the first determination module 21 may further include:
[0161] A judgment sub-module, configured to, if a new task and / or an unscheduled task is deleted, judge whether the total dependency metric of the unscheduled task changes due to the newly added task and / or the deleted unscheduled task;
[0162] A seventh determination sub-module, configured to determine the total dependency metric of the affected tasks among the unscheduled tasks if the addition of tasks and / or the deletion of unscheduled tasks causes a change in the total dependency metric of the unscheduled tasks, determine the total dependency metric of the added tasks when adding tasks, and execute the step of correspondingly determining the weighted scores of the tasks according to the total dependency metrics, the urgency levels, the priority scores, and the resource requirement values of the tasks.
[0163] A task scheduling device provided by an embodiment of the present application, the determination scheduling module 22 may include:
[0164] A first construction sub-module, configured to construct a task-resource matrix according to the requirements of each task for various resources, and construct a resource utilization rate matrix according to the current utilization rates of various resources;
[0165] A second construction sub-module, configured to construct a task priority matrix according to the priorities of the tasks, and expand the task priority matrix; the number of rows and columns of the expanded task priority matrix is the same as the number of rows and columns of the task resource matrix;
[0166] An eighth determination sub-module, configured to obtain a task-resource dynamic adjustment matrix according to the task-resource matrix, the resource utilization rate matrix, and the expanded task priority matrix; the task-resource dynamic adjustment matrix represents the comprehensive priority of task and resource allocation;
[0167] A ninth determination sub-module, configured to determine a target task according to the task-resource dynamic adjustment matrix.
[0168] An embodiment of the present application further provides a task scheduling device. Refer to Figure 3 , which shows a schematic structural diagram of a task scheduling device provided by an embodiment of the present application, and may include:
[0169] A memory 31, configured to store a computer program;
[0170] A processor 32, configured to implement the following steps when executing the computer program stored in the memory 31:
[0171] Determine the priorities of each task according to the dependency relationships among the tasks; determine the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources, schedule the target task, and monitor the status of the target task; if the target task becomes the end state and there are successor tasks of the target task among the unscheduled tasks, re-determine the priorities of each unscheduled task, and execute the step of determining the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources; if the current target task becomes the end state and there are unscheduled tasks but there are no successor tasks of the target task among the unscheduled tasks, execute the step of determining the target task according to the priorities of each task, the requirements of each task for various resources, and the current utilization rates of various resources.
[0172] For the description of the relevant parts in a task scheduling device and equipment provided in an embodiment of the present application, reference may be made to the detailed description of the corresponding parts in a task scheduling method provided in an embodiment of the present application, which will not be elaborated herein.
[0173] It should be noted that the logic and / or steps represented in the flowchart or described in other ways herein, for example, can be considered as a sequenced list of executable instructions for implementing logical functions, and can be specifically implemented in any computer-readable medium for use by an instruction execution system, apparatus, or device (such as a computer-based system, a system including a processor, or other systems that can fetch and execute instructions from the instruction execution system, apparatus, or device), or in combination with these instruction execution systems, apparatus, or devices. For the purposes of this specification, a "computer-readable medium" can be any device that can contain, store, communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. More specific examples (non-exhaustive list) of computer-readable media include the following: an electrical connection portion with one or more wirings (electronic device), a portable computer diskette (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber device, and a portable compact disc read-only memory (CDROM). Additionally, the computer-readable medium can even be paper or other suitable media on which the program can be printed, because the program can be obtained electronically, for example, by optically scanning the paper or other media, followed by editing, interpretation, or other appropriate processing as necessary, and then stored in a computer memory.
[0174] It should be understood that each part of the present application can be implemented by hardware, software, firmware, or a combination thereof. In the above embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, any one or a combination of the following techniques well known in the art can be used: discrete logic circuits having logic gate circuits for implementing logical functions on data signals, application specific integrated circuits having appropriate combinational logic gate circuits, programmable gate arrays (PGAs), field programmable gate arrays (FPGAs), etc.
[0175] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples", etc. means that the specific features, structures, materials, or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials, or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0176] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be construed as indicating or implying relative importance or implicitly specifying the quantity of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include at least one of the features. In the description of the present application, the meaning of "a plurality" is at least two, such as two, three, etc., unless otherwise specifically and clearly defined.
[0177] In the present application, unless otherwise clearly specified and limited, terms such as "installed", "connected", "connected to", "fixed", etc. should be understood in a broad sense. For example, it can be a fixed connection, a detachable connection, or integrated; it can be a mechanical connection or an electrical connection; it can be directly connected or indirectly connected through an intermediate medium, and it can be the communication inside two elements or the interaction relationship between two elements, unless otherwise clearly limited. For those of ordinary skill in the art, the specific meanings of the above terms in the present application can be understood according to specific circumstances.
[0178] Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and should not be construed as limiting the present application. Those of ordinary skill in the art can make changes, modifications, substitutions, and variations to the above embodiments within the scope of the present application.
Claims
1. A task scheduling method, characterized in that, Including: Determine the priority of each of the tasks according to the dependency relationship between the tasks; Determine a target task according to the priority of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rate of various resources, schedule the target task, and monitor the status of the target task; If the target task becomes in an end state and there are successor tasks of the target task among the unscheduled tasks, re-determine the priority of each of the unscheduled tasks, and execute the step of determining the target task according to the priority of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rate of various resources; the successor tasks depend on the target task; If the target task becomes in an end state and there are unscheduled tasks but there are no successor tasks of the target task among the unscheduled tasks, execute the step of determining the target task according to the priority of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rate of various resources.
2. The task scheduling method according to claim 1, wherein Determine the priority of each of the tasks according to the dependency relationship between the tasks, including: Determine the total dependency metric of each of the tasks according to the dependency relationship between the tasks; Correspondingly determine the weighted score of each of the tasks according to the total dependency metric of each of the tasks, the urgency of each of the tasks, the priority score of each of the tasks, and the resource requirement value of each of the tasks; Perform a normalization process on the weighted scores of each of the tasks, and determine the priority of each of the tasks according to the normalized weighted scores of each of the tasks and the total utilization rate of system resources.
3. The task scheduling method according to claim 2, wherein, Correspondingly determine the weighted score of each of the tasks according to the total dependency metric of each of the tasks, the urgency of each of the tasks, the priority score of each of the tasks, and the resource requirement value of each of the tasks, including: Using S = w u ·U + w p ·P + w d ·D total + w r ·log(1 + R), determine the weighted score of the said task; Among them, S is the weighted score of the task, U is the urgency of the task, P is the priority score of the task, D total is the total dependency measure of the task, R is the resource requirement value of the task, w u 、w p 、w d and w r are the corresponding weight coefficients.
4. The task scheduling method according to claim 2, wherein Determine the total dependency metric of each of the tasks according to the dependency relationship between the tasks, including: Calculate the total dependency metric of each of the tasks according to the direct dependency relationship between the tasks and the influence function of environmental variables on the task dependency metric.
5. The task scheduling method according to any one of claims 2-4, characterized in that, Re-determine the priority of each of the unscheduled tasks, including: Determine the successor tasks of the target task; Update the total dependency metric of each of the successor tasks according to the total dependency metric of each of the successor tasks and the total dependency metric of the target task; Correspondingly determine the weighted score of each of the unscheduled tasks according to the urgency of each of the unscheduled tasks, the priority score of each of the unscheduled tasks, the resource requirement value of each of the unscheduled tasks, the updated total dependency metric of each of the successor tasks, and the total dependency metric of the remaining unscheduled tasks; Perform a normalization process on the weighted scores of each of the unscheduled tasks, and determine the priority of each of the unscheduled tasks according to the normalized weighted scores of each of the unscheduled tasks and the total utilization rate of system resources.
6. The task scheduling method according to claim 5, wherein Update the total dependency metric of each of the successor tasks of the target task according to the total dependency metric of each of the successor tasks of the target task and the total dependency metric of the target task, including: Update the total dependency metric of the successor task according to the total dependency metric of the successor task, the total dependency metric of the target task, and the association degree between the successor task and the target task.
7. The task scheduling method according to claim 5, wherein After determining the total dependency metrics of each of the tasks according to the dependencies between the tasks, it further includes: If a new task and / or an unscheduled task is deleted, determine whether the new task and / or the deleted unscheduled task causes a change in the total dependency metrics of the unscheduled tasks; If so, determine the total dependency metrics of the affected tasks among the unscheduled tasks, and when a new task is added, determine the total dependency metrics of the added task, and perform the step of correspondingly determining the weighted scores of each of the tasks according to the total dependency metrics of each of the tasks, the urgency levels of each of the tasks, the priority scores of each of the tasks, and the resource requirement values of each of the tasks.
8. The task scheduling method according to claim 1, wherein Determining a target task according to the priorities of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rates of various resources includes: Construct a task-resource matrix according to the requirements of each of the tasks for various resources, and construct a resource utilization rate matrix according to the current utilization rates of various resources; Construct a task priority matrix according to the priorities of each of the tasks, and expand the task priority matrix; the number of rows and columns of the expanded task priority matrix is the same as the number of rows and columns of the task resource matrix; According to the task-resource matrix, the resource utilization rate matrix, and the expanded task priority matrix, obtain a task-resource dynamic adjustment matrix; the task-resource dynamic adjustment matrix represents the comprehensive priority of task and resource allocation; Determine the target task according to the task-resource dynamic adjustment matrix.
9. A task scheduling device, characterized in that, It includes: A first determination module, configured to determine the priorities of each of the tasks according to the dependencies between the tasks; A determination and scheduling module, configured to determine a target task according to the priorities of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rates of various resources, schedule the target task, and monitor the status of the target task; A second determination module, configured to, if the target task becomes an end state and there are successor tasks of the target task among the unscheduled tasks, re-determine the priorities of each of the unscheduled tasks, and perform the step of determining a target task according to the priorities of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rates of various resources; the successor tasks depend on the target task; An execution module, configured to, if the target task becomes an end state and there are unscheduled tasks but there are no successor tasks of the target task among the unscheduled tasks, perform the step of determining a target task according to the priorities of each of the tasks, the requirements of each of the tasks for various resources, and the current utilization rates of various resources.
10. A task scheduling device, characterized in that, It includes: A memory, configured to store a computer program; A processor, configured to implement the steps of the task scheduling method according to any one of claims 1 to 8 when executing the computer program.