Task scheduling method and device, equipment and medium
By using the resource pre-allocation mechanism of source control in the task scheduling method, the problem of low resource utilization in traditional resource management is solved, dynamic matching of resources and task requirements is realized, and the system resource utilization and task scheduling reliability are improved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- SHENZHEN INST OF COMPUTING SCI
- Filing Date
- 2025-12-22
- Publication Date
- 2026-04-21
AI Technical Summary
Traditional resource management methods struggle to dynamically adjust resource allocation strategies based on the real-time running status and data volume of tasks in multi-task concurrent scenarios, resulting in low resource utilization and failing to fully realize the performance potential of databases and computing systems.
By obtaining the task's number, allocating number resources for resource reservation, and releasing the number resources and reallocating more number resources if reservation fails, the reservation is repeated until the reservation is successful, thus achieving dynamic matching between resources and task requirements.
It improves system resource utilization, prevents large tasks from failing due to insufficient resources, and enhances the reliability of task scheduling and the efficiency of system resource utilization.
Smart Images

Figure CN121900952A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of database resource management technology, and in particular to a task scheduling method, apparatus, device, and medium. Background Technology
[0002] With the development of data-intensive applications, databases and computing systems face increasing resource contention. Traditional resource management methods mainly include connection pooling, priority queues, and static concurrency control. However, these methods generally suffer from a disconnect between resource allocation and actual demand, often leading to execution interruptions due to insufficient resource pre-allocation. This is especially true in multi-task concurrency scenarios, where different tasks have significantly different requirements for CPU, memory, I / O, and other resources. It is difficult to dynamically adjust resource allocation strategies based on the real-time running status and data volume of tasks, resulting in low resource utilization and failing to fully realize the performance potential of databases and computing systems. Therefore, improving resource utilization has become an urgent problem to be solved in the resource management process. Summary of the Invention
[0003] In view of this, embodiments of this application provide a task scheduling method, apparatus, device, and medium to solve the problem of low resource utilization in the resource management process.
[0004] In a first aspect, embodiments of this application provide a task scheduling method, the task scheduling method comprising: Obtain the retrieval number for each task, determine the task corresponding to the current retrieval number as the target task, and if there are available retrieval numbers, allocate the first retrieval number to the target task and pre-allocate resources based on the first retrieval number; If resource pre-allocation fails, the target task releases the first resource source. After the remaining resource sources are released, the target task is reallocated a second resource source, and the number of the second resource sources is greater than the number of the first resource sources. Based on the second source, resource pre-allocation is performed again. If resource pre-allocation fails, the second source is designated as the first source, and the target task is executed to release the first source. After the remaining sources are released, the second source is reallocated to the target task again until resource pre-allocation is successful.
[0005] Secondly, embodiments of this application provide a task scheduling device, the task scheduling device comprising: The first acquisition module is used to acquire the number for each task, determine the task corresponding to the current number as the target task, and if there are available number sources, allocate the first number source to the target task and perform resource pre-allocation based on the first number source. The allocation module is used to release the first resource source if the resource pre-allocation fails, and after the remaining resource sources are released, reallocate a second resource source to the target task, wherein the number of the second resource source is greater than the number of the first resource source. The pre-allocation module is used to pre-allocate resources again based on the second source. If the resource pre-allocation fails, the second source is determined as the first source, and the target task is executed to release the first source. After the remaining sources are released, the second source is reallocated to the target task until the resource pre-allocation is successful.
[0006] Thirdly, embodiments of this application provide a computer device, the computer device including a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the task scheduling method as described above.
[0007] Fourthly, embodiments of this application provide a computer-readable storage medium storing a computer program that, when executed by a processor, implements the task scheduling method described above.
[0008] The advantages of this application compared to the prior art are: The process involves obtaining the retrieval number for each task, designating the task corresponding to the current retrieval number as the target task, and if there are available retrieval numbers, allocating the first retrieval number to the target task and performing resource pre-allocation based on the first retrieval number. If resource pre-allocation fails, the target task releases the first retrieval number. After the remaining retrieval numbers are released, the target task is reassigned a second retrieval number, with the number of second retrieval numbers exceeding the number of first retrieval numbers. This process is repeated, using the second retrieval number as the first retrieval number. If resource pre-allocation fails, the second retrieval number is designated as the first retrieval number, and the target task releases the first retrieval number. After the remaining retrieval numbers are released, the second retrieval number is reassigned to the target task, and this process continues until resource pre-allocation is successful. This application achieves dynamic matching of resources and task requirements by controlling concurrency through retrieval numbers, performing resource pre-allocation before executing the target task, and reducing concurrency and increasing the retry success rate after failure. This prevents large tasks from "starving" and improves system resource utilization. Attached Figure Description
[0009] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0010] Figure 1 This is a flowchart illustrating a task scheduling method provided in an embodiment of this application; Figure 2 This is a schematic diagram of the structure of a task scheduling device provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Detailed Implementation
[0011] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0012] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.
[0013] It should be understood that, when used in this application specification and the appended claims, the term "comprising" indicates the presence of the described features, integrals, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integrals, steps, operations, elements, components and / or a collection thereof.
[0014] It should also be understood that the term “and / or” as used in this application specification and the appended claims means any combination of one or more of the associated listed items and all possible combinations, and includes such combinations.
[0015] As used in this application specification and the appended claims, the term "if" may be interpreted, depending on the context, as "when," "once," "in response to determination," or "in response to detection." Similarly, the phrase "if determined" or "if detected [the described condition or event]" may be interpreted, depending on the context, as meaning "once determined," "in response to determination," "once detected [the described condition or event]," or "in response to detection [the described condition or event]."
[0016] Furthermore, in the description of this application and the appended claims, the terms "first," "second," "third," etc., are used only to distinguish descriptions and should not be construed as indicating or implying relative importance.
[0017] References to "one embodiment" or "some embodiments" as described in this specification mean that one or more embodiments of this application include a specific feature, structure, or characteristic described in connection with that embodiment. Therefore, the phrases "in one embodiment," "in some embodiments," "in other embodiments," "in still other embodiments," etc., appearing in different parts of this specification do not necessarily refer to the same embodiment, but rather mean "one or more, but not all, embodiments," unless otherwise specifically emphasized. The terms "comprising," "including," "having," and variations thereof mean "including but not limited to," unless otherwise specifically emphasized.
[0018] It should be understood that the sequence number of each step in the following embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.
[0019] To illustrate the technical solution of this application, specific embodiments are described below.
[0020] like Figure 1 As shown, Figure 1 This is a flowchart illustrating a task scheduling method provided in an embodiment of this application, as shown below. Figure 1 As shown, the task scheduling method may include the following steps.
[0021] S101: Obtain the retrieval number for each task, determine the task corresponding to the current retrieval number as the target task, and if there are available retrieval numbers, allocate the first retrieval number to the target task and pre-allocate resources based on the first retrieval number.
[0022] In step S101, a queuing number is obtained for each task, where the queuing number identifies the task's order in the queue. The task corresponding to the current queuing number is identified as the target task. If there are available queuing numbers, a first queuing number is allocated to the target task. The queuing number controls the number of tasks that can be executed concurrently; each task needs to acquire a corresponding number of queuing numbers to enter the resource pre-allocation stage. Based on the first queuing number, pre-allocated resources for the target task are obtained from the remaining resources. Resource pre-allocation is the act of locking the required resources in advance before executing a task to prevent execution failure due to insufficient resources.
[0023] In this embodiment, the corresponding task can be a query task. The task's retrieval number is obtained, and the task corresponding to the current retrieval number is identified as the target task. The retrieval number can be a unique sequence number assigned to the task by the user or the system. This sequence number increments sequentially according to the time the task was submitted or entered the scheduling queue, or follows a specific sorting rule. The retrieval number clearly determines the scheduling priority of each task, and the task corresponding to the current retrieval number is the target task that needs to be scheduled. The retrieval numbers are stored in a retrieval number pool, which is a collection of retrieval numbers used to control the overall concurrency. The total number of retrieval numbers in the pool is a fixed number, related to the system's available resources, and is a pre-set number. If there are spare retrieval numbers in the pool, a first retrieval number is assigned to the target task, where the first retrieval number is one or more of the spare retrieval numbers. Once the target task obtains the corresponding resource allocation source, a resource pre-allocation operation is performed based on the first resource allocation source. This involves acquiring and locking the various resources required for the target task's execution from the remaining resources. This ensures that the target task can reliably acquire the pre-allocated resources during subsequent execution phases, preventing task failure due to resource preemption by other tasks or insufficient total resources. The remaining resources here refer to the portion of resources that have not yet been occupied or pre-allocated by other tasks in the current system resource allocation state. Their specific types can be determined based on task characteristics and system configuration, such as computing resources, storage resources, and network bandwidth resources. During resource pre-allocation, the system checks and matches the remaining resources according to the target task's resource requirement list. If the remaining resources can meet the target task's pre-allocation requirements, the resource locking operation is completed, and the correspondence between the pre-allocated resources, the target task, and the first resource allocation source is recorded.
[0024] In this embodiment, by introducing a resource allocation mechanism to predict system saturation, resource allocation can be rationally planned at the initial stage of task scheduling. Only when there are available resource allocation slots is the first slot allocated to the target task and resources pre-allocated. This means that subsequent resource locking processes will only be initiated if the system has the capacity to execute, effectively avoiding invalid resource pre-allocation operations when system resources are already saturated or near saturation, thereby reducing resource allocation conflicts and waste. Simultaneously, binding the target task with the pre-allocated resource based on the first resource allocation slot ensures that the task can stably acquire the required resources in subsequent execution phases, reducing the risk of task execution failure due to resource preemption or insufficiency. This improves the reliability of task scheduling and the utilization efficiency of system resources, enabling the system to process various task requests more orderly and efficiently while ensuring smooth task execution.
[0025] Get the retrieval number for each task, including: Based on the order in which tasks are received, determine the order in which tasks are assigned numbers, and assign a corresponding number to each task according to this order.
[0026] In this embodiment, the order in which tasks are received is determined, and a corresponding number is assigned to each task based on this order. The numbers are a continuous sequence of digits. For example, if the system receives task A in the 1st minute, task B in the 2nd minute, and task C in the 3rd minute, the numbering order is task A, task B, and task C, and the assigned numbers are 1, 2, and 3 respectively, forming a continuously increasing sequence of 1, 2, 3. This method of assigning numbers based on a continuous sequence of digits clearly reflects the order in which tasks are received, facilitating task sorting and tracking by the system.
[0027] Optionally, after determining the task corresponding to the currently retrieved number as the target task, it also includes: If there are no available number sources, the first number source will be allocated to the target task after the remaining number sources are released. Based on the first number source, the pre-reserved resources for the target task will be obtained from the remaining resources.
[0028] In this embodiment, if there are no available resource slots (i.e., all resource slots are allocated), the system is in a saturated state and cannot execute other tasks. The target task waits for the remaining resource slots to be released before execution. Specifically, after the remaining resource slots are released, a first resource slot is allocated to the target task, and based on this first resource slot, the pre-allocated resources for the target task are obtained from the remaining resources. This ensures that the target task can obtain processing opportunities in a timely manner when system resources become idle.
[0029] In this embodiment, when the system detects that a resource allocation number has been allocated, it will trigger the processing flow for the target task in the waiting queue. It will prioritize allocating the first resource allocation number to the target task and accurately select and lock the required pre-allocated resources from the remaining resource pool of the current system according to the resource allocation rules corresponding to the first resource allocation number and the resource requirements of the target task. This will complete the smooth transition of the target task from the waiting state to the resource pre-allocation state and lay the foundation for the smooth execution of subsequent tasks.
[0030] Optionally, after resource pre-allocation based on the first source, the following is also included: If resource reservation is successful, then execute the target task; Release the first source after the target task is completed.
[0031] In this embodiment, resource pre-allocation is performed based on the first resource source. That is, after acquiring the pre-allocated resources for the target task from the remaining resources, if the resource pre-allocation is successful, the target task is executed. After the target task is completed, the first resource source is released so that it can be reassigned by the system to other tasks in the waiting queue, thereby improving resource utilization. If acquiring the pre-allocated resources fails, the target task remains in the waiting queue.
[0032] In this embodiment, after the target task is completed, the first resource is released in a timely manner so that it can be allocated to other tasks waiting to be executed, allowing other tasks to pre-occupy resources and improve the execution efficiency of the tasks.
[0033] Optionally, after successful resource pre-allocation, the following also applies: If there are still available number sources, the next task to obtain a number is designated as the target task. The steps of allocating the first number source to the target task and pre-allocating resources based on the first number source are executed.
[0034] In this embodiment, the successful acquisition of reserved resources by the target task indicates that the system resources are sufficient. If there are still available number sources, the next task to obtain a number is identified as the target task, and the steps of allocating a first number source to the target task and reserving resources based on the first number source are executed. That is, when executing the next task, the corresponding number source is acquired. This allows for parallel execution when resources are sufficient.
[0035] In this embodiment, through this dynamic allocation of call slots and pre-allocation of resources, the system can maximize the utilization of available call slots, quickly allocating them to subsequent tasks waiting to obtain a slot, provided system resources allow. When the next task to obtain a slot is identified as a new target task, the system immediately allocates a new first call slot to it (this first call slot is relative to the currently assigned task, not a fixed call slot identifier, but a dynamic designation for each allocation). The new target task can then use this newly allocated first call slot to attempt to obtain the pre-allocated resources required for its execution from the system's remaining resource pool. In this way, as long as there are available call slots and the remaining resources can meet the pre-allocation requirements of a new target task, multiple tasks can perform parallel pre-allocation operations at the resource level based on their respective allocated independent call slots, laying the foundation for subsequent parallel execution and effectively improving the throughput and resource utilization of the entire system's task scheduling.
[0036] S102: If resource pre-allocation fails, the target task releases the first resource. After the remaining resources are released, the target task is reallocated a second resource, and the number of second resources is greater than the number of first resources.
[0037] In step S102, the target task releases the first source by adding it to the source pool. The remaining sources are other sources in the source pool. Sources are allocated to other tasks during their execution, and after the other tasks are completed, the corresponding sources are released back to the source pool. The target task is then reassigned a second source, which is one more source than the first source.
[0038] In this embodiment, if resource pre-allocation fails, that is, the remaining resources are insufficient to meet the resource requirements of the target task, the target task releases the first resource and waits for other tasks to release the remaining resources. When the remaining resources are released, the number of empty resources in the resource pool increases, and more resources can be allocated to the target task. The second resource is then reallocated to the target task, and the pre-allocated resources for the target task are obtained from the remaining resources based on the second resource.
[0039] For example, if the resource pool contains five resources: resource 1, resource 2, resource 3, resource 4, and resource 5, with resource 3 being the first resource, and the target task fails to pre-allocate resources based on resource 3, then resource 3 is released. If there are no available resources in the pool, it waits for other tasks to release their corresponding resources, such as resource 5. After the remaining resources are released, a second resource is reallocated to the target task. The second resource has one more resource than the first resource, meaning it includes both resources 3 and 5. This prevents resource 5 from being allocated to other tasks before the target task completes, thus avoiding resource pre-allocation by other tasks. Based on the second resource, the target task's pre-allocated resources are obtained from the remaining resources.
[0040] S103: Based on the second source, perform resource pre-allocation again. If resource pre-allocation fails, the second source will be designated as the first source, and the target task will release the first source. After the remaining sources are released, the second source will be reallocated to the target task until resource pre-allocation is successful.
[0041] In step S103, resource pre-allocation is performed again based on the second source. The pre-allocated resources for the target task are obtained from the remaining resources. If resource pre-allocation fails, the second source is determined as the first source, and the target task releases the first source repeatedly. After the remaining sources are released, the second source is reallocated to the target task until resource pre-allocation is successful.
[0042] Based on the second resource allocation source, resource pre-allocation is performed again to prevent other tasks from acquiring the corresponding resource allocation source before the target task's resource pre-allocation is successful. If resource pre-allocation fails again, the second resource allocation source is designated as the first resource allocation source, and the target task releases the first resource allocation source again. After the remaining resource allocation sources are released, the second resource allocation source is reallocated to the target task, and this process continues until resource pre-allocation is successful. Each time a resource allocation source is reallocated, one more resource allocation source is added than the previous allocation to prevent vacant resource allocation sources from being assigned to other tasks. In other words, the corresponding resource allocation source is only assigned to other tasks after the target task's resource pre-allocation is successful.
[0043] In this embodiment, when the target task is a large business, a large amount of resources need to be reserved during resource pre-allocation. After the first resource pre-allocation fails, additional resources are added for re-reservation. This prevents the resources from being allocated to other tasks, reduces the execution of concurrent tasks, and thus avoids the large business from being "starved" and increases the retry success rate.
[0044] Optionally, the total number of available slots is matched with the system resources required for task scheduling.
[0045] In this embodiment, the total number of task allocation slots is matched with the system resources required for task scheduling. For example, when the system resources can support the simultaneous execution of N tasks, the total number of task allocation slots in the slot pool can be set to N. This ensures that the allocation of task allocation slots required for each task during scheduling is compatible with the system's carrying capacity, avoiding resource waste due to an excessive number of slots or affecting the normal scheduling and execution of tasks due to an insufficient number of slots. This achieves efficient utilization of system resources and stability of task scheduling.
[0046] In another embodiment, different clients simultaneously perform different queries on the same database node. For example, multiple clients perform query tasks. The database system has a total of three memory resources, and there are two types of tasks, A and B. Task A requires one memory resource and takes 3TB to execute; task B requires two memory resources and takes 3TB to execute. Queries arrive in each unit of time in the following order: A1, A2, B1, A3, A4, B2, A5, A6, B3, A7, A8, B4. Here, A is task A and B is task B. Eight clients execute task A, and four clients execute task B. The execution status of each task is shown in Table 1. Table 1 Wherein, time refers to the arrival time of each task, arrival task refers to the query task of the corresponding client, number source application refers to the number source applied for by the corresponding query task, status refers to the status of the corresponding task, where execution refers to the task execution status, resource pre-occupancy failure refers to the failure to acquire pre-occupied resources, release refers to the release of the corresponding number source and occupied resources after the task is completed, number source release time refers to the time when the number source is released after the corresponding task is completed, occupied resources refer to the resources in the database system that were pre-occupied by the arriving task, and idle resources refer to the remaining resources in the database system.
[0047] The process involves obtaining the retrieval number for each task, designating the task corresponding to the current retrieval number as the target task, and if there are available retrieval numbers, allocating the first retrieval number to the target task and performing resource pre-allocation based on the first retrieval number. If resource pre-allocation fails, the target task releases the first retrieval number. After the remaining retrieval numbers are released, the target task is reassigned a second retrieval number, with the number of second retrieval numbers exceeding the number of first retrieval numbers. This process is repeated, using the second retrieval number as the first retrieval number. If resource pre-allocation fails, the second retrieval number is designated as the first retrieval number, and the target task releases the first retrieval number. After the remaining retrieval numbers are released, the second retrieval number is reassigned to the target task, and this process continues until resource pre-allocation is successful. This application achieves dynamic matching of resources and task requirements by controlling concurrency through retrieval numbers, performing resource pre-allocation before executing the target task, and reducing concurrency and increasing the retry success rate after failure. This prevents large tasks from "starving" and improves system resource utilization.
[0048] Please see Figure 2 , Figure 2 This is a schematic diagram of a task scheduling device according to an embodiment of this application. This task scheduling device corresponds one-to-one with the task scheduling methods described in the above embodiments. Please refer to [link / reference] for details. Figure 2 as well as Figure 2 The relevant descriptions in the corresponding embodiments are shown below. For ease of explanation, only the parts relevant to this embodiment are shown. See also... Figure 2 The task scheduling device 20 includes: a first acquisition module 21, an allocation module 22, and a pre-occupancy module 23.
[0049] The first acquisition module 21 is used to acquire the number for each task, determine the task corresponding to the current number as the target task, and if there are available numbers, allocate the first number to the target task and reserve resources based on the first number. The allocation module 22 is used to release the first source if the resource pre-allocation fails. After the remaining sources are released, the second source is reallocated to the target task, and the number of the second source is greater than the number of the first source. The pre-allocation module 23 is used to pre-allocate resources again based on the second source. If the resource pre-allocation fails, the second source is determined as the first source, and the target task releases the first source. After the other sources are released, the second source is reallocated to the target task until the resource pre-allocation is successful.
[0050] Optionally, the task scheduling device 20 further includes: The allocation module is used to allocate a first allocation source to the target task after the remaining allocation sources are released if there are no available allocation sources. Based on the first allocation source, the pre-reserved resources for the target task are obtained from the remaining resources.
[0051] Optionally, the task scheduling device 20 further includes: The execution module is used to execute the target task if resource pre-acquisition is successful. The release module is used to release the first source after the target task has been completed.
[0052] Optionally, the task scheduling device 20 further includes: The determination module is used to determine the next task to obtain a number if there are still available number sources, and to perform the steps of allocating the first number source to the target task and pre-allocating resources based on the first number source.
[0053] Optionally, the first acquisition module 21 mentioned above includes: The allocation unit is used to determine the numbering order of each task according to the order in which the tasks are received, and to assign a corresponding number to each task according to the numbering order.
[0054] It should be noted that the information interaction and execution process between the above-mentioned units are based on the same concept as the method embodiments of this application. For details on their specific functions and technical effects, please refer to the method embodiments section, which will not be repeated here.
[0055] Figure 3 This is a schematic diagram of the structure of a computer device provided in one embodiment of this application. For example... Figure 3 As shown, the computer device of this embodiment includes: at least one processor ( Figure 3 The above describes the implementation of any of the task scheduling method embodiments, including but not limited to one, a memory, and a computer program stored in the memory that can run on at least one processor. When the processor executes the computer program, it implements the steps in any of the above-described task scheduling method embodiments.
[0056] This computer device may include, but is not limited to, a processor and memory. Those skilled in the art will understand that... Figure 3 The examples of computer devices are merely examples and do not constitute a limitation on computer devices. Computer devices may include more or fewer components than shown in the illustration, or combinations of certain components, or different components, such as network interfaces, displays, and input devices.
[0057] The processor referred to can be a CPU, but it can also be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0058] Memory includes readable storage media, internal memory, etc., wherein internal memory can be the RAM of a computer device, providing an environment for the operation of the operating system and computer-readable instructions stored in the readable storage media. The readable storage media can be the hard drive of a computer device, or in other embodiments, it can be an external storage device of the computer device, such as a plug-in hard drive, Smart Media Card (SMC), Secure Digital (SD) card, or Flash Card. Furthermore, memory can include both internal storage units and external storage devices of the computer device. Memory is used to store the operating system, applications, bootloader, data, and other programs, such as program code for computer programs. Memory can also be used to temporarily store data that has been output or will be output.
[0059] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiments can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit. Furthermore, the specific names of the functional units and modules are only for easy differentiation and are not intended to limit the scope of protection of this application. The specific working process of the units and modules in the above device can be referred to the corresponding process in the foregoing method embodiments, and will not be repeated here. If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. The computer program can be stored in a computer-readable storage medium, and when executed by a processor, it can implement the steps of the above method embodiments. The computer program includes computer program code, which can be in the form of source code, object code, executable files, or certain intermediate forms. A computer-readable medium can include at least: any entity or device capable of carrying computer program code, a recording medium, a computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media. Examples include USB flash drives, portable hard drives, magnetic disks, or optical disks. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electrical carrier signals or telecommunication signals.
[0060] The implementation of all or part of the processes in the methods of the above embodiments can also be accomplished by a computer program product. When the computer program product is run on a computer device, it enables the computer device to execute the steps in the above method embodiments.
[0061] In the above embodiments, the descriptions of each embodiment have different focuses. For parts that are not described in detail or recorded in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0062] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0063] In the embodiments provided in this application, it should be understood that the disclosed apparatus / computer devices and methods can be implemented in other ways. For example, the apparatus / computer device embodiments described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between apparatuses or units may be electrical, mechanical, or other forms.
[0064] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0065] The above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.
Claims
1. A task scheduling method, characterized in that, The task scheduling method includes: Obtain the retrieval number for each task, determine the task corresponding to the current retrieval number as the target task, and if there are available retrieval numbers, allocate the first retrieval number to the target task and pre-allocate resources based on the first retrieval number; If resource pre-allocation fails, the target task releases the first resource source. After the remaining resource sources are released, the target task is reallocated a second resource source, and the number of the second resource sources is greater than the number of the first resource sources. Based on the second source, resource pre-allocation is performed again. If resource pre-allocation fails, the second source is designated as the first source, and the target task is executed to release the first source. After the remaining sources are released, the second source is reallocated to the target task until resource pre-allocation is successful.
2. The task scheduling method as described in claim 1, characterized in that, After determining the task corresponding to the currently retrieved number as the target task, the process also includes: If there are no available number sources, after the remaining number sources are released, the first number source is allocated to the target task, and based on the first number source, the pre-reserved resources of the target task are obtained from the remaining resources.
3. The task scheduling method as described in claim 1, characterized in that, After the resource pre-allocation based on the first source number, it also includes: If resource reservation is successful, then execute the target task. After the target task is completed, the first source is released.
4. The task scheduling method as described in claim 3, characterized in that, After the resource pre-allocation is successful, the following steps are also included: If there are still available number sources, the next task to obtain a number is identified as the target task, and the first number source is allocated to the target task, and resource pre-allocation is performed based on the first number source.
5. The task scheduling method as described in claim 1, characterized in that, The total number of available slots is matched with the system resources required for task scheduling.
6. The task scheduling method as described in claim 1, characterized in that, The process of obtaining the retrieval number for each task includes: Based on the order in which tasks are received, the order in which tasks are assigned numbers is determined, and based on the assigned number order, a corresponding number is assigned to each task.
7. A task scheduling device, characterized in that, The task scheduling device includes: The first acquisition module is used to acquire the number for each task, determine the task corresponding to the current number as the target task, and if there are available number sources, allocate the first number source to the target task and perform resource pre-allocation based on the first number source. The allocation module is used to release the first resource source if the resource pre-allocation fails, and after the remaining resource sources are released, reallocate the second resource source to the target task, wherein the number of the second resource source is greater than the number of the first resource source. The pre-allocation module is used to pre-allocate resources again based on the second source. If the resource pre-allocation fails, the second source is determined as the first source, and the target task is executed to release the first source. After the remaining sources are released, the second source is reallocated to the target task until the resource pre-allocation is successful.
8. The task scheduling device as described in claim 7, characterized in that, The task scheduling device further includes: The allocation module is used to allocate a first number source to the target task after the remaining number sources are released if there are no available number sources, and to obtain the pre-reserved resources of the target task from the remaining resources based on the first number source.
9. A computer device, characterized in that, The computer device includes a processor, a memory, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the task scheduling method as described in any one of claims 1 to 6.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the task scheduling method as described in any one of claims 1 to 6.