A task scheduling method, device, computer program product and storage medium

By calculating the available concurrency and prioritizing the scheduling of dequeued tasks, the problem of resource waste in task scheduling is solved, and efficient utilization and fair allocation of resources are achieved.

CN122152469APending Publication Date: 2026-06-05NEUSOFT CORP
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
NEUSOFT CORP
Filing Date
2026-03-06
Publication Date
2026-06-05

AI Technical Summary

Technical Problem

In existing technologies, task scheduling methods lead to resource waste and low utilization efficiency. When the workload of a certain type of task is very small, resources are idle, but when the workload is very large, the idle resources cannot be used.

Method used

By calculating the available concurrency, and based on the number of waiting spaces and the total number of system tasks, tasks in the target workspace or waiting space are dequeued first to ensure reasonable allocation and utilization of resources.

Benefits of technology

It achieves efficient use of limited resources, avoids resource waste and task blockage, ensures fair access to resources for each workspace, and improves overall resource utilization efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122152469A_ABST
    Figure CN122152469A_ABST
Patent Text Reader

Abstract

The application discloses a task scheduling method and device, a computer program product and a storage medium. Based on the number of workspaces without running tasks, and the total number of running tasks and the maximum concurrency, the available concurrency is calculated. The resource allocation has a clear quantitative basis, improves the rationality of distribution, reduces resource idling and task blocking. Based on the available concurrency, the task dequeuing strategy is configured, the queued tasks in the workspace with the least number of running tasks are dequeued, and the tasks in the workspace without running tasks are dequeued. Realize flexible and fair task scheduling in the limited resource and multi-workspace scene, and make the workspace with the least number of running tasks obtain resource inclination to start tasks. The dequeued tasks match the available concurrency, avoiding resource depletion and task running lag after task dequeuing. Efficiently use limited resources, flexibly adjust resource allocation and task dequeuing, give each space the opportunity to run tasks, solve the problem of resource waste, and improve the overall utilization efficiency of resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of data processing technology, and in particular to a method, apparatus, computer program product, and storage medium for task scheduling. Background Technology

[0002] Large-scale integrated software systems such as data platforms and business platforms generate a large number of concurrent tasks with uneven resource consumption during daily operation. Each task relies on the underlying hardware resources of the system to run. However, the total amount of underlying hardware resources of the system is limited. When all concurrent tasks share this resource pool, a scheduling strategy is needed to run all tasks in a reasonable manner.

[0003] In existing technologies, there are methods for setting fixed resource usage limits for various tasks. However, this approach can lead to idle resources within the allocated limit when a certain type of task has a very low workload. Conversely, when a certain type of task has a very high workload, it can only wait in a queue and cannot use the idle resources, resulting in resource waste and low utilization efficiency. Summary of the Invention

[0004] To address the aforementioned problems, this application provides a task scheduling method, apparatus, computer program product, and storage medium to solve the problem of resource waste, enable the rational use of idle resources, and improve the overall efficiency of resource utilization.

[0005] This application discloses a task scheduling method, the method comprising: If queued tasks are allowed to be dequeued for execution, the available concurrency is calculated based on the number of waiting spaces, the total number of tasks currently running in the system, and the preset maximum concurrency; the waiting space is a workspace without any running tasks; the number of workspaces in a service is a preset value; Based on the available concurrency, tasks are dequeued from the target workspace or from the waiting space; the target workspace is the workspace with the fewest running tasks; the number of tasks dequeued is related to the available concurrency. Run the dequeueing task.

[0006] Optionally, allowing queued tasks to be dequeued includes: Obtain the total number of tasks and the maximum concurrency; If the total number of tasks is less than the maximum concurrency, it is determined that the queued tasks can be dequeued.

[0007] Optionally, the calculation of available concurrency based on the number of waiting spaces, the total number of tasks running in the system, and the preset maximum concurrency includes: Obtain the difference between the maximum concurrency and the total number of tasks; Obtain the number of waiting spaces, and obtain the product of the number of waiting spaces and the preset number of concurrent space reservations; Subtracting the difference from the product yields the available concurrency.

[0008] Optionally, dequeuing the queued tasks in the target workspace or dequeuing the tasks in the waiting space based on the available concurrency includes: If the available concurrency is greater than 0, the queued tasks in the target workspace will be dequeued. If the available concurrency is less than or equal to 0, the tasks in the waiting space will be dequeued.

[0009] Optionally, dequeuing the queued tasks in the target workspace includes: Obtain the target workspace from each queuing space; the queuing space is the workspace where the queued task exists. Obtain the quotient of the available concurrency and the adjustment number, and round the quotient up to the integer to obtain the number of tasks to be dequeued; the adjustment number is preset based on the requirements for task dequeuing efficiency; In the target workspace, several queued tasks are dequeued.

[0010] Optionally, dequeuing tasks from the waiting space includes: The remaining concurrency is obtained by obtaining the difference between the maximum concurrency and the total number of tasks. In the waiting space, take less than or equal to the remaining number of concurrent tasks to dequeue.

[0011] Optionally, before calculating the available concurrency, the method further includes: Tasks from each workspace are uploaded to a queue list; the queue list includes tasks currently running in the system and queued tasks awaiting execution. The scheduler scans the queue list at a preset frequency to obtain the total number of tasks and the queued tasks, and controls the tasks to leave the queue.

[0012] Based on the above-mentioned task scheduling method, this application also discloses a task scheduling apparatus, including: a computing unit, a dequeueing unit, and a running unit; The computing unit is used to calculate the available concurrency based on the number of waiting spaces, the total number of tasks currently running in the system, and the preset maximum concurrency, provided that queued tasks can be dequeued for execution; the waiting space is a workspace without any running tasks; the number of workspaces in a service is a preset value; The dequeue unit is used to dequeue the queued tasks in the target workspace or the tasks in the waiting space based on the available concurrency; the target workspace is the workspace with the fewest running tasks; the number of tasks dequeued is related to the available concurrency. The operating unit is used to run the dequeueing task.

[0013] Optionally, the computing unit includes: A sub-unit is used to obtain the total number of tasks and the maximum concurrency. A sub-unit is defined to determine whether the queued tasks can be dequeued if the total number of tasks is less than the maximum concurrency.

[0014] Optionally, the computing unit includes: The difference sub-unit is used to obtain the difference between the maximum concurrency and the total number of tasks; The multiplication subunit is used to obtain the number of waiting spaces and the product of the number of waiting spaces and the preset number of space-reserved concurrency. The subtraction subunit is used to subtract the difference from the product to obtain the available concurrency.

[0015] Optionally, the dequeue unit includes: The first dequeue subunit is used to dequeue the queued tasks in the target workspace when the available concurrency is greater than 0. The second dequeue subunit is used to dequeue tasks from the waiting space when the available concurrency is less than or equal to 0.

[0016] Optionally, the first dequeue subunit includes: A target acquisition subunit is used to acquire the target workspace in each queuing space; the queuing space is the workspace where the queued task exists. The integer sub-unit is used to obtain the quotient of the available concurrency and the adjustment number, and round the quotient up to the integer to obtain the number of tasks to be dequeued; the adjustment number is preset based on the requirements for task dequeuing efficiency; The target dequeue subunit is used to dequeue several of the queued tasks from the target workspace.

[0017] Optionally, the second dequeue subunit includes: The remaining acquisition subunit is used to obtain the difference between the maximum concurrency and the total number of tasks to get the remaining concurrency. The waiting dequeue subunit is used to dequeue less than or equal to the remaining number of concurrent tasks in the waiting space.

[0018] Optionally, the device further includes: An upload unit is used to upload tasks from each workspace to a queue list; the queue list includes tasks currently running in the system and queued tasks waiting to be run. The scanning unit is used to scan the queue list at a preset frequency through the scheduler to obtain the total number of tasks and the queued tasks, and to control the tasks to leave the queue.

[0019] Based on the above-described task scheduling method, this application also discloses a computer program product, which includes a computer program that, when run by a processor, is used to implement the above-described method.

[0020] Based on the above-described task scheduling method, this application also discloses a storage medium for storing computer program instructions, which, when executed by a central processing unit, can implement the steps of the above-described method.

[0021] This application discloses a task scheduling method, apparatus, computer program product, and storage medium. Based on the number of workspaces without currently running tasks (i.e., waiting spaces), the total number of tasks currently running in the system, and the preset maximum concurrency, the available concurrency is calculated. This provides a clear quantitative basis for resource allocation, improving allocation rationality and reducing resource idleness and task blocking caused by unreasonable resource allocation. A differentiated task dequeueing strategy is configured, dequeuing tasks from the workspace with the fewest currently running tasks (i.e., the target workspace) or tasks from the waiting space based on the available concurrency. This achieves flexible and fair task scheduling in scenarios with limited resources and multiple workspaces, giving resource priority to workspaces with fewer running tasks, enabling timely task startup. Furthermore, the number of tasks to be dequeued is determined based on the available concurrency, matching the dequeued tasks with the system's current task capacity, avoiding resource exhaustion and task lag after dequeuing, and ensuring that limited resources are always used efficiently. The task scheduling logic of this application always prioritizes the workspace with the fewest running tasks, flexibly adjusts resource allocation and task dequeueing, and gives each workspace the opportunity to run tasks. This not only solves the problem of resource waste and allows idle resources to be used rationally, improving the overall efficiency of resource utilization, but also promotes the orderly progress of various business operations. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0023] Figure 1 This is a flowchart illustrating a task scheduling method disclosed in an embodiment of this application; Figure 2 This is a flowchart illustrating another task scheduling method disclosed in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a task scheduling device disclosed in an embodiment of this application. Detailed Implementation

[0024] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0025] Example 1: This application discloses a task scheduling method.

[0026] For details, please refer to Figure 1 The task scheduling method disclosed in this embodiment includes the following steps: Step 101: If it is allowed to dequeue tasks for execution, calculate the available concurrency based on the number of waiting spaces, the total number of tasks running in the system, and the preset maximum concurrency.

[0027] In the method of this embodiment, the system can be a large-scale integrated software system such as a data platform or a business platform. Such systems typically have a modular architecture design, meaning they contain multiple functionally independent modules, each responsible for handling a specific type of task (such as a data acquisition module, a data calculation module, a report generation module, etc.). Furthermore, to meet the isolation requirements of multiple business lines and departments, the system will also divide the system into multiple workspaces. The number of workspaces required for each business is related to the business itself and can be set according to actual needs. No specific limit is placed on the number of workspaces here; the goal is simply to create different workspaces.

[0028] Each workspace can be considered an independent business operation area. Users can freely select and combine several modules within a specific workspace to ultimately run tasks. For example, Department A's workspace might include a data acquisition module and a sales data calculation module for collecting and processing sales data. Similarly, Department B's workspace might include a report calculation module and a report generation module for creating financial reports. It's important to note that users in different workspaces are unaware of the existence of other workspaces or the task execution status within them. This achieves isolation between business processes and between business data and operational workflows.

[0029] In the method of this embodiment, due to limited system hardware resources, all tasks in the workspace share the underlying concurrent resource pool of the system (which may include the number of CPU cores, memory capacity, number of thread pools, IO bandwidth, etc.). The maximum number of concurrent tasks that this concurrent resource pool can support is fixed, that is, the preset maximum number of concurrent tasks.

[0030] As a feasible solution, a queue list can be used to store tasks to be scheduled. Specifically, tasks from each workspace are uploaded to the queue list, and the system begins executing the tasks. At this point, the queue list includes tasks currently running and tasks awaiting execution, i.e., queued tasks. Running and queued tasks can be distinguished by their status; for example, the status of a running task is set to "Running," while the status of a queued task is set to "Queued." It's important to note that regardless of how a task is triggered, it must first be added to the queue list, and its status set to "Queued." Correspondingly, when a queued task begins execution, its status automatically changes to "Running," and regardless of whether it succeeds or fails, once completed, the task is removed from the queue list.

[0031] As a feasible solution, the changes, additions, and removals of tasks in the queue list can be implemented using a scheduler. Furthermore, the scheduler can be configured to scan the queue list at a preset frequency or periodically to obtain the tasks within it, and to count the total number of running tasks and the number of queued tasks.

[0032] In this embodiment, the total number of running tasks and the maximum concurrency are first obtained. The total number of tasks and the maximum concurrency are then compared to determine whether the system can run more tasks concurrently. Specifically, if the total number of tasks is less than the maximum concurrency, it means the system can still run some tasks in parallel. If the total number of tasks is greater than or equal to the maximum concurrency, it means the system is no longer able to run more tasks in parallel. Therefore, if the total number of tasks is less than the maximum concurrency, it can be determined that the system allows tasks currently in the queue to be dequeued. Conversely, if the system is no longer able to run more tasks in parallel, it is determined that the system does not allow tasks to be dequeued.

[0033] In the method of this embodiment, the available concurrency is used to represent the number of tasks that the system can still run concurrently. Specifically, calculating the available concurrency requires first obtaining the difference between the maximum concurrency and the total number of tasks. That is, first obtain the maximum number of concurrent tasks that the system can still handle, and then obtain the number of workspaces without running tasks, which is the number of waiting spaces.

[0034] As a feasible solution, to ensure that each workspace has a chance to run tasks, this embodiment presets a reserved concurrency level for each workspace, so that task execution in a workspace will not be interrupted even when resources are scarce. Therefore, the number of waiting spaces is further multiplied by the preset concurrency level that each workspace can reserve, resulting in a product. This product represents the total number of concurrent tasks that need to be reserved for all waiting spaces in the entire system. For example, if the number of waiting spaces is 5 and the reserved concurrency level for each workspace is set to 4, the product is 5 × 4 = 20, so the total number of concurrent tasks that need to be reserved in the entire system is 20.

[0035] Finally, subtract the product of the difference between the maximum concurrency and the total number of tasks to obtain the available concurrency. This available concurrency value is directly related to the task dequeueing operation in subsequent steps and is the most core and critical parameter for determining which workspace should receive resource allocation.

[0036] Step 102: Based on the available concurrency, dequeue the queued tasks in the target workspace, or dequeue the tasks in the waiting space.

[0037] In this embodiment, the available concurrency is first compared to 0. When the available concurrency is greater than 0, it indicates that tasks can still run concurrently in the system, and resources can be allocated to workspaces with fewer running tasks. At this point, the workspace with the fewest currently running tasks (i.e., among the queuing workspaces) is selected as the target workspace. The queued tasks in this target workspace are then dequeued.

[0038] In this embodiment, when the available concurrency is less than or equal to 0, it indicates that the system is struggling to handle concurrent tasks, and only the reserved concurrency corresponding to the waiting space remains. In this case, the system can only create task execution opportunities for waiting spaces where no tasks are currently running. Since all tasks in the waiting space are in a "queuing" state, the tasks in the waiting space are dequeued.

[0039] In other words, the method in this embodiment can identify workspaces with fewer running tasks among all workspaces and consider them as "unfairly treated" workspaces. These workspaces are then given priority to run more tasks, thus being treated "fairly." Gradually, the number of tasks running in all workspaces in the system tends to be consistent; in other words, limited resources are allocated "fairly" to all workspaces.

[0040] For example, consider four workspaces: A, B, C, and D. Workspace A is running 100 tasks, occupying 50% of the total resources used by the four workspaces. Workspace B is running 50 tasks, occupying 25% of the total resources used. Workspace C is running 30 tasks, occupying 15% of the total resources used. Workspace D is running 20 tasks, occupying 10% of the total resources used. Through the method steps described in this embodiment, workspace D can be made to run more tasks, gradually increasing the percentage of total resources used by workspace D, ultimately achieving the effect that each of the four workspaces occupies 25% of the total resources used.

[0041] As a feasible solution, the number of tasks dequeued is related to the available concurrency. Specifically, the number of tasks dequeued in the target workspace can be calculated as follows: Based on the required dequeueing efficiency, a pre-defined adjustment number is obtained. First, the quotient between the available concurrency and the adjustment number is calculated. It's important to note that this quotient may not be an integer, while the number of tasks to dequeue must be an integer. Therefore, the quotient can be rounded up to obtain the final number of tasks to dequeue. Then, in the target workspace, a queue number equal to the number of tasks to dequeue is dequeued.

[0042] In this embodiment, the adjustment number can be empirically set to 3. This is a trade-off value based on experimental data that satisfies both dequeue efficiency and avoids excessive resource skew. Of course, other values ​​can also be used, and the adjustment number can be adjusted according to user needs. For example, when users require high dequeue efficiency, the adjustment number is set smaller, closer to 1. When users do not have high requirements for dequeue efficiency and do not want resources to be excessively skewed towards a particular workspace, the adjustment number is set larger. This avoids the phenomenon of "unfairness" to a particular workspace. For example, if workspace A suddenly receives a large number of tasks, and the available concurrency is directly used as the number of tasks to be dequeued, the tasks in workspace A will immediately consume a large amount of resources, which is "unfair" to other workspaces because they can only acquire resources more slowly.

[0043] Correspondingly, the number of tasks to be dequeued in the waiting space can be calculated as follows: The difference between the maximum concurrency and the total number of tasks is taken to obtain the remaining concurrency, which is the maximum number of tasks the system can still handle. Then, tasks in the waiting space that are less than or equal to this remaining concurrency are dequeued.

[0044] Step 103: Run the dequeueing task.

[0045] In the method of this embodiment, the dequeued task is triggered to run by an interface call.

[0046] The method described in this embodiment can achieve on-demand elastic allocation of concurrent resources in multiple workspaces facing limited concurrent resources, and can also perform fair task scheduling under limited resources. At the same time, it ensures efficient utilization of concurrent resources and that each workspace has available resources, avoiding the problem of business interruption due to the occupation of concurrent resources.

[0047] Example 2: This application discloses another task scheduling method; please refer to [link / reference]. Figure 2 This embodiment describes the entire process of task scheduling.

[0048] Step 201: Upload the tasks from each workspace to the queue list, and the scheduler retrieves the queued tasks and running tasks from the queue list.

[0049] Step 202: Determine if a queued task exists. If yes, proceed to step 203. If no, return to step 201.

[0050] Step 203: Determine if the total number of running tasks is less than the maximum concurrency. If yes, proceed to step 204. If no, return to step 201.

[0051] Step 204: Calculate the available concurrency based on the maximum concurrency, total number of tasks, number of waiting spaces, and space reserved for concurrency.

[0052] In the method of this embodiment, the waiting space is a workspace with no running tasks.

[0053] Step 205: Determine if the available concurrency is greater than 0. If yes, proceed to step 206. If no, proceed to step 208.

[0054] Step 206: Obtain the target workspace from each queuing space.

[0055] In the method of this embodiment, the queuing space is the workspace where there are queued tasks, and the target workspace is the workspace with the fewest running tasks.

[0056] Step 207: Calculate the number of dequeued tasks based on the available concurrency and adjustment count, and dequeue the queued tasks from the target workspace. Proceed to Step 209.

[0057] Step 208: Calculate the remaining concurrency based on the maximum concurrency and the total number of tasks, and dequeue the remaining tasks from the waiting space. Proceed to Step 209.

[0058] Step 209: Run the dequeued task. Return to step 201.

[0059] Based on the task scheduling method disclosed in the above embodiments, this embodiment correspondingly discloses a task scheduling apparatus. Please refer to... Figure 3 The task scheduling device includes: a computing unit 301, a dequeue unit 302, and a running unit 303; The computing unit 301 is used to calculate the available concurrency based on the number of waiting spaces, the total number of tasks currently running in the system, and the preset maximum concurrency, provided that queued tasks can be dequeued for execution; the waiting space is a workspace without any running tasks; the number of workspaces in a service is a preset value. The dequeue unit 302 is used to dequeue the queued tasks in the target workspace or the tasks in the waiting space based on the available concurrency; the target workspace is the workspace with the fewest running tasks; the number of tasks dequeued is related to the available concurrency. The running unit 303 is used to run the dequeueing task.

[0060] Optionally, the computing unit 301 includes: A sub-unit is used to obtain the total number of tasks and the maximum concurrency. A sub-unit is defined to determine whether the queued tasks can be dequeued if the total number of tasks is less than the maximum concurrency.

[0061] Optionally, the computing unit 301 includes: The difference sub-unit is used to obtain the difference between the maximum concurrency and the total number of tasks; The multiplication subunit is used to obtain the number of waiting spaces and the product of the number of waiting spaces and the preset number of space-reserved concurrency. The subtraction subunit is used to subtract the difference from the product to obtain the available concurrency.

[0062] Optionally, the dequeue unit 302 includes: The first dequeue subunit is used to dequeue the queued tasks in the target workspace when the available concurrency is greater than 0. The second dequeue subunit is used to dequeue tasks from the waiting space when the available concurrency is less than or equal to 0.

[0063] Optionally, the first dequeue subunit includes: A target acquisition subunit is used to acquire the target workspace in each queuing space; the queuing space is the workspace where the queued task exists. The integer sub-unit is used to obtain the quotient of the available concurrency and the adjustment number, and round the quotient up to the integer to obtain the number of tasks to be dequeued; the adjustment number is preset based on the requirements for task dequeuing efficiency; The target dequeue subunit is used to dequeue several of the queued tasks from the target workspace.

[0064] Optionally, the second dequeue subunit includes: The remaining acquisition subunit is used to obtain the difference between the maximum concurrency and the total number of tasks to get the remaining concurrency. The waiting dequeue subunit is used to dequeue less than or equal to the remaining number of concurrent tasks in the waiting space.

[0065] Optionally, the device further includes: An upload unit is used to upload tasks from each workspace to a queue list; the queue list includes tasks currently running in the system and queued tasks waiting to be run. The scanning unit is used to scan the queue list at a preset frequency through the scheduler to obtain the total number of tasks and the queued tasks, and to control the tasks to leave the queue.

[0066] Based on the above-described task scheduling method, this application also discloses a computer program product, which includes a computer program that, when run by a processor, is used to implement the above-described method.

[0067] Based on the above-described task scheduling method, this application also discloses a storage medium for storing computer program instructions, which, when executed by a central processing unit, can implement the steps of the above-described method.

[0068] The embodiments in this specification are described in a progressive manner. For the apparatus disclosed in the embodiments, since they correspond to the methods disclosed in the embodiments, the description is relatively simple; relevant details can be found in the method section.

[0069] It should also be noted that, in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element.

[0070] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly using hardware, a software module running on a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0071] The features described in the embodiments of this specification can be substituted for or combined with each other, so that those skilled in the art can implement or use this application.

[0072] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A task scheduling method, characterized in that, include: If queued tasks are allowed to be dequeued for execution, the available concurrency is calculated based on the number of waiting spaces, the total number of tasks currently running in the system, and the preset maximum concurrency. The waiting space is a workspace with no running tasks; the number of workspaces in a business is a preset value. Based on the available concurrency, the queued tasks in the target workspace or the tasks in the waiting space are dequeued. The target workspace is the workspace with the fewest running tasks; the number of tasks dequeued is related to the available concurrency. Run the dequeueing task.

2. The method according to claim 1, characterized in that, The permission to dequeue queued tasks includes: Obtain the total number of tasks and the maximum concurrency; If the total number of tasks is less than the maximum concurrency, it is determined that the queued tasks can be dequeued.

3. The method according to claim 1, characterized in that, The calculation of available concurrency based on the number of waiting spaces, the total number of tasks currently running in the system, and the preset maximum concurrency includes: Obtain the difference between the maximum concurrency and the total number of tasks; Obtain the number of waiting spaces, and obtain the product of the number of waiting spaces and the preset number of concurrent space reservations; Subtracting the difference from the product yields the available concurrency.

4. The method according to claim 1, characterized in that, The step of dequeuing the queued tasks in the target workspace or the tasks in the waiting space based on the available concurrency includes: If the available concurrency is greater than 0, the queued tasks in the target workspace will be dequeued. If the available concurrency is less than or equal to 0, the tasks in the waiting space will be dequeued.

5. The method according to claim 4, characterized in that, The step of dequeuing the queued tasks in the target workspace includes: Obtain the target workspace from each queuing space; the queuing space is the workspace where the queued task exists. Obtain the quotient of the available concurrency and the adjustment number, and round the quotient up to the integer to obtain the number of tasks to be dequeued; the adjustment number is preset based on the requirements for task dequeuing efficiency; In the target workspace, several queued tasks are dequeued.

6. The method according to claim 4, characterized in that, The step of dequeuing tasks from the waiting space includes: The remaining concurrency is obtained by obtaining the difference between the maximum concurrency and the total number of tasks. In the waiting space, take less than or equal to the remaining number of concurrent tasks to dequeue.

7. The method according to any one of claims 1-6, characterized in that, Before calculating the available concurrency, the method further includes: Tasks from each workspace are uploaded to a queue list; the queue list includes tasks currently running in the system and queued tasks awaiting execution. The scheduler scans the queue list at a preset frequency to obtain the total number of tasks and the queued tasks, and controls the tasks to leave the queue.

8. A task scheduling apparatus, characterized in that, include: Calculation unit, dequeue unit, and execution unit; The computing unit is used to calculate the available concurrency based on the number of waiting spaces, the total number of tasks currently running in the system, and the preset maximum concurrency, provided that queued tasks can be dequeued for execution. The waiting space is a workspace with no running tasks; the number of workspaces in a business is a preset value. The dequeue unit is used to dequeue the queued tasks in the target workspace or the tasks in the waiting space based on the available concurrency. The target workspace is the workspace with the fewest running tasks; the number of tasks dequeued is related to the available concurrency. The operating unit is used to run the dequeueing task.

9. A computer program product, characterized in that, The computer program product includes a computer program that, when executed by a processor, is used to implement the method described in any one of claims 1-7.

10. A storage medium, characterized in that, Used to store computer program instructions, which, when executed by a central processing unit, can implement the steps of the method described in any one of claims 1-7.