System task execution method and device, computer equipment and storage medium
By obtaining the time data of tasks to be executed in the task pool, calculating the target priority and reasonably allocating tasks, the stability problem of the control system under the tight CPU resources is solved, and the CPU resource utilization rate and task execution are improved.
Patent Information
- Application Number
- CN202510316789.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-17
- Publication Date
- 2025-07-18
AI Technical Summary
How to improve the CPU resource utilization rate of the control system and ensure the stability of the control system, especially when CPU resources are relatively tight.
By obtaining the time data of the tasks to be executed in the task pool, the current interval time and historical execution time are determined, the target priority is calculated based on these data, and the target system tasks are selected according to the priority, and reasonably allocated to the spare CPU core for execution.
It effectively reduces the possibility that the task to be executed exceeds the target execution cycle, improves the utilization rate of CPU resources, and ensures the stability of the control system and the orderly execution of tasks.
Smart Images

Figure CN120335986A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of system task processing, and in particular, to a system task execution method, device, computer device, and storage medium. Background Art
[0002] A control system usually includes multiple modules, and each module has system tasks that need to be executed. For example, a control system such as an intelligent driving system usually includes different modules such as positioning, perception, decision-making, planning, and control. The above modules all have different system tasks that need to be executed. Since the system tasks that each module needs to execute generally have different frame rate requirements, this means that the system tasks need to be executed according to a certain execution cycle, and the system tasks need to be stably output when executed according to the execution cycle to ensure the stable performance of the control system. If there is a large surplus of CPU resources in the control system, all system tasks can be quickly scheduled and executed according to a certain execution cycle, which can ensure the stable performance of the control system; but in order to reduce costs and increase efficiency, generally the CPU resources are relatively tight, so that the system tasks may exceed the execution cycle to execute, resulting in the stability of the control system not being guaranteed. Therefore, how to improve the CPU resource utilization rate of the control system and ensure the stability of the control system has become a technical problem that must be overcome. Summary of the Invention
[0003] Embodiments of the present invention provide a system task execution method, device, computer device, and storage medium to solve the technical problem of how to improve the CPU resource utilization rate of the control system and ensure the stability of the control system.
[0004] A system task execution method includes: Obtaining time data corresponding to all to-be-executed tasks in the task pool, where the time data includes the end execution time when the to-be-executed task was last executed, historical execution duration data, and a target execution cycle; Determining a current interval duration corresponding to each to-be-executed task based on the end execution time when each to-be-executed task was last executed; Determining a target priority corresponding to each to-be-executed task based on the current interval duration corresponding to each to-be-executed task, the historical execution duration data, and the target execution cycle; Determining a target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks, and executing the target system task.
[0005] Preferably, the historical execution duration data includes at least one of a single execution duration, a longest execution duration, a first average execution duration, and a second average execution duration; The single execution duration is the duration between the start execution time and the end execution time when the task to be executed is executed each time; The longest execution duration is the maximum value of the single execution durations of the task to be executed in the most recent N executions; The first average execution duration is the average value of the single execution durations of the task to be executed in the most recent N executions; The second average execution duration is the average value of all the single execution durations of the task to be executed.
[0006] Preferably, determining the target priority corresponding to each task to be executed based on the current interval duration corresponding to each task to be executed, the historical execution duration data, and the target execution period includes: Determining the first-level priority corresponding to each task to be executed based on the current interval duration, the longest execution duration, and the target execution period corresponding to each task to be executed; Determining the target system task from the tasks to be executed based on the target priorities corresponding to all the tasks to be executed includes: Obtaining the first task quantity corresponding to the task to be executed whose first-level priority is greater than or equal to the first preset threshold; If the first task quantity is less than or equal to 1, determining the task to be executed with the largest first-level priority as the target system task.
[0007] Preferably, determining the target priority corresponding to each task to be executed based on the current interval duration corresponding to each task to be executed, the historical execution duration data, and the target execution period further includes: If the first task quantity is greater than 1, determining the second-level priority corresponding to the task to be executed based on the current interval duration, the first average execution duration, and the target execution period corresponding to the task to be executed; Determining the target system task from the tasks to be executed based on the target priorities corresponding to all the tasks to be executed further includes: Obtaining the second task quantity corresponding to the task to be executed whose second-level priority is greater than or equal to the second preset threshold; If the second task quantity is less than or equal to 1, determining the task to be executed with the largest second-level priority as the target system task.
[0008] Preferably, determining the target priority corresponding to each task to be executed based on the current interval duration corresponding to each task to be executed, the historical execution duration data, and the target execution period further includes: If the number of the second tasks is greater than 1, determine a third-level priority corresponding to the to-be-executed task based on the current interval duration, the second average execution duration, and the target execution period corresponding to the to-be-executed task; The determining a target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks further includes: Determine the to-be-executed task with the maximum third-level priority as the target system task.
[0009] Preferably, the first-level priority is a quotient of a first total duration and the target execution period, and the first total duration is a sum value of the current interval duration and the longest execution duration; The second-level priority is a quotient of a second total duration and the target execution period, and the second total duration is a sum value of the current interval duration and the first average execution duration; The third-level priority is a quotient of a third total duration and the target execution period, and the third total duration is a sum value of the current interval duration and the second average execution duration.
[0010] Preferably, after determining a target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks and executing the target system task, the system task execution method further includes: Monitor the current statuses corresponding to all the to-be-executed tasks in the task pool in real time; If the current status corresponding to the to-be-executed task is switched from the to-be-executed status to the paused status, clear the time data corresponding to the to-be-executed task; If the current status corresponding to the to-be-executed task is switched from the paused status to the to-be-executed status, update the time data corresponding to the to-be-executed task with preset time data.
[0011] A system task execution device includes: A time data acquisition module, configured to acquire time data corresponding to all the to-be-executed tasks in the task pool, where the time data includes an end execution moment when the to-be-executed task was last executed, historical execution duration data, and a target execution period; A current interval duration determination module, configured to determine a current interval duration corresponding to each to-be-executed task based on an end execution moment when each to-be-executed task was last executed; A target priority determination module, configured to determine a target priority corresponding to each to-be-executed task based on the current interval duration, the historical execution duration data, and the target execution period corresponding to each to-be-executed task; The target system task determination module determines the target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks, and executes the target system task.
[0012] A computer device includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the above-mentioned system task execution method is implemented.
[0013] A computer-readable storage medium stores a computer program. When the computer program is executed by a processor, the above-mentioned system task execution method is implemented.
[0014] The above-mentioned system task execution method, device, computer device, and storage medium can accurately determine whether each to-be-executed task needs to be executed beyond the target execution period according to the current interval duration, historical execution duration data, and target execution period corresponding to each to-be-executed task, and then reasonably determine the target priority corresponding to each to-be-executed task. Based on the target priorities corresponding to all the to-be-executed tasks, the target system task is determined and executed from the to-be-executed tasks, which is used to reduce the possibility that the to-be-executed task is executed beyond the target execution period and reasonably determine the target system task to be executed in the idle CPU task cores. This method reasonably determines the target system task according to the target priority corresponding to the to-be-executed task, can reduce the possibility that the to-be-executed task is executed beyond the target execution period, ensure the reasonable and orderly execution of the to-be-executed tasks in the task pool, allocate the target system task to the idle CPU cores for execution, can effectively utilize the idle CPU resources, so as to improve the CPU resource utilization rate of the control system. When the to-be-executed tasks in the task pool of the control system are reasonably and orderly executed and the idle CPU resources are effectively utilized, the stability of the control system can be effectively improved. Description of the Drawings
[0015] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required for the description of the embodiments of the present invention. Obviously, the drawings in the following description are only some embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0016] Figure 1 is a flowchart of the system task execution method in an embodiment of the present invention; Figure 2 is another flowchart of the system task execution method in an embodiment of the present invention; Figure 3 is a schematic diagram of the system task execution device in an embodiment of the present invention; Figure 4It is a schematic diagram of a computer device in an embodiment of the present invention. Detailed implementation manners
[0017] Next, the technical solutions in the embodiments of the present invention will be clearly and completely described in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, rather than all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those of ordinary skill in the art without creative efforts shall fall within the protection scope of the present invention.
[0018] The system task execution method provided by the embodiments of the present invention can be applied to Figure 4 the computer device shown in the figure. The computer device is set in the control system and is used to execute the system tasks in the control system according to a certain priority, so as to achieve the purpose of improving the CPU resource utilization rate of the control system and ensuring the stability of the system.
[0019] In one embodiment, as Figure 1 shown, a system task execution method is provided. Taking the method applied to the Figure 4 computer device as an example, the method includes the following steps: S1: Obtain the time data corresponding to all to-be-executed tasks in the task pool. The time data includes the end execution time when the to-be-executed task was last executed, the historical execution duration data, and the target execution period; S2: Based on the end execution time when each to-be-executed task was last executed, determine the current interval duration corresponding to each to-be-executed task; S3: Based on the current interval duration, the historical execution duration data, and the target execution period corresponding to each to-be-executed task, determine the target priority corresponding to each to-be-executed task; S4: Based on the target priorities corresponding to all to-be-executed tasks, determine the target system task from the to-be-executed tasks and execute the target system task.
[0020] Among them, the to-be-executed task refers to the system task that has not been assigned to the CPU task core in the task pool currently. The task pool refers to the component that stores the system tasks. The time data refers to the time-related data generated during the execution of the to-be-executed task before the current moment. The time data includes the end execution time when the to-be-executed task was last executed, the historical execution duration data, and the target execution period. Among them, the end execution time when the to-be-executed task was last executed refers to the moment when the to-be-executed task ended its last execution before the current moment. The historical execution duration data refers to the duration-related data generated during the execution of the to-be-executed task. The target execution period refers to the period for executing the to-be-executed task and is an inherent attribute of the to-be-executed task.
[0021] As an example, in step S1, the computer device monitors the execution status of each system task in the task pool in real time. If the execution status of a system task is the completed status, the system task with the completed status is determined as the to-be-executed task in the task pool, and the time data corresponding to all to-be-executed tasks in the task pool is obtained. The time data corresponding to the to-be-executed task includes the end execution time when the to-be-executed task was last executed, the historical execution duration data, and the target execution period. It can be understood that when the to-be-executed task is registered in the task pool, the target execution period of the to-be-executed task has been determined, and the computer device can directly obtain the target execution period of the to-be-executed task. In this example, the computer device determines the duration data during the multiple executions of the to-be-executed task before the current moment as the historical execution duration data. The computer device determines the moment when the to-be-executed task ended its last execution before the current moment as the end execution time when the to-be-executed task was last executed. In this example, the time data also includes the start execution time when each system task was executed. After the computer device determines that the system task in the task pool has been completed, it sets the start execution time corresponding to the system task to 0 as a label for the completed status of the system task. When the computer device determines that the task in a certain CPU task core is empty, it traverses the task pool and determines the system task with a start execution time of 0 as the to-be-executed task. For example, if system tasks such as A, B, C, D, E, F, and G are stored in the task pool, and the computer device traverses the task pool and determines that the start execution times of A, B, C, and D are 0, then A, B, C, and D are determined as the to-be-executed tasks.
[0022] In this example, the to-be-executed tasks in the task pool and the time data corresponding to all to-be-executed tasks are obtained, so as to determine the priority corresponding to the to-be-executed task according to the time data corresponding to the to-be-executed task, and based on the priority corresponding to the to-be-executed task, determine the target system task to be allocated to the idle CPU task core among the to-be-executed tasks, realizing the reasonable utilization of the CPU task core and improving the CPU resource utilization rate of the control system for executing system tasks.
[0023] Wherein, the current interval duration refers to the interval duration from the end execution time when the to-be-executed task was last executed before the current moment to the current moment.
[0024] As an example, in step S2, the computer device determines the difference between the current moment and the end execution time when each to-be-executed task was last executed and completed as the current interval duration corresponding to each to-be-executed task. For example, for the to-be-executed task A, the current moment and the end execution time when the to-be-executed task A was last executed and completed difference - , it is determined as the current interval duration , that is = - . Understandably, since the task to be executed is a periodic task, at the end execution moment when the task to be executed is last executed and completed, it enters the target execution cycle to which the current moment belongs. However, if the task to be executed is not executed within the current interval duration, there may be a situation where it cannot be executed and completed within the target execution cycle to which the current moment belongs, that is, the task to be executed may exceed the target execution cycle for execution, which will affect the system performance. Therefore, in this example, obtaining the current interval duration is used to subsequently consider the current interval duration within the target execution cycle to which the current moment belongs, and more accurately determine whether the task to be executed can be executed and completed within the target execution cycle to which the current moment belongs when the task to be executed is not executed within the current interval duration, that is, to determine whether the task to be executed has a situation of exceeding the target execution cycle for execution, so as to further, based on this situation, preferentially execute the task to be executed that may exceed the target execution cycle for execution, ensure the reasonable and orderly execution of the task to be executed, and ensure system stability.
[0025] Among them, the target priority refers to the priority corresponding to the task to be executed, and is used to represent whether the task to be executed needs to be preferentially executed.
[0026] As an example, in step S3, the computer device determines the execution duration required for the task to be executed to be executed and completed within the target execution cycle to which the current moment belongs according to the current interval duration and historical execution duration data corresponding to the task to be executed, analyzes and processes the execution duration and the target execution cycle corresponding to the task to be executed, determines the target priority corresponding to the task to be executed, and the computer device performs the above operations on the current interval duration, historical execution duration data, and target execution cycle corresponding to each task to be executed in the task pool to determine the target priority corresponding to each task to be executed. Understandably, the task to be executed that cannot be executed and completed within the target execution cycle requires a higher target priority to orderly execute the task to be executed according to the target priority and minimize the situation where the task to be executed exceeds the target execution cycle for execution. Therefore, it is necessary to determine the target priority corresponding to each task to be executed. In this example, considering the relationship between the execution duration required for the task to be executed to be executed and completed within the target execution cycle to which the current moment belongs and the target execution cycle corresponding to the task to be executed can accurately determine whether the task to be executed needs to exceed the target execution cycle for execution, and then determine the target priority corresponding to the task to be executed.
[0027] Among them, the target system task refers to the task to be executed that is allocated to the CPU task core for execution at the current moment.
[0028] As an example, in step S4, the computer device analyzes and processes the target priorities corresponding to all to-be-executed tasks in the task pool, screens all to-be-executed tasks according to the target priorities, determines the target system tasks to be allocated to the idle CPU task cores for execution, and allocates the target system tasks to the idle CPU task cores for execution. For example, the computer device may determine the to-be-executed task with the highest target priority as the target system task. Understandably, since the target priority corresponding to the to-be-executed task is determined based on the execution duration required for the to-be-executed task to be completed and the target execution cycle corresponding to the to-be-executed task, it can accurately reflect whether the to-be-executed task needs to be completed beyond the target execution cycle. The higher the target priority, the greater the possibility that the to-be-executed task will be completed beyond the target execution cycle, and the more it needs to be executed preferentially. In this example, by analyzing the target priority corresponding to each to-be-executed task, determining the target system task from the to-be-executed tasks, and executing the target system task in the idle CPU task cores, this method can reasonably determine the target system task for execution, reduce the possibility that the to-be-executed tasks in the task pool will be completed beyond the execution cycle, ensure the reasonable and orderly execution of the to-be-executed tasks in the task pool, and further ensure the stability of the control system applied by the system tasks.
[0029] In this embodiment, according to the current interval duration, historical execution duration data, and target execution cycle corresponding to each to-be-executed task, it is possible to accurately determine whether each to-be-executed task needs to be completed beyond the target execution cycle, and then reasonably determine the target priority corresponding to each to-be-executed task. Based on the target priorities corresponding to all to-be-executed tasks, determine and execute the target system tasks from the to-be-executed tasks to reduce the possibility that the to-be-executed tasks will be completed beyond the target execution cycle, and reasonably determine the target system tasks to be executed in the idle CPU task cores. This method reasonably determines the target system tasks according to the target priorities corresponding to the to-be-executed tasks, can reduce the possibility that the to-be-executed tasks will be completed beyond the target execution cycle, ensure the reasonable and orderly execution of the to-be-executed tasks in the task pool, allocate the target system tasks to the idle CPU cores for execution, can effectively utilize the idle CPU resources, so as to improve the CPU resource utilization rate of the control system. When the to-be-executed tasks in the task pool of the control system are reasonably and orderly executed and the idle CPU resources are effectively utilized, the stability of the control system can be effectively improved.
[0030] In one embodiment, the historical execution duration data includes at least one of the single execution duration, the longest execution duration, the first average execution duration, and the second average execution duration; The single execution duration is the duration between the start execution time and the end execution time when the to-be-executed task is executed each time; The longest execution duration is the maximum value of the single execution durations of the to-be-executed task in the most recent N executions; The first average execution duration is the average of the single execution durations of the task to be executed in its most recent N executions. The second average execution duration is the average of all the single execution durations of the task to be executed.
[0031] As an example, the computer device obtains the start execution time of each execution of the task to be executed from the moment it is successfully registered in the task pool to the current moment and the end execution time of each completed execution , and determines the single execution duration of each execution of the task to be executed = - . Where i is the number of times the task to be executed is executed, is the start execution time of the i-th execution of the task to be executed, is the end execution time of the i-th execution of the task to be executed, is the single execution duration of the i-th execution of the task to be executed. The computer device executes the above steps for each task to be executed in the task pool to determine the single execution duration of each execution of each task to be executed before the current moment.
[0032] Among them, the longest execution duration refers to the maximum value among the N single execution durations during the most recent N executions of the task to be executed. The first average execution duration refers to the average value corresponding to the single execution durations of the task to be executed in its most recent N executions. The second average execution duration refers to the average of all the single execution durations of the task to be executed. For example, a task to be executed is executed 20 times from the moment it is successfully registered in the task pool to the current moment. If N = 10, the longest execution duration is the maximum value among the corresponding most recent 10 single execution durations of the task to be executed; the first average execution duration is the average of the corresponding most recent 10 single execution durations of the task to be executed; the second average execution duration is the average of the corresponding 20 single execution durations of the task to be executed.
[0033] As an example, the computer device obtains the N single execution durations corresponding to the N times closest to the current moment among the single execution durations of each execution of the task to be executed, obtains N single execution durations, and determines the maximum value among the N single execution durations as the longest execution duration , and determines the average of the N single execution durations as the first average execution duration . The computer device performs the above operations on each task to be executed to obtain the longest execution duration and the first average execution duration corresponding to each task to be executed. In this example, if the number of executions L of a task to be executed is less than N, the maximum value of the L single execution durations is determined as the maximum execution duration, and the average of the L single execution durations is determined as the first average execution duration.
[0034] As an example, the computer device processes the average of all single execution durations of the tasks to be executed, obtains the average processing result, and determines the average processing result as the second average execution duration corresponding to the task to be executed. The computer device performs the above operations on each task to be executed in the task pool to determine the second average execution duration corresponding to each task to be executed .
[0035] In this embodiment, for a task A to be executed, after the computer device determines that the task A to be executed is completed for the Kth time, it obtains the single execution durations of the K executions corresponding to the task A to be executed, and obtains K single execution durations , , , , , and among the K single execution durations , , , , , filter out the single execution durations of the nearest N executions of the task A to be executed among the K executions , , where 1 ≤ N ≤ K.
[0036] (1) The computer device determines , the maximum value in as the longest execution duration , that is = max{ , }, and determines , the average value of as the first average execution duration , that is = .
[0037] (2) The computer device determines the second average execution duration of the task A to be executed in any of the following ways , where the second average execution duration when the task A to be executed is completed for the first time is , the second average execution duration when the task A to be executed is completed for the second time is , , and the second average execution duration when the task A to be executed is completed for the Kth time is : Method 1: The computer device determines the average value of the K single execution durations as the second average execution duration corresponding to the task A to be executed, that is = ; Method 2: When the computer device determines that the to-be-executed task A is completed for the first time, the single execution duration of the to-be-executed task A when it is executed for the first time is determined as the second average execution duration when the to-be-executed task A is completed for the first time When it is determined that the to-be-executed task A is completed for the second time, the single execution duration of the to-be-executed task A when it is executed for the second time and the second average execution duration when it was completed for the first time The average value is determined as the second average execution duration when the to-be-executed task A is completed for the second time After the computer device determines that the i-th (where 1 < i < K - 1) execution of the to-be-executed task is completed, the single execution duration of the to-be-executed task A when it is executed for the i-th time and the second average execution duration when the (i - 1)-th execution was completed The average value is determined as the second average execution duration when the i-th execution of the to-be-executed task A is completed And so on, the computer device obtains the second average execution duration when the to-be-executed task A is completed for the (K - 1)-th time According to the single execution duration when the (K - 1)-th execution was completed and the single execution duration of the K-th time The second average execution duration when the to-be-executed task A is completed for the K-th time is determined , = . This method can obtain the second average execution duration of the K-th execution after the to-be-executed task is completed for the K-th time and clear the start execution time and end execution time of each execution in the previous (K - N) times, as well as the single execution durations of the previous (K - N) times, to save system storage space. After determining that the to-be-executed task is completed for the (K + 1)-th time, the total execution duration of the previous K times is determined through the second average execution duration of the K-th execution, and the average value of the total execution duration of the previous K times and the single execution duration of the (K + 1)-th time relative to the execution times (K + 1) is determined as the second average execution duration of the (K + 1)-th time of the to-be-executed task, without processing the first K single execution durations, which helps to improve data processing efficiency.
[0038] In this embodiment, based on the single execution durations of the task to be executed in the most recent N executions, the longest execution duration and the first average execution duration are determined; based on all the single execution durations of the task to be executed, the second average execution duration is determined, so that it is feasible to determine the target priority corresponding to the task to be executed according to the longest execution duration, the first average execution duration, and the second average execution duration of the task to be executed in the subsequent process.
[0039] In one embodiment, step S3, that is, based on the current interval duration, historical execution duration data, and target execution period corresponding to each task to be executed, determining the target priority corresponding to each task to be executed includes: A21: Based on the current interval duration, the longest execution duration, and the target execution period corresponding to each task to be executed, determine the first-level priority corresponding to each task to be executed.
[0040] Correspondingly, step S3, that is, based on the target priorities corresponding to all tasks to be executed, determining the target system task from the tasks to be executed includes: A31: Obtain the first task quantity corresponding to the tasks to be executed whose first-level priority is greater than or equal to the first preset threshold; A32: If the first task quantity is less than or equal to 1, determine the task to be executed with the largest first-level priority as the target system task.
[0041] As an example, in step A21, the computer device processes and analyzes the current interval duration , the longest execution duration , and the target execution period corresponding to each task to be executed, and determines the first-level priority corresponding to each task to be executed. Here, the first-level priority is the target priority. Understandably, by using the longest execution duration to determine the first-level priority corresponding to the task to be executed, the larger the first-level priority, the greater the possibility that the task to be executed exceeds the target execution period for execution, and the greater the urgency for the task to be executed to be executed. In this embodiment, the longest execution duration is used to determine the first-level priority corresponding to the task to be executed, so as to reasonably determine the target system task according to the size of the first-level priority in the subsequent process, effectively reduce the possibility that the task to be executed exceeds the target execution period for execution, ensure system stability, execute the tasks to be executed reasonably and orderly, and improve the CPU resource utilization rate.
[0042] Among them, the first preset threshold is a preset threshold used to judge the size of the first-level priority. The first task quantity is the quantity of tasks to be executed whose first-level priority is greater than or equal to the first preset threshold.
[0043] As an example, in step A31, the computer device determines the magnitude relationship between the first-level priority of each task to be executed and the first preset threshold, and determines the first task quantity corresponding to the tasks to be executed whose first-level priority is greater than or equal to the first preset threshold. Here, the first preset threshold can be 1. For example, for the tasks A, B, C, and D to be executed in the task pool, if the first-level priority of the task A to be executed is greater than or equal to the first preset threshold, and the first-level priorities of the tasks B, C, and D to be executed are not greater than the first preset threshold, then the first task quantity is determined to be 1. If the first-level priorities of the tasks A, B, and D to be executed are greater than or equal to the first preset threshold, and the first-level priority of the task C to be executed is not greater than the first preset threshold, then the first task quantity is determined to be 3.
[0044] As an example, in step A32, when the computer device determines that the first task quantity is less than or equal to 1, it determines the task to be executed with the highest first-level priority among the tasks to be executed as the target system task. It can be understood that if the first task quantity is less than or equal to 1, it indicates that at most one task to be executed has a first-level priority greater than or equal to the first preset threshold. The task to be executed with the highest first-level priority has the greatest urgency to be executed at the current moment. At this time, directly determining the task to be executed with the highest first-level priority as the target system task to be allocated to the idle CPU task core for execution can, while improving the CPU resource utilization rate, reasonably determine the target system task, effectively reduce the risk that the task to be executed exceeds the target execution cycle, ensure the reasonable and orderly execution of the task to be executed, and improve the system stability.
[0045] In this embodiment, by obtaining the first task quantity corresponding to the tasks to be executed whose first-level priority is greater than or equal to the first preset threshold, and when the first task quantity is less than or equal to 1, determining the task to be executed with the highest first-level priority as the target system task, the target system task can be reasonably determined and the system stability can be improved.
[0046] In one embodiment, step S3, that is, based on the current interval duration, the historical execution duration data, and the target execution cycle corresponding to each task to be executed, determining the target priority corresponding to each task to be executed, further includes: B21: If the first task quantity is greater than 1, then based on the current interval duration, the first average execution duration, and the target execution cycle corresponding to the task to be executed, determine the second-level priority corresponding to the task to be executed.
[0047] Correspondingly, step S3, that is, based on the target priorities corresponding to all tasks to be executed, determining the target system task from the tasks to be executed, further includes B31: Obtain the second task quantity corresponding to the tasks to be executed whose second-level priority is greater than or equal to the second preset threshold; B32: If the number of second tasks is less than or equal to 1, the to-be-executed task with the highest secondary priority is determined as the target system task.
[0048] As an example, in step B21, when the computer device determines that the number of first tasks of the to-be-executed tasks with a first-level priority greater than or equal to the first preset threshold is greater than 1, it determines the secondary priority corresponding to the to-be-executed tasks according to the current interval duration, the first average execution duration, and the target execution period corresponding to the to-be-executed tasks. In this example, when the computer device determines that the number of first tasks is greater than 1, it calculates the secondary priority corresponding to the to-be-executed tasks with a first-level priority greater than or equal to the first preset threshold, and the secondary priority here is the target priority. It can be understood that if the number of first tasks is greater than 1, it means that there is more than 1 to-be-executed task with a risk of exceeding the target execution period, and there are more than 1 to-be-executed tasks that need to be executed at the current moment. At this time, it is necessary to further analyze the priorities of the to-be-executed tasks with a first-level priority greater than or equal to the first preset threshold to determine the target system task with the highest urgency of execution. Therefore, it is necessary to calculate the secondary priority corresponding to the to-be-executed tasks with a first-level priority greater than or equal to the first preset threshold, and there is no need to calculate the secondary priority corresponding to the to-be-executed tasks with a first-level priority less than the first preset threshold, so as to save system resources and improve task execution efficiency.
[0049] In this embodiment, when the number of first tasks is greater than 1, the secondary priority corresponding to the to-be-executed tasks is further determined, and the first average execution duration of the to-be-executed tasks in the most recent N executions is taken into account, so as to reasonably determine the target system task among the to-be-executed tasks subsequently.
[0050] Among them, the second preset threshold is a preset threshold for judging the size of the secondary priority. The number of second tasks is the number of to-be-executed tasks with a secondary priority greater than or equal to the second preset threshold.
[0051] As an example, in step B31, the computer device judges the size relationship between the secondary priority of each to-be-executed task and the second preset threshold, and determines the number of second tasks corresponding to the to-be-executed tasks with a secondary priority greater than or equal to the second preset threshold, where the second preset threshold can be 1. For example, for the to-be-executed tasks A, B, C, and D in the task pool, if the secondary priority of the to-be-executed task A is greater than or equal to the second preset threshold, and the secondary priorities of the to-be-executed tasks B, C, and D are not greater than the second preset threshold, then the number of second tasks is determined to be 1. If the secondary priorities of the to-be-executed tasks A, B, and D are greater than or equal to the second preset threshold, and the secondary priority of the to-be-executed task C is not greater than the second preset threshold, then the number of second tasks is determined to be 3.
[0052] As an example, in step B32, when the computer device determines that the number of second tasks is less than or equal to 1, it determines the to-be-executed task with the highest secondary priority among the to-be-executed tasks as the target system task. Understandably, if the number of second tasks is less than or equal to 1, it indicates that there is at most 1 to-be-executed task whose secondary priority is greater than or equal to the second preset threshold. The to-be-executed task with the highest secondary priority has the greatest urgency to be executed at the current moment. At this time, directly determining the to-be-executed task with the highest secondary priority as the target system task to be allocated to the idle CPU task core can, while improving the utilization rate of CPU resources, reasonably determine the target system task, effectively reduce the risk that the to-be-executed task exceeds the target execution cycle, ensure the reasonable and orderly execution of the to-be-executed task, and improve the system stability.
[0053] In this embodiment, obtaining the number of second tasks corresponding to the to-be-executed tasks whose secondary priority is greater than or equal to the second preset threshold and, when the number of second tasks is less than or equal to 1, determining the to-be-executed task with the highest secondary priority as the target system task can reasonably determine the target system task and improve the system stability.
[0054] In one embodiment, step S3, that is, based on the current interval duration, the historical execution duration data, and the target execution cycle corresponding to each to-be-executed task, determining the target priority corresponding to each to-be-executed task, further includes: C21: If the number of second tasks is greater than 1, then based on the current interval duration, the second average execution duration, and the target execution cycle corresponding to the to-be-executed task, determine the tertiary priority corresponding to the to-be-executed task.
[0055] Correspondingly, step S3, that is, based on the target priorities corresponding to all to-be-executed tasks, determining the target system task from the to-be-executed tasks, further includes: C31: Determine the to-be-executed task with the highest tertiary priority as the target system task.
[0056] As an example, in step C21, when the computer device determines that the number of second tasks of the to-be-executed tasks with a secondary priority greater than or equal to the second preset threshold is greater than 1, it determines the tertiary priority corresponding to the to-be-executed tasks according to the current interval duration, the second average execution duration, and the target execution period corresponding to the to-be-executed tasks. In this example, when the computer device determines that the number of second tasks is greater than 1, it calculates the tertiary priority corresponding to the to-be-executed tasks with a secondary priority greater than or equal to the second preset threshold. Understandably, if the number of second tasks is greater than 1, it indicates that there is more than 1 to-be-executed task with a risk of exceeding the target execution period. At this time, it is necessary to further analyze the priorities of the to-be-executed tasks with a secondary priority greater than or equal to the second preset threshold to determine the target system task with the greatest urgency for execution. Therefore, it is necessary to calculate the tertiary priority corresponding to the to-be-executed tasks with a secondary priority greater than or equal to the second preset threshold, and there is no need to calculate the tertiary priority corresponding to the to-be-executed tasks with a secondary priority less than the second preset threshold, so as to save system resources and improve task execution efficiency.
[0057] In this embodiment, when the number of second tasks is greater than 1, the tertiary priority corresponding to the to-be-executed tasks is further determined, taking into account the second average execution duration of all times the to-be-executed tasks are executed, so as to reasonably determine the target system task among the to-be-executed tasks subsequently.
[0058] As an example, in step C31, the computer device determines the to-be-executed task with the highest tertiary priority as the target system task to be allocated to the idle CPU core for execution. In this example, the computer device determines the tertiary priority corresponding to the to-be-executed tasks with a secondary priority exceeding the second preset threshold through the second average execution duration of all times the to-be-executed tasks are executed. The greater the tertiary priority of the to-be-executed task, the greater the possibility that the to-be-executed task will exceed the target execution period and the more it needs to be executed preferentially. Therefore, determining the to-be-executed task with the highest tertiary priority as the target system task to be allocated to the idle CPU core for execution can reasonably determine the target system task and ensure the reasonable and orderly execution of the to-be-executed tasks in the task pool.
[0059] In this embodiment, determining the to-be-executed task with the highest tertiary priority as the target system task can reasonably determine the target system task, improve the utilization rate of CPU resources, and improve system stability.
[0060] In one embodiment, the primary priority is the quotient of the first total duration and the target execution period, where the first total duration is the sum of the current interval duration and the longest execution duration; the secondary priority is the quotient of the second total duration and the target execution period, where the second total duration is the sum of the current interval duration and the first average execution duration; the tertiary priority is the quotient of the third total duration and the target execution period, where the third total duration is the sum of the current interval duration and the second average execution duration.
[0061] Among them, the first total duration refers to the duration between the end execution time when the task to be executed is last executed and the end execution time of the next execution adjacent to the last time, determined according to the longest execution duration. The second total duration refers to the duration between the end execution time when the task to be executed is last executed and the end execution time of the next execution adjacent to the last time, determined according to the first average execution duration. The third total duration refers to the duration between the end execution time when the task to be executed is last executed and the end execution time of the next execution adjacent to the last time, determined according to the second average execution duration.
[0062] As an example, the computer device obtains the difference between the current time and the end execution time when a task to be executed A is last executed, and determines this difference as the current interval duration of the task to be executed A , and the maximum value of the last N single execution durations corresponding to the task to be executed A and the current interval duration The sum value is determined as the first total duration corresponding to the task to be executed A ( + ), and the quotient of the first total duration corresponding to the task to be executed A ( + ) and the target execution period T corresponding to the task to be executed A is determined as the first-level priority corresponding to the task to be executed A. The computer device executes the above steps for each task to be executed to obtain the first-level priority corresponding to each task to be executed. Understandably, + is used to represent the maximum period corresponding to the task to be executed. If is greater than the first preset threshold, it indicates that the possibility of the task to be executed exceeding the target execution period is relatively high. To reduce the possibility of the task to be executed exceeding the target execution period, this task to be executed needs to be executed as soon as possible.
[0063] As an example, the computer device obtains the difference between the current time and the end execution time when a task to be executed B is last executed, and determines this difference as the current interval duration of the task to be executed B , and the sum value of the first average execution duration of the last N executions corresponding to the task to be executed B and the current interval duration is determined as the second total duration corresponding to the task to be executed B ( + ), and the quotient of the second total duration corresponding to the task to be executed B ( + ) and the target execution period T corresponding to the task to be executed B , it is determined as the secondary priority corresponding to the to-be-executed task B. In this example, the computer device executes the above steps for the to-be-executed tasks with the primary priority greater than the first preset threshold, and obtains the secondary priority corresponding to each to-be-executed task with the primary priority greater than the first preset threshold. Understandably, + used to represent the average period of the most recent N executions corresponding to the to-be-executed task. If is greater than the second preset threshold, it indicates that there may be a possibility that the to-be-executed task is executed beyond the target execution period. To reduce the possibility that the to-be-executed task is executed beyond the target execution period, the to-be-executed task needs to be executed as soon as possible.
[0064] As an example, the computer device obtains the difference between the current moment and the end execution moment when a to-be-executed task C was last executed, and determines this difference as the current interval duration of the to-be-executed task C , and sums up all the second average execution durations corresponding to the to-be-executed task C and the current interval duration , and determines the sum value as the third total duration corresponding to the to-be-executed task C ( + ), and determines the quotient of the third total duration ( + ) corresponding to the to-be-executed task C and the target execution period T of the to-be-executed task C , and determines it as the tertiary priority corresponding to the to-be-executed task C. In this example, the computer device executes the above steps for the to-be-executed tasks with the secondary priority greater than the second preset threshold, and obtains the tertiary priority corresponding to each to-be-executed task with the secondary priority greater than the second preset threshold. Understandably, + used to represent the average period of all executions of the to-be-executed task, the larger it is, the greater the possibility that the to-be-executed task is executed beyond the target execution period. To reduce the possibility that the to-be-executed task is executed beyond the target execution period, the to-be-executed task with the largest tertiary priority is determined as the target system task to ensure the reasonable and orderly execution of the task and improve the system stability.
[0065] In another embodiment, as Figure 2 shown, after step S4, that is, after determining the target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks and executing the target system task, the system task execution method further includes: S41: Real-time monitor the current status of all the to-be-executed tasks in the task pool; S42: If the current status corresponding to the task to be executed changes from the to-be-executed status to the paused status, clear the time data corresponding to the task to be executed. S43: If the current status corresponding to the task to be executed changes from the paused status to the to-be-executed status, update the time data corresponding to the task to be executed with the preset time data.
[0066] The current status herein refers to the status used to indicate whether the task to be executed in the task pool is paused for processing.
[0067] As an example, in step S41, the computer device monitors in real time the current status corresponding to each task to be executed in the task pool, and determines whether each task to be executed is paused for processing, so as to process the task to be executed according to the current status.
[0068] The paused status herein refers to the status where the task to be executed in the task pool cannot be used for allocation and execution. The to-be-executed status refers to the status where the task to be executed in the task pool can be used for allocation and execution.
[0069] As an example, in step S42, when the computer device determines that the current status of any task to be executed changes from the to-be-executed status to the paused status, it clears the time data corresponding to the task to be executed. For example, it clears the start execution time and the end execution time each time the task to be executed is executed, or for another example, it clears the single execution duration of the task to be executed in the most recent N executions.
[0070] The preset time data herein refers to the time data preset when the task to be executed is successfully registered in the task pool. In this example, the preset time data includes but is not limited to the target execution period and the preset single execution duration.
[0071] As an example, in step S43, when the computer device determines that the current status of the task to be executed changes from the paused status to the to-be-executed status, it updates the time data corresponding to the task to be executed with the preset time data. For example, when the computer device determines that the current status of a task to be executed A changes from the paused status to the to-be-executed status, it updates the time data corresponding to the task to be executed A with the target execution period and the preset single execution duration corresponding to the task to be executed A, that is, determines the target execution period and the preset single execution duration corresponding to the task to be executed A as the updated time data corresponding to the task to be executed A, so that the computer device can execute the task to be executed according to the updated time data.
[0072] Understandably, if a task to be executed switches from the to-be-executed state to the paused state, the time data corresponding to the task to be executed is not cleared. When the task to be executed switches from the paused state to the to-be-executed state, since the time interval between the task to be executed switching from the paused state to the to-be-executed state is relatively long, the uncleared time data corresponding to the task to be executed is inaccurate. If the uncleared time data corresponding to the task to be executed is still used to execute the task to be executed, it may cause the task to be executed to be unable to be executed reasonably and orderly. Therefore, when it is determined that the task to be executed switches from the to-be-executed state to the paused state, the time data corresponding to the task to be executed needs to be cleared, so that when the task to be executed switches from the paused state to the to-be-executed state, relatively accurate time data can be obtained again, so as to execute the task to be executed reasonably and orderly according to the accurate time data. Moreover, by clearing the time data of the task to be executed in the paused state, this method can also effectively release the system storage space and relieve the system storage pressure.
[0073] In this embodiment, according to the current state corresponding to the task to be executed, the time data corresponding to the task to be executed is updated, so as to improve the accuracy of the execution of the task to be executed and ensure the stability of the system.
[0074] It should be understood that the magnitudes of the sequence numbers of the steps in the above embodiments do not mean the order of execution. The order of execution of each process should be determined according to its function and internal logic, and should not constitute any limitation to the implementation process of the embodiments of the present invention.
[0075] In one embodiment, a system task execution device is provided, and the system task execution device corresponds one-to-one with the system task execution method in the above embodiment. As Figure 3 shown, the system task execution device includes a time data acquisition module 301, a current interval duration determination module 302, a target priority determination module 303, and a target system task determination module 304. The detailed descriptions of each functional module are as follows: The time data acquisition module 301 is used to acquire the time data corresponding to all tasks to be executed in the task pool, and the time data includes the end execution moment when the task to be executed was last executed, the historical execution duration data, and the target execution period; The current interval duration determination module 302 determines the current interval duration corresponding to each task to be executed based on the end execution moment when each task to be executed was last executed; The target priority determination module 303 determines the target priority corresponding to each task to be executed based on the current interval duration, the historical execution duration data, and the target execution period corresponding to each task to be executed; The target system task determination module 304 determines a target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks, and executes the target system task.
[0076] In one embodiment, the target priority determination module 303 includes: A first-level priority determination sub-module that determines the first-level priority corresponding to each to-be-executed task based on the current interval duration, the longest execution duration, and the target execution period corresponding to each to-be-executed task.
[0077] In one embodiment, the target system task determination module 304 includes: A first task quantity acquisition sub-module for acquiring the first task quantity corresponding to the to-be-executed tasks whose first-level priority is greater than or equal to a first preset threshold; A first quantity judgment sub-module for, if the first task quantity is less than or equal to 1, determining the to-be-executed task with the highest first-level priority as the target system task.
[0078] In one embodiment, the target priority determination module 303 includes: A second-level priority determination sub-module for, if the first task quantity is greater than 1, determining the second-level priority corresponding to the to-be-executed tasks based on the current interval duration, the first average execution duration, and the target execution period corresponding to the to-be-executed tasks.
[0079] In one embodiment, the target system task determination module 304 includes: A second task quantity acquisition sub-module for acquiring the second task quantity corresponding to the to-be-executed tasks whose second-level priority is greater than or equal to a second preset threshold; A second quantity judgment sub-module for, if the second task quantity is less than or equal to 1, determining the to-be-executed task with the highest second-level priority as the target system task.
[0080] In one embodiment, the target priority determination module 303 includes: A third-level priority determination sub-module for, if the second task quantity is greater than 1, determining the third-level priority corresponding to the to-be-executed tasks based on the current interval duration, the second average execution duration, and the target execution period corresponding to the to-be-executed tasks.
[0081] In one embodiment, the target system task determination module 304 includes: A target system task determination sub-module for determining the to-be-executed task with the highest third-level priority as the target system task.
[0082] In another embodiment, the system task execution device further includes: A current status detection module, configured to monitor in real time the current statuses corresponding to all tasks to be executed in the task pool; A first data processing module, configured to clear the time data corresponding to a task to be executed if the current status corresponding to the task to be executed changes from the to-be-executed status to the paused status; A second data processing module, configured to update the time data corresponding to a task to be executed with preset time data if the current status corresponding to the task to be executed changes from the paused status to the to-be-executed status.
[0083] For the specific limitations on the system task execution device, reference may be made to the limitations on the system task execution method in the foregoing text, which will not be elaborated herein. Each module in the above system task execution device can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in the processor in the computer device in the form of hardware or independent of the processor, or stored in the memory in the computer device in the form of software, so as to facilitate the processor to call and execute the operations corresponding to the above modules.
[0084] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as Figure 4 shown. The computer device includes a processor, a memory, a network interface, and a database connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store the data used or generated during the execution of the system task execution method. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, it implements a system task execution method.
[0085] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the computer program, it implements the system task execution method in the above embodiment, such as Figure 1 S1 - S4 shown, or Figure 2 shown. To avoid repetition, it will not be elaborated here. Alternatively, when the processor executes the computer program, it implements the functions of each module / unit in this embodiment of the system task execution device, such as Figure 3 the functions of the time data acquisition module 301, the current interval duration determination module 302, the target priority determination module 303, and the target system task determination module 304 shown. To avoid repetition, it will not be elaborated here.
[0086] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, it implements the system task execution method in the above embodiment, such as Figure 1 S1 - S4 shown, or Figure 2 as shown in, to avoid repetition, it will not be elaborated here. Or, when the computer program is executed by a processor, it implements the functions of each module / unit in this embodiment of the above system task execution device, such as Figure 3 the functions of the time data acquisition module 301, the current interval duration determination module 302, the target priority determination module 303, and the target system task determination module 304 shown. To avoid repetition, it will not be elaborated here. The computer-readable storage medium may be non-volatile or volatile.
[0087] Those of ordinary skill in the art can understand that to implement all or part of the processes in the above embodiment methods, it can be completed by instructing relevant hardware through a computer program. The computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it may include the processes of the embodiments of the above various methods. Among them, any reference to a memory, storage, database, or other medium used in the various embodiments provided in this application may include non-volatile and / or volatile memories. Non-volatile memories may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memories may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDR SDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), Rambus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and Rambus dynamic RAM (RDRAM), etc.
[0088] Those skilled in the art can clearly understand that for the convenience and brevity of description, only the above division of each functional unit and module is used as an example. In actual applications, the above functions can be allocated 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.
[0089] The above-described embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that: they can still modify the technical solutions described in the foregoing embodiments, or perform equivalent replacements on some of the technical features; and these modifications or replacements 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 the present invention, and should all be included in the protection scope of the present invention.
Claims
1. A method for executing system tasks, characterized in that, Including: Obtain time data corresponding to all to-be-executed tasks in the task pool, where the time data includes the end execution moment when the to-be-executed task was last executed, historical execution duration data, and a target execution period; Based on the end execution moment when each to-be-executed task was last executed, determine the current interval duration corresponding to each to-be-executed task; Based on the current interval duration corresponding to each to-be-executed task, the historical execution duration data, and the target execution period, determine the target priority corresponding to each to-be-executed task; Based on the target priorities corresponding to all the to-be-executed tasks, determine a target system task from the to-be-executed tasks and execute the target system task.
2. The system task execution method according to claim 1, wherein The historical execution duration data includes at least one of single execution duration, longest execution duration, first average execution duration, and second average execution duration; The single execution duration is the duration between the start execution moment and the end execution moment when the to-be-executed task is executed each time; The longest execution duration is the maximum value of the single execution durations when the to-be-executed task was executed in the most recent N times; The first average execution duration is the average value of the single execution durations when the to-be-executed task was executed in the most recent N times; The second average execution duration is the average value of all the single execution durations of the to-be-executed task.
3. The system task execution method according to claim 2, wherein The determining the target priority corresponding to each to-be-executed task based on the current interval duration corresponding to each to-be-executed task, the historical execution duration data, and the target execution period includes: Based on the current interval duration, longest execution duration, and target execution period corresponding to each to-be-executed task, determine the first-level priority corresponding to each to-be-executed task; The determining a target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks includes: Obtain the first task quantity corresponding to the to-be-executed tasks whose first-level priority is greater than or equal to a first preset threshold; If the first task quantity is less than or equal to 1, determine the to-be-executed task with the maximum first-level priority as the target system task.
4. The system task execution method according to claim 3, wherein The determining the target priority corresponding to each to-be-executed task based on the current interval duration corresponding to each to-be-executed task, the historical execution duration data, and the target execution period further includes: If the first task quantity is greater than 1, based on the current interval duration, first average execution duration, and target execution period corresponding to the to-be-executed task, determine the second-level priority corresponding to the to-be-executed task; The determining a target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks further includes: Obtain the second task quantity corresponding to the to-be-executed tasks whose second-level priority is greater than or equal to a second preset threshold; If the second task quantity is less than or equal to 1, determine the to-be-executed task with the maximum second-level priority as the target system task.
5. The system task execution method according to claim 4, wherein The determining the target priority corresponding to each to-be-executed task based on the current interval duration corresponding to each to-be-executed task, the historical execution duration data, and the target execution period further includes: If the number of the second tasks is greater than 1, determine a third-level priority corresponding to the to-be-executed task based on the current interval duration, the second average execution duration, and the target execution period corresponding to the to-be-executed task; The determining a target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks further includes: Determine the to-be-executed task with the maximum third-level priority as the target system task.
6. The method for executing a system task according to claim 5, wherein The first-level priority is a quotient of a first total duration and the target execution period, and the first total duration is a sum value of the current interval duration and the longest execution duration; The second-level priority is a quotient of a second total duration and the target execution period, and the second total duration is a sum value of the current interval duration and the first average execution duration; The third-level priority is a quotient of a third total duration and the target execution period, and the third total duration is a sum value of the current interval duration and the second average execution duration.
7. The system task execution method according to claim 2, wherein After determining a target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks and executing the target system task, the system task execution method further includes: Real-time monitor the current statuses corresponding to all the to-be-executed tasks in the task pool; If the current status corresponding to the to-be-executed task is switched from the to-be-executed status to the paused status, clear the time data corresponding to the to-be-executed task; If the current status corresponding to the to-be-executed task is switched from the paused status to the to-be-executed status, update the time data corresponding to the to-be-executed task with preset time data.
8. A system task execution device, characterized in that, including: A time data acquisition module, configured to acquire the time data corresponding to all the to-be-executed tasks in the task pool, where the time data includes the end execution moment when the to-be-executed task was last executed, the historical execution duration data, and the target execution period; A current interval duration determination module, configured to determine the current interval duration corresponding to each to-be-executed task based on the end execution moment when each to-be-executed task was last executed; A target priority determination module, configured to determine the target priority corresponding to each to-be-executed task based on the current interval duration, the historical execution duration data, and the target execution period corresponding to each to-be-executed task; A target system task determination module, configured to determine a target system task from the to-be-executed tasks based on the target priorities corresponding to all the to-be-executed tasks and execute the target system task.
9. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, the system task execution method according to any one of claims 1 to 7 is implemented.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, the system task execution method according to any one of claims 1 to 7 is implemented.