Task repetition scheduling method and device, computer equipment and storage medium
By employing a task repetition scheduling method, utilizing a dual-queue structure and state machine control, the scheduling deadlock problem caused by insufficient resources for high-priority tasks is solved, thereby improving the scheduling efficiency and stability of the system.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-20
- Publication Date
- 2026-03-10
AI Technical Summary
The scheduling deadlock problem caused by insufficient resources or unmet dependencies in high-priority tasks has not been effectively solved in the existing technology.
The task repetitive scheduling method is adopted, which uses a dual queue structure and state machine control to select the target task based on the task priority and waiting time. If the execution fails, the task status is set to suspended, and it is rescheduled until success when the rescheduling conditions are met.
This effectively avoids scheduling deadlocks caused by high-priority tasks failing to execute, thus improving the system's scheduling efficiency and stability.
Smart Images

Figure CN121636088A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of multi-level scheduling technology, and more specifically, to a method, apparatus, computer device, and storage medium for repetitive task scheduling. Background Technology
[0002] In current task scheduling hardware systems, priority-based scheduling strategies are commonly used. However, when a high-priority task cannot be executed due to insufficient resources or unmet dependencies, pushing it back into the task queue may cause the task to be repeatedly selected in each scheduling cycle, forming a scheduling dead loop and affecting system performance and stability.
[0003] Related technologies have provided multi-time-period multi-level scheduling methods, two-level task scheduling methods, and multi-queue task scheduling methods, but none of them have effectively solved the scheduling dead loop problem caused by high-priority tasks failing to execute. Summary of the Invention
[0004] This application provides a method, apparatus, computer device, and storage medium for task repetitive scheduling.
[0005] A first aspect of this application provides a task repetition scheduling method, comprising: The target task is selected based on the priority and waiting time of each task in the preset ready queue. The preset ready queue consists of multiple tasks, and the status of the multiple tasks is ready. The target task is scheduled and executed. If the target task fails to execute, the target task is set to a suspended state, removed from the ready queue and moved to the suspended queue, and the target task is monitored in real time to see if the preset rescheduling conditions are met. If the target task meets the preset rescheduling conditions, the target task's status is set to ready, the target task is removed from the suspended queue and moved into the ready queue, and the target task is rescheduled and executed until the target task is successfully executed.
[0006] In an optional embodiment of this application, the preset rescheduling condition is a cooldown period or a preset number of retries, and the real-time monitoring of whether the target task meets the rescheduling condition includes: Record the timestamp of the target task failing. With the preset rescheduling condition being a cooldown period, the timer starts from the timestamp of the target task's execution failure. If the timer reaches the cooldown period, the target task is determined to meet the rescheduling condition. If the preset rescheduling condition is the number of retries, the number of retries for the target task is accumulated starting from the timestamp of the target task's execution failure. If the accumulated number of retries reaches the preset number of retries, the target task is determined to meet the rescheduling condition.
[0007] In an optional embodiment of this application, the step of selecting a target task based on the priority and waiting time of each task in a preset ready queue includes: Following the order of scheduling from front to back, all tasks are sorted according to the priority and waiting time of each task in the preset ready queue to obtain the sorted queue. The task at the front of the sorted queue is taken as the target task.
[0008] In an optional embodiment of this application, the step of sorting all tasks according to the priority and waiting time of each task in the preset ready queue to obtain a sorted queue includes: The following expression determines the queue sorting value based on the priority and waiting time of each task in the preset ready queue:
[0009] Where O is the queue sorting value of the current task, P is the priority of the current task, T is the waiting time of the current task, and α and β are the weights of priority and waiting time, respectively, both of which are positive numbers. Sort all tasks in the preset ready queue according to the queue sorting value to obtain the sorted queue.
[0010] In an optional embodiment of this application, the method further includes: For the first task that fails to execute, obtain the initial priority of the first task. During the process of removing the first task from the suspended queue and moving it into the ready queue, reduce the initial priority of the first task. Use the reduced priority as the priority of the first task after it is moved into the ready queue. For the second task in the ready queue, obtain the initial priority of the second task. If the waiting time of the second task exceeds the preset time threshold, increase the initial priority of the second task and use the increased priority as the updated priority of the second task.
[0011] In an optional embodiment of this application, the priority of each task in the preset ready queue is determined according to the system state used for scheduling and executing tasks; The waiting time for each task in the preset ready queue is the time it takes for the task to enter the preset ready queue.
[0012] In an optional embodiment of this application, the system state is determined by the following steps: For multiple storage banks in the target system, the memory pressure index of the target system is determined based on the total occupancy rate and occupancy range of all storage banks. The target task types suitable for scheduling are determined based on the target system's memory pressure indicators and preset indicator thresholds. The task corresponding to the target task type is designated as the highest priority task.
[0013] A second aspect of this application provides a task repetition scheduling apparatus, comprising: The selection module is used to select a target task based on the priority and waiting time of each task in the preset ready queue. The preset ready queue consists of multiple tasks, and the status of the multiple tasks is ready. The scheduling module is used to schedule and execute target tasks. If the target task fails to execute, the target task's status is set to suspended, the target task is removed from the ready queue and moved to the suspended queue, and the target task is monitored in real time to see if the preset rescheduling conditions are met. The move-in module is used to set the target task's status to ready when the target task meets the preset rescheduling conditions, remove the target task from the suspended queue and move it into the ready queue, and reschedule and execute the target task until the target task is successfully executed.
[0014] A third aspect of this application provides a computer device, including: a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the steps of any of the above task repetition scheduling methods.
[0015] A fourth aspect of the embodiments of this application provides a computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of the task repetition scheduling method as described above.
[0016] Compared with the prior art, the technical solutions provided in this application have at least some or all of the following advantages: The task repetitive scheduling method described in this application selects a target task based on the priority and waiting time of each task in a preset ready queue. The preset ready queue consists of multiple tasks, all of which are in a ready state. The method schedules and executes the target task. If the target task fails, its state is set to suspended, and it is removed from the ready queue and moved to a suspended queue. The method also monitors in real time whether the target task meets preset rescheduling conditions. If the target task meets the preset rescheduling conditions, its state is set to ready, and it is removed from the suspended queue and moved to the ready queue. The target task is then rescheduled and executed until it succeeds. By combining priority, task waiting time, a dual-queue structure, and state control for task scheduling, this method solves the scheduling deadlock problem caused by insufficient resources or unmet dependencies for high-priority tasks, improving the system's scheduling efficiency and stability. Attached Figure Description
[0017] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings: Figure 1 A flowchart illustrating a task repetition scheduling method provided in one embodiment of this application; Figure 2 A flowchart of a task repetition scheduling method provided in another embodiment of this application; Figure 3 This is a schematic diagram of the structure of a task repetition scheduling device provided in one embodiment of this application; Figure 4 This is a schematic diagram of a computer device structure provided in one embodiment of this application. Detailed Implementation
[0018] In the process of developing this application, the inventors discovered that current multi-level task scheduling methods cannot solve the scheduling dead loop problem caused by high-priority tasks failing to execute.
[0019] To address the aforementioned problems, this application provides a method, apparatus, computer device, and storage medium for recurring task scheduling, in order to solve the scheduling deadlock problem caused by high-priority tasks failing to execute.
[0020] The solutions in this application embodiment can be implemented using various computer languages, such as the object-oriented programming language Java and the interpreted scripting language JavaScript.
[0021] To make the technical solutions and advantages of the embodiments of this application clearer, the exemplary embodiments of this application will be described in further detail below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments of this application, and not an exhaustive list of all embodiments. It should be noted that, unless otherwise specified, the embodiments and features in the embodiments of this application can be combined with each other.
[0022] Please see Figure 1 and Figure 2 The task repetition scheduling method provided in this application includes the following steps S100~S300: S100, Select a target task according to the priority and waiting time of each task in the preset ready queue, wherein the preset ready queue consists of multiple tasks, and the status of the multiple tasks is ready; S200 schedules and executes the target task. If the target task fails to execute, the target task's status is set to suspended, the target task is removed from the ready queue and moved into the suspended queue, and the target task is monitored in real time to see if the preset rescheduling conditions are met. S300: If the target task meets the preset rescheduling conditions, set the target task's status to ready, remove the target task from the suspended queue and move it into the ready queue, and reschedule and execute the target task until the target task is successfully executed.
[0023] In an optional embodiment of this application, in the management of task status, each task has one of the following states: NEW, READY, PULLED, HANGING, and DONE. NEW indicates that the task has been newly added to the system but has not been scheduled; READY indicates that the task is ready and waiting to be selected by the scheduler; PULLED indicates that the task has been selected for scheduling but has not yet completed execution; HANGING indicates that the task has failed and entered a "cooling-off" state; and DONE indicates that the task has been completed and has exited the scheduling process.
[0024] In an optional embodiment of this application, the dual-queue structure includes a ready queue and a suspended queue. The ready queue stores tasks in the READY state and sorts them according to priority and task waiting time (task age). The suspended queue, or simply tasks marked as suspended, stores tasks in the HANGING state, along with a cooldown timer or a number of retries.
[0025] In an optional embodiment of this application, the scheduler prioritizes scheduling the highest-priority task with the longest waiting time from the ready queue. If a task fails to execute (e.g., due to insufficient resources), its status is set to HANGING, marked as suspended or moved to the suspended queue, and a cooldown timer or retry count is set. Tasks in the suspended queue change their status to READY and are moved back to the ready queue after the cooldown timer expires or the rescheduling conditions are met.
[0026] In an optional embodiment of this application, a state machine is used to manage the state transitions of a task, control the flow of task states, ensure the correct flow of tasks between different states, prevent chaotic state transitions or repeated scheduling, and avoid scheduling dead loops.
[0027] In an optional embodiment of this application, the system used for scheduling and executing tasks can be a parallel multi-task multi-process computing system. In this system, the task repetitive scheduling method of this application is adopted. For multiple tasks in the system, each task has different priorities and resource dependencies. By introducing a dual queue structure and state machine control, the system can effectively manage task scheduling, avoid scheduling dead loops caused by insufficient resources for high-priority tasks, and improve the stability of the system and the task completion rate.
[0028] In an optional embodiment of this application, after a task fails, the task status is set to HANGING, the failure timestamp is recorded, and the next scheduling attempt is made according to a cooling strategy (such as the number of retries or the cooling period).
[0029] In an optional embodiment of this application, before selecting a target task based on the priority and waiting time of each task in a preset ready queue, the method further includes: The system used for scheduling and executing tasks is taken as the target system. For multiple storage units in the target system, the storage usage and storage capacity of each storage unit are obtained. The total utilization rate and utilization range of all memory banks are determined based on the memory bank occupancy and memory bank capacity of each memory bank. Memory pressure metrics are determined based on the total utilization and utilization range of all memory modules. Compare memory pressure metrics with preset threshold metrics, and determine the appropriate task types for scheduling the target system based on the comparison results.
[0030] In an optional embodiment of this application, determining the total occupancy rate and occupancy range of all memory banks based on the memory bank occupancy and memory bank capacity of each memory bank includes: The total utilization rate of all storage units is determined based on the storage unit occupancy and storage capacity of each storage unit, as well as the total number of all storage units. The occupancy range of all memory banks is determined based on the occupancy of each memory bank.
[0031] In an optional embodiment of this application, the total utilization rate of all memory banks is determined by the following expression, based on the memory bank occupancy and capacity of each memory bank and the total number of memory banks:
[0032] in, The total utilization rate of all memory units. The storage space occupied by the i-th storage unit. The number of all storage units, The storage capacity of each memory bank.
[0033] In an optional embodiment of this application, the occupancy range of all memory banks is determined based on the memory bank occupancy of each memory bank using the following expression:
[0034] in, The occupancy of all memory banks is extremely poor. This is the largest storage volume among all storage volumes. It represents the smallest storage volume among all storage volumes.
[0035] In an optional embodiment of this application, the memory pressure index is determined based on the total occupancy and occupancy range of all memory banks using the following expression:
[0036] in, The total utilization rate of all memory units. The occupancy of all memory banks is extremely poor. The storage capacity of each memory bank. and All are preset values.
[0037] In an optional embodiment of this application, the step of comparing memory pressure indicators with preset indicator thresholds and determining the task types suitable for scheduling by the target system based on the comparison results includes: The memory pressure index is compared with the first preset index threshold and the second preset index threshold respectively; If the memory pressure index exceeds the first preset threshold, the task type to be scheduled is determined to be a memory-constrained task. If the memory pressure index is less than the second preset index threshold, the task type to be scheduled is determined to be a computationally restricted task. When the memory pressure index is less than or equal to the first preset index threshold and greater than or equal to the second preset index threshold, the total occupancy rate and occupancy range of all storage units used to determine the current memory pressure index are compared with the preset occupancy rate threshold and the preset occupancy range threshold, respectively. If the total utilization rate of all storage units under the current memory pressure index is greater than the preset utilization rate threshold and the utilization range of all storage units under the current memory pressure index is less than or equal to the preset utilization range threshold, increase the number of task cores or increase scheduling for computationally constrained tasks. If the total utilization rate of all storage units under the current memory pressure metric is less than or equal to the preset utilization rate threshold and the utilization range of all storage units under the current memory pressure metric is greater than the preset utilization range threshold, schedule the memory-constrained task with the highest memory consumption.
[0038] In an optional embodiment of this application, the first preset threshold is the memory pressure index when the total occupancy rate and occupancy range of all memory banks are at their maximum values. The second preset threshold is the memory pressure indicator when the total occupancy rate and occupancy range of all storage units are at their minimum values.
[0039] In an optional embodiment of this application, the computationally constrained task includes URLLC and eMBB services, and the method further includes a method for scheduling URLLC and eMBB service resources, wherein the method for scheduling URLLC and eMBB service resources includes: Upon receiving a URLLC service request, the raw URLLC service data is obtained, and the time-domain and frequency-domain features of the URLLC service are extracted from the raw URLLC service data. The URLLC service is an ultra-reliable low-latency communication service. The time-domain and frequency-domain features of URLLC services are input into a pre-trained time-frequency domain joint prediction model to obtain the time-frequency domain joint prediction results. The prediction confidence level is determined based on the joint prediction results in the time and frequency domains, and the prediction threshold is determined based on the resource utilization and packet loss rate of the URLLC service obtained in real time. The prediction confidence level and prediction threshold are compared, and the resource status is determined based on the comparison results. Based on the resource status, it is determined whether to preempt the resources occupied by the eMBB service. If the resources occupied by the eMBB service are preempted, the eMBB service compensation mechanism is triggered. The eMBB service is an enhanced mobile broadband service.
[0040] In an optional embodiment of this application, the joint time-frequency domain prediction model is trained through the following steps: Obtain the raw data of URLLC services, and extract the time-domain and frequency-domain features of URLLC services from the raw data of URLLC services; The temporal domain characteristics of URLLC services are used as input, and the arrival probability of URLLC services on a specified symbol in a specified time slot is used as output to train a temporal prediction model. Based on the frequency domain characteristics of URLLC services, frequency domain hotspots are identified, and a physical resource block association graph of the frequency domain hotspots is constructed. The physical resource block association features in the physical resource block association graph are used as input, and the usage probability of a specified physical resource block of a specified symbol in a specified time slot of the URLLC service is used as output to train the frequency domain prediction model.
[0041] In an optional embodiment of this application, the time-domain and frequency-domain features of the URLLC service are input into a pre-trained time-frequency domain joint prediction model to obtain the time-frequency domain joint prediction result: Input the temporal features of the URLLC service into a pre-trained temporal prediction model to obtain the arrival probability of the URLLC service on a specified symbol in a specified time slot; Input the frequency domain features of URLLC service into a pre-trained frequency domain prediction model to obtain the usage probability of URLLC service in a specified physical resource block of a specified symbol in a specified time slot. The time-frequency domain joint prediction result is determined based on the arrival probability of URLLC services on a specified symbol in a specified time slot and the usage probability of URLLC services on a specified physical resource block in a specified symbol in a specified time slot.
[0042] In an optional embodiment of this application, the prediction confidence is determined based on the joint time-frequency domain prediction results using the following expression:
[0043] in, To predict confidence levels, The result is a joint prediction in the time and frequency domains. This is a resource utility function.
[0044] In an optional embodiment of this application, the prediction threshold is determined based on the resource utilization and packet loss rate of the URLLC service obtained in real time using the following expression:
[0045]
[0046]
[0047]
[0048] in, This is the upper limit of the predicted threshold after the update. The upper limit of the predicted threshold before the update. The target resource utilization rate for URLLC services. This represents the current resource utilization rate for URLLC services. The target packet loss rate for URLLC services, The current packet loss rate for URLLC service. This is the lower limit of the predicted threshold before the update. This is the lower limit of the predicted threshold after the update. All of these are hyperparameters. This represents the total number of URLLC services. The total number of delays and rejections for URLLC services. The number of material resource blocks. For the number of time slots, This represents an idle state where resources are not allocated. It is a time-frequency domain resource unit.
[0049] In an optional embodiment of this application, the step of comparing the prediction confidence and the prediction threshold, and determining the resource status based on the comparison result, includes: If the prediction confidence is greater than the upper limit of the prediction threshold, the resource is set as a dedicated time-frequency domain resource unit; If the prediction confidence is greater than the lower limit of the prediction threshold and less than or equal to the upper limit of the prediction threshold, the resource is set as a shared time-frequency domain resource unit. If the prediction confidence is less than or equal to the lower limit of the prediction threshold, the resource status is set to idle.
[0050] In an optional embodiment of this application, the step of determining whether to preempt the resources occupied by the eMBB service according to the resource status, and triggering the eMBB service compensation mechanism in the event of preemption of the eMBB service resources, includes: In the presence of a dedicated time-frequency domain resource unit, a dedicated time-frequency domain resource unit shall be allocated for URLLC service requests; In the absence of a dedicated time-frequency domain resource unit, but in the presence of a shared time-frequency domain resource unit that is not occupied by eMBB services, a shared time-frequency domain resource unit shall be allocated for URLLC service requests. In the absence of a dedicated time-frequency domain resource unit, but the existence of a shared time-frequency domain resource unit that is occupied by an eMBB service, the URLLC service request will preempt the shared time-frequency domain resource unit and trigger the eMBB service compensation mechanism. If neither a dedicated time-frequency domain resource unit nor a shared time-frequency domain resource unit exists, an adjacent resource is allocated for the URLLC service request. If the allocation fails, the URLLC service request is rejected.
[0051] The task repetitive scheduling method of this application combines priority, task age, dual queue structure and state machine control to perform task repetitive scheduling, which can effectively solve the scheduling dead loop problem caused by the failure of high priority tasks, improve the scheduling efficiency and stability of the system, and has broad application prospects.
[0052] In an optional embodiment of this application, in step S200, the preset rescheduling condition is a cooldown period or a preset number of retries, and the real-time monitoring of whether the target task meets the rescheduling condition includes: Record the timestamp of the target task failing. With the preset rescheduling condition being a cooldown period, the timer starts from the timestamp of the target task's execution failure. If the timer reaches the cooldown period, the target task is determined to meet the rescheduling condition. If the preset rescheduling condition is the number of retries, the number of retries for the target task is accumulated starting from the timestamp of the target task's execution failure. If the accumulated number of retries reaches the preset number of retries, the target task is determined to meet the rescheduling condition.
[0053] The task repetitive scheduling method of this application, by introducing a cooling mechanism and combining it with a dual-queue structure, priority adjustment and state machine control, effectively avoids the scheduling dead loop problem caused by the failure of high-priority tasks, and improves the fairness of task scheduling and the overall performance of the system.
[0054] In an optional embodiment of this application, step S100, selecting the target task based on the priority and waiting time of each task in the preset ready queue, includes: Following the order of scheduling from front to back, all tasks are sorted according to the priority and waiting time of each task in the preset ready queue to obtain the sorted queue. The task at the front of the sorted queue is taken as the target task.
[0055] In an optional embodiment of this application, the task with the highest priority and the longest waiting time is preferred as the target task.
[0056] The task repetitive scheduling method of this application sorts all tasks in the preset ready queue according to the priority and waiting time of each task, and selects the task with the highest priority and the longest waiting time as the first task to be scheduled and executed. The task scheduling takes into account both priority and waiting time, making the task scheduling more reasonable.
[0057] In an optional embodiment of this application, the step of sorting all tasks according to the priority and waiting time of each task in the preset ready queue to obtain a sorted queue includes: The following expression determines the queue sorting value based on the priority and waiting time of each task in the preset ready queue:
[0058] Where O is the queue sorting value of the current task, P is the priority of the current task, T is the waiting time of the current task, and α and β are the weights of priority and waiting time, respectively, both of which are positive numbers. Sort all tasks in the preset ready queue according to the queue sorting value to obtain the sorted queue.
[0059] The task repetitive scheduling method of this application configures weights for priority and waiting time. In different application scenarios, the weights of priority and waiting time are adjusted to adapt to the actual application situation, so that the sorting of all tasks in the preset ready queue is more in line with the actual application situation.
[0060] In an optional embodiment of this application, the method further includes: For the first task that fails to execute, obtain the initial priority of the first task. During the process of removing the first task from the suspended queue and moving it into the ready queue, reduce the initial priority of the first task. Use the reduced priority as the priority of the first task after it is moved into the ready queue. For the second task in the ready queue, obtain the initial priority of the second task. If the waiting time of the second task exceeds the preset time threshold, increase the initial priority of the second task and use the increased priority as the updated priority of the second task.
[0061] In an optional embodiment of this application, the first task is a task that was removed from the ready queue and moved into the suspended queue due to execution failure. The initial priority of the first task is the final priority before it was removed from the ready queue. The first task and the second task are any task in the ready queue.
[0062] The task repetitive scheduling method of this application lowers the priority of tasks that fail to execute in order to avoid them being scheduled frequently, and raises the priority of low-priority tasks that have not been scheduled for a long time to prevent task starvation. By flexibly adjusting the priority of tasks according to the actual situation, the rationality of task scheduling can be ensured.
[0063] In an optional embodiment of this application, in step S100, the priority of each task in the preset ready queue is determined according to the system state used for scheduling and executing tasks; The waiting time for each task in the preset ready queue is the time it takes for the task to enter the preset ready queue.
[0064] In an optional embodiment of this application, the system state used for scheduling and executing tasks includes, but is not limited to, memory-constrained and computation-constrained states. When the system state used for scheduling and executing tasks is memory-constrained, tasks with smaller memory requirements have higher priority. When the system state used for scheduling and executing tasks is computation-constrained, tasks with larger memory requirements have higher priority.
[0065] The task repetitive scheduling method of this application determines the priority of each task in the preset ready queue based on the system state used for scheduling and executing tasks, and dynamically adjusts the priority of tasks according to the current state of the system, so that the task scheduling process is more adapted to the system.
[0066] In an optional embodiment of this application, the system state is determined by the following steps: For multiple storage banks in the target system, the memory pressure index of the target system is determined based on the total occupancy rate and occupancy range of all storage banks. The target task types suitable for scheduling are determined based on the target system's memory pressure indicators and preset indicator thresholds. The task corresponding to the target task type is designated as the highest priority task.
[0067] The task repetitive scheduling method of this application quantifies the system state by using the memory pressure index of the target system as a parameter, and determines the priority of tasks based on the size of the system's memory pressure. It can accurately determine the task priority according to the system state, making the task scheduling process more consistent with the real-time state of the system.
[0068] In an optional embodiment of this application, under the following system assumptions, the tasks in the system are scheduled and the scheduling process in Table 1 is executed to achieve the following scheduling results. The system assumptions are: there are 4 tasks at the same time: T1 to T4; T1, T2: high priority tasks, dependent on resource A; T3: medium priority tasks, not dependent; T4: low priority tasks, not dependent.
[0069] Table 1
[0070] As shown in Table 1 above, the task repetition scheduling method of this application schedules the tasks in the system to execute T3 / T4, ensuring system throughput. Furthermore, T1 / T2 has the opportunity to be retried after resources are ready, which can avoid T1 / T2 from repeatedly failing in an infinite loop.
[0071] It should be understood that although the steps in the flowchart are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order constraint on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the diagram may include multiple sub-steps or multiple stages. These sub-steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these sub-steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the sub-steps or stages of other steps.
[0072] Please see Figure 3 One embodiment of this application provides a task repetition scheduling device 300, comprising: Selection module 310 is used to select a target task according to the priority and waiting time of each task in the preset ready queue, wherein the preset ready queue consists of multiple tasks, and the status of the multiple tasks is ready. The scheduling module 320 is used to schedule and execute target tasks. In the event that a target task fails to execute, the target task is set to a suspended state, removed from the ready queue and moved into the suspended queue, and the target task is monitored in real time to see if the preset rescheduling conditions are met. The move-in module 330 is used to set the state of the target task to ready when the target task meets the preset rescheduling conditions, remove the target task from the suspended queue and move it into the ready queue, and reschedule and execute the target task until the target task is successfully executed.
[0073] In an optional embodiment of this application, in the scheduling module, the preset rescheduling condition is a cooldown period or a preset number of retries, and the real-time monitoring of whether the target task meets the rescheduling condition includes: Record the timestamp of the target task failing. With the preset rescheduling condition being a cooldown period, the timer starts from the timestamp of the target task's execution failure. If the timer reaches the cooldown period, the target task is determined to meet the rescheduling condition. If the preset rescheduling condition is the number of retries, the number of retries for the target task is accumulated starting from the timestamp of the target task's execution failure. If the accumulated number of retries reaches the preset number of retries, the target task is determined to meet the rescheduling condition.
[0074] In an optional embodiment of this application, in the selection module, selecting the target task based on the priority and waiting time of each task in the preset ready queue includes: Following the order of scheduling from front to back, all tasks are sorted according to the priority and waiting time of each task in the preset ready queue to obtain the sorted queue. The task at the front of the sorted queue is taken as the target task.
[0075] In an optional embodiment of this application, in the selection module, the step of sorting all tasks according to the priority and waiting time of each task in the preset ready queue to obtain a sorted queue includes: The following expression determines the queue sorting value based on the priority and waiting time of each task in the preset ready queue:
[0076] Where O is the queue sorting value of the current task, P is the priority of the current task, T is the waiting time of the current task, and α and β are the weights of priority and waiting time, respectively, both of which are positive numbers. Sort all tasks in the preset ready queue according to the queue sorting value to obtain the sorted queue.
[0077] In an optional embodiment of this application, the task repetition scheduling device further includes an adjustment module. In the adjustment module, for a first task that fails to execute, the initial priority of the first task is obtained, and during the process of removing the first task from the suspended queue and moving it into the ready queue, the initial priority of the first task is reduced, and the reduced priority is used as the priority of the first task after it is moved into the ready queue. For a second task in the ready queue, the initial priority of the second task is obtained, and if the waiting time of the second task exceeds a preset time threshold, the initial priority of the second task is increased, and the increased priority is used as the updated priority of the second task.
[0078] In an optional embodiment of this application, in the selection module, the priority of each task in the preset ready queue is determined according to the system state used for scheduling and executing tasks; the waiting time of each task in the preset ready queue is the time from when the task enters the preset ready queue.
[0079] In an optional embodiment of this application, the system state is determined in the selection module through the following steps: For multiple storage banks in the target system, the memory pressure index of the target system is determined based on the total occupancy rate and occupancy range of all storage banks. The target task types suitable for scheduling are determined based on the target system's memory pressure indicators and preset indicator thresholds. The task corresponding to the target task type is designated as the highest priority task.
[0080] For specific limitations regarding the aforementioned device 300, please refer to the limitations on the task repetition scheduling method described above, which will not be repeated here. Each module in the aforementioned device 300 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the computer device, or stored in software in the memory of the computer device, so that the processor can call and execute the operations corresponding to each module.
[0081] In one embodiment, a computer device is provided, the internal structure of which can be as follows: Figure 4 As shown. The computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes a non-volatile storage medium and internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage medium. The database stores data. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it implements a task repetition scheduling method as described above. It includes: memory and a processor; the memory stores a computer program; and the processor executes the computer program to implement any step of the task repetition scheduling method described above.
[0082] In one embodiment, a computer-readable storage medium is provided having a computer program stored thereon that, when executed by a processor, can perform any of the steps in the task repetition scheduling method described above.
[0083] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, this application can take the form of a computer program product embodied on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program code.
[0084] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.
[0085] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.
[0086] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.
[0087] Although preferred embodiments of this application have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of this application.
[0088] Obviously, those skilled in the art can make various modifications and variations to this application without departing from the spirit and scope of this application. Therefore, if such modifications and variations fall within the scope of the claims of this application and their equivalents, this application also intends to include such modifications and variations.
Claims
1. A method of task repetition scheduling, the method comprising: The method comprises the following steps: selecting a target task according to the priority and the waiting time of each task in a preset ready queue, wherein the preset ready queue is composed of a plurality of tasks, and the state of the plurality of tasks is ready; scheduling and executing the target task, and in the case that the target task fails to execute, setting the state of the target task as suspended, removing the target task from the ready queue and moving it into a suspended queue, and monitoring in real time whether the target task meets a preset rescheduling condition; in the case that the target task meets the preset rescheduling condition, setting the state of the target task as ready, removing the target task from the suspended queue and moving it into the ready queue, rescheduling and executing the target task until the target task successfully executes.
2. The method of claim 1, wherein, The preset rescheduling condition is a cooling period or a preset retry number, and the real-time monitoring of whether the target task meets the rescheduling condition comprises: recording a target task execution failure time stamp; in the case that the preset rescheduling condition is a cooling period, starting timing from the target task execution failure time stamp, and if the timing duration reaches the cooling period, it is determined that the target task meets the rescheduling condition; in the case that the preset rescheduling condition is a retry number, starting to accumulate the retry number of retrying the target task from the target task execution failure time stamp, and if the accumulated retry number reaches the preset retry number, it is determined that the target task meets the rescheduling condition.
3. The method of claim 1, wherein, The selecting of the target task according to the priority and the waiting time of each task in the preset ready queue comprises: sequentially scheduling from front to back, sorting all tasks in the preset ready queue according to the priority and the waiting time of each task to obtain a sorted queue; the task at the front of the sorted queue is taken as the target task.
4. The method of claim 3, wherein, The sorting of all tasks in the preset ready queue according to the priority and the waiting time of each task to obtain a sorted queue comprises: determining the queue sorting value of each task in the preset ready queue according to the priority and the waiting time of each task by the following expression: ; wherein O is the queue sorting value of the current task, P is the priority of the current task, T is the waiting time of the current task, and α and β are the weights of the priority and the waiting time respectively, both of which are positive numbers, sorting all tasks in the preset ready queue according to the queue sorting value to obtain a sorted queue.
5. The method of claim 1, wherein, The method further comprises: for a first task that fails to execute, obtaining an initial priority of the first task, lowering the initial priority of the first task during the removal of the first task from the suspended queue and the movement of the first task into the ready queue, and taking the lowered priority as the priority of the first task after the movement of the first task into the ready queue; for a second task in the ready queue, obtaining an initial priority of the second task, and in the case that the waiting time of the second task exceeds a preset time threshold, raising the initial priority of the second task, and taking the raised priority as the updated priority of the second task.
6. The method of claim 1, wherein, The priority of each task in the preset ready queue is determined according to the state of a system for scheduling and executing tasks; The waiting time of each task in the preset ready queue is the time duration from when the task enters the preset ready queue.
7. The method of claim 6, wherein, The state of the system is determined by the following steps: For a plurality of memory banks in a target system, a memory pressure indicator of the target system is determined according to a total occupancy and an occupancy range of all the memory banks; A target task type suitable for scheduling of the target system is determined based on the memory pressure indicator of the target system and a preset indicator threshold; A task corresponding to the target task type is taken as a task with the highest priority.
8. A task repetition scheduling apparatus characterized by comprising: Comprise: A selection module configured to select a target task according to a priority and a waiting time length of each task in a preset ready queue, wherein the preset ready queue is composed of a plurality of tasks, and states of the plurality of tasks are ready; A scheduling module configured to schedule and execute the target task, set a state of the target task as suspended, remove the target task from the ready queue and move the target task into a suspended queue, and monitor whether the target task meets a preset rescheduling condition in real time in a case that the target task fails to be executed; A moving-in module configured to set a state of the target task as ready, remove the target task from the suspended queue and move the target task into the ready queue, reschedule and execute the target task until the target task is successfully executed in a case that the target task meets the preset rescheduling condition.
9. A computer device comprising: A memory and a processor, the memory stores a computer program, characterized in that the processor executes the computer program to realize the steps of the task repeated scheduling method in any one of claims 1 to 7.
10. A computer-readable storage medium having stored thereon a computer program, characterized in that, The computer program is executed by the processor to realize the steps of the task repeated scheduling method in any one of claims 1 to 7.