Task scheduling method and device, electronic equipment, storage medium and program product

By determining the budget duration and priority of tasks based on estimated processing time and throughput coefficient, the problem of complex parameter tuning in existing technologies is solved, and the load balancing and response time of task scheduling are improved, thereby enhancing the user experience.

CN121785744APending Publication Date: 2026-04-03IFLYTEK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2026-01-04
Publication Date
2026-04-03

AI Technical Summary

Technical Problem

Existing task scheduling methods require the design of complex and cumbersome parameters to determine task priorities, making parameter tuning difficult and hindering the achievement of load balancing in task scheduling, resulting in problems such as long response times and lag.

Method used

The budget duration of a task is determined based on the estimated processing time and throughput coefficient. The remaining budget duration is determined based on the difference between the budget duration and the current processing time. The task priority is set using the inverse relationship of the remaining budget duration, which simplifies the parameter tuning process and ensures that urgent tasks are processed first.

Benefits of technology

It enables parameter optimization in task scheduling by simply adjusting the throughput coefficient, taking into account metrics such as throughput and latency, improving response time, ensuring load balancing during task execution, and enhancing user experience.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121785744A_ABST
    Figure CN121785744A_ABST
Patent Text Reader

Abstract

The invention provides a task scheduling method and device, electronic equipment, a storage medium and a program product, and relates to the technical field of data processing. The method comprises the following steps: under the condition that a target task is a first task, determining a budget duration based on a pre-estimated processing duration of the target task and a throughput coefficient of the target task; based on a difference value between the budget duration and the current processing time consumption of the target task, determining a budget residual duration; determining task priorities of the target tasks which are inversely proportional to the budget residual duration; the emergency degree of the first task is smaller than that of the second task; the task priority is used for indicating the scheduling priority of the target task. According to the method, the budget duration can be adjusted to finally adjust the scheduling priority only by adjusting the throughput coefficient during parameter adjustment and optimization of task scheduling, complex adjustment and optimization parameters do not need to be set, indexes such as throughput and lagging can be considered at the same time, the response time is shortened, task scheduling load balancing is achieved, and the product use experience of a user is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

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

[0002] Response time is a core indicator for measuring the real-time performance of task processing and reflecting the smoothness of human-computer interaction. It refers to the time interval between the moment when the system receives external inputs such as signals, instructions, and requests and the moment when it begins to generate corresponding actions, signal feedback, and result presentation. For example, the time interval between the moment when the system receives text input and speech synthesis instructions and the moment when it generates speech waveforms and begins to play the first frame of speech.

[0003] The main way to reduce response time is to reasonably determine the task priority of the tasks to be executed and to schedule tasks according to the task priority.

[0004] However, current methods for determining task priorities and scheduling tasks need to take into account metrics such as response time, throughput, and latency. They also need to prevent tasks from starving, prevent system imbalances caused by excessive throughput differences between tasks on different paths, and prevent latency caused by excessively long decoding intervals between tasks on the same path. Therefore, they require the design of complex and cumbersome parameters to determine task priorities, making parameter tuning difficult and making it hard to achieve load balancing in task scheduling. Summary of the Invention

[0005] This invention provides a task scheduling method, apparatus, electronic device, storage medium, and program product to address the shortcomings of existing technologies that require the design of complex and cumbersome parameters to determine task priorities and are difficult to optimize. The invention provides a task scheduling scheme that only requires adjusting the throughput coefficient to achieve parameter optimization.

[0006] This invention provides a task scheduling method, comprising: When the target task is the first task, the budgeted duration of the target task is determined based on the estimated processing time and the throughput coefficient of the target task; the throughput coefficient is used to control the throughput of the target task, and the budgeted duration is less than the estimated processing time. The remaining budgeted time for the target task is determined based on the difference between the budgeted time and the current processing time of the target task; the current processing time is the time from the start of processing of the target task to the current time. Based on the remaining time in the budget, the task priority of the target task is determined; the task priority of the first task is inversely proportional to the remaining time in the budget. When the target task is the second task, the task priority of the target task is set to the preset highest priority; the preset highest priority is greater than the task priority of the first task. The urgency of the first task is lower than that of the second task; the task priority is used to indicate the scheduling priority of the target task.

[0007] According to a task scheduling method provided by the present invention, the target task is a speech synthesis task, and the estimated processing time is determined based on the following method: The total estimated number of output frames is determined based on the estimated number of output frames of the target task in multiple processing steps. The estimated processing time is determined based on the product of the total estimated number of output frames and the preset single frame duration.

[0008] According to a task scheduling method provided by the present invention, determining the task priority of the target task based on the remaining budget time includes: The task priority of the target task is determined based on the difference between the preset maximum budget duration and the remaining budget duration. Wherein, the preset maximum budget duration is greater than or equal to the budget duration of the target task.

[0009] According to a task scheduling method provided by the present invention, determining the budgeted duration of the target task based on the estimated processing time of the target task and the throughput coefficient of the target task includes: The budget duration of the target task is determined based on the product of the estimated processing time and the throughput coefficient. The throughput coefficient is greater than 0 and less than or equal to 1; the smaller the throughput coefficient, the higher the throughput of the target task.

[0010] According to a task scheduling method provided by the present invention, the task scheduling method according to claim 1 is characterized in that the second task includes the initial processing task and / or the task that will be delayed; The first processing task is the first task to be processed; the remaining budget time for the task that is about to be stuck is less than a preset time threshold. The preset highest priority includes a first preset priority and a second preset priority, wherein the first preset priority is greater than the second preset priority; The priority of the task that is about to be stuck is the first preset priority, and the priority of the task that is processed for the first time is the second preset priority.

[0011] The task scheduling method provided by the present invention further includes: If at least one of the target tasks is detected in the task queue, several tasks to be combined are selected from the target tasks based on the task priority of each target task. The data of the several tasks to be combined are concatenated to obtain concatenated data; The spliced ​​data is processed to obtain processed data; According to the several tasks to be combined, the processing data is split into tasks to obtain the processing sub-data corresponding to the several tasks to be combined.

[0012] According to a task scheduling method provided by the present invention, the step of selecting a plurality of tasks to be combined from the target tasks based on the task priority of each target task includes: Based on the task priority of each target task and the preset maximum task quantity, a number of tasks to be combined are selected from each target task; the number of the number of tasks to be combined is less than or equal to the preset maximum task quantity. The step of concatenating the data of the several tasks to be combined to obtain concatenated data includes: The partial data of the several tasks to be combined are spliced ​​together to obtain spliced ​​data; the partial data of any one of the tasks to be combined is unprocessed data of a preset data size in the complete data of the task to be combined.

[0013] According to a task scheduling method provided by the present invention, when at least one target task is detected in the task queue, a plurality of tasks to be combined are selected from the target tasks based on the task priority of each target task, including: If at least one of the target tasks is detected in the task queue and the preset conditions are met, several tasks to be combined are selected from the target tasks based on the task priority of each target task. The preset conditions include at least one of the following: The workload of each target task reaches a preset workload threshold; the preset workload threshold is less than the preset maximum workload. The task volume of each target task is less than a preset task volume threshold, and there is a task among the target tasks whose task priority reaches a third preset priority; the third preset priority is less than the preset highest priority.

[0014] The present invention also provides a task scheduling device, comprising: The first determining module is used to determine the budget duration of the target task based on the estimated processing time and the throughput coefficient of the target task when the target task is the first task; the throughput coefficient is used to control the throughput of the target task, and the budget duration is less than the estimated processing time. The second determining module is used to determine the remaining budgeted time of the target task based on the difference between the budgeted time and the current processing time of the target task; the current processing time is the time from the start of processing of the target task to the current time. The third determining module is used to determine the task priority of the target task based on the remaining budget time; the task priority of the first task is inversely proportional to the remaining budget time. The fourth determining module is used to determine the task priority of the target task as a preset highest priority when the target task is the second task; the preset highest priority is greater than the task priority of the first task. The urgency of the first task is lower than that of the second task; the task priority is used to indicate the scheduling priority of the target task.

[0015] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement any of the task scheduling methods described above.

[0016] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the task scheduling method as described above.

[0017] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements the task scheduling method described above.

[0018] The task scheduling method, apparatus, electronic device, storage medium, and program product provided by this invention determine the budget duration for target tasks with low urgency based on estimated processing time and throughput coefficient. Then, it determines the remaining budget duration based on the difference between the budget duration and the current processing time. Finally, it determines the task priority based on the inverse ratio of the remaining budget duration, ultimately indicating the task's scheduling priority. When optimizing task scheduling parameters, only the throughput coefficient needs to be adjusted to adjust the budget duration and ultimately adjust the scheduling priority. This eliminates the need for setting complex optimization parameters and simultaneously considers throughput, latency, and other metrics while improving response time, achieving load balancing in task scheduling and improving the user experience. This includes adjusting the throughput coefficient while ensuring the budgeted processing time is less than the estimated processing time when determining the budgeted processing time based on the estimated processing time and throughput coefficient, so that the actual processing time of the task does not exceed the estimated processing time and avoids data backlog causing lag; setting the task priority of the target task and linking it to its remaining budgeted time, prioritizing the target task with the shorter remaining budgeted time to reduce the throughput deviation of different tasks during execution, ensuring load balancing of task execution, and avoiding sudden processing bottlenecks or resource overload; and prioritizing the processing of target tasks with higher urgency to avoid errors caused by non-urgent tasks being processed before urgent tasks, thus stabilizing the system task scheduling performance. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.

[0020] Figure 1 This is one of the flowcharts of the task scheduling method provided by the present invention.

[0021] Figure 2 This is the second flowchart of the task scheduling method provided by the present invention.

[0022] Figure 3 This is the third flowchart of the task scheduling method provided by the present invention.

[0023] Figure 4 This is a schematic diagram of the task scheduling device provided by the present invention.

[0024] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation

[0025] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.

[0026] In various fields and scenarios such as smart homes, smart cars, voice assistants, e-commerce, and entertainment, there is a need for real-time tasks such as speech synthesis and image recognition, requiring rapid task response and real-time output to ensure smooth human-computer interaction. For example, in the scenario of intelligent voice assistants, the speech synthesis engine needs to respond quickly and generate speech in real time. Furthermore, most of these fields and scenarios support multi-user scenarios; therefore, how to effectively schedule tasks, reduce task processing response time, control output lag, ensure high concurrency performance, save costs, and provide users with a better real-time experience has become a key focus.

[0027] Response time and stuttering control directly impact user experience, system stability, and scenario adaptability, making them core prerequisites for measuring task processing performance. Response time, a key indicator of task processing real-time performance and the smoothness of human-computer interaction, refers to the time interval between receiving external inputs such as signals, instructions, or requests and the start of corresponding actions, signal feedback, or result presentation, typically measured in milliseconds (ms). Stuttering control is crucial for the "naturalness" and "immersion" of outputs such as speech, video, and long text. It refers to unexpected interruptions, repetitions, breaks, or delays in output during task processing, manifesting as discontinuous speech playback, video playback, and long text generation, and is more likely to occur in long speech synthesis and streaming interactions.

[0028] Current task scheduling schemes primarily reduce response time by rationally determining the task priorities of pending tasks and scheduling tasks based on these priorities. However, task prioritization must simultaneously prevent task starvation, avoid system imbalances caused by excessive throughput differences between tasks on different paths, and prevent stuttering caused by excessively long decoding intervals between tasks on the same path. This requires considering various factors such as the arrival time of concurrent tasks entering the task queue, the processing time relationships between concurrent tasks, the urgency of different tasks, and whether task processing will experience stuttering. Furthermore, the goal is to approximate multiple optimal objectives: minimizing response time, maximizing average and minimum throughput, maximizing the task processing engine's balancing capabilities, and minimizing stuttering. Therefore, current task scheduling schemes require designing complex and cumbersome parameters to determine task priorities, making parameter tuning difficult.

[0029] Given the complexity and difficulty in optimizing parameter design in current task scheduling schemes, the inventors of this invention conducted research. The initial approach was to use simplified design parameters and a unified task priority determination scheme to determine the task priority of all tasks, thus scheduling all tasks according to their priority. However, because the design parameters for determining task priorities were simplified, the unified task priority determination scheme based on these simplified parameters could not comprehensively and accurately reflect the urgency of tasks with different levels of urgency. This could easily lead to situations where tasks with actually higher urgency levels cannot be processed in a timely manner due to their calculated lower priority, resulting in long response times and stuttering.

[0030] To address the aforementioned shortcomings, the inventors of this invention conducted further research. During this research, they realized that if the task priority determined by a simplified parameter-based unified task priority determination scheme for a certain type of urgent task significantly deviates from the actual urgency of that type of urgent task, then the task priority for that type of urgent task can be pre-determined as the highest priority to ensure that the urgent task can be executed first. However, if the task priority of a certain type of task has already been pre-determined, it means that the processing order of that type of task cannot be flexibly adjusted. Therefore, it is necessary to find a simplified parameter to design a unified task priority determination scheme that matches the urgency of as many tasks as possible, while minimizing the need to pre-determine the task priority of any particular task, thus ensuring the real-time nature and flexibility of task scheduling.

[0031] To address the aforementioned shortcomings, the inventors of this invention conducted further research and ultimately proposed a task scheduling method. This method determines the budget duration for tasks with low urgency based on the estimated processing time and throughput coefficient, determines the remaining budget duration based on the difference between the budget duration and the current processing time, and finally determines the task priority that is inversely proportional to the remaining budget duration. Therefore, it eliminates the need to set complex tuning parameters, and can simultaneously take into account throughput, lag, and other indicators while improving response time, flexibly achieving task scheduling load balancing to improve the user's product experience.

[0032] The task scheduling method, apparatus, electronic device, storage medium, and program product provided by the present invention will be described below through various embodiments. Figures 1-5 The present invention describes a task scheduling method, apparatus, electronic device, storage medium, and program product.

[0033] Figure 1 This is one of the flowcharts illustrating the task scheduling method provided by the present invention, such as... Figure 1 As shown, the task scheduling method includes the following steps 110, 120, 130 and 140.

[0034] Step 110: If the target task is the first task, determine the budget duration of the target task based on the estimated processing time of the target task and the throughput coefficient of the target task.

[0035] The budgeted processing time is less than the estimated processing time.

[0036] The target task is a task that requires at least one processing step to complete; it can be a task that has just been extracted from the task queue and is undergoing its first processing step, or a task that has already undergone repeated processing steps but has not yet been completed.

[0037] Depending on the task domain, such as speech processing, image processing, text processing, or video processing, the specific type of the target task can vary. For example, the target task could be any one of the following: speech synthesis, machine translation, image recognition, text summarization, or video transmission.

[0038] Based on the urgency of the target tasks, the target tasks are divided into first tasks and second tasks. The urgency of the first task is lower than that of the second task, so as to ensure that the second task, which has a higher urgency, is always scheduled to be executed before the first task, which has a lower urgency.

[0039] The urgency of a target task can be determined based on factors such as the user's immediate perception and the task type. For example, if delaying the execution of a target task would result in the user directly perceiving that their request is not being responded to (e.g., a video failing to load or synthesized speech failing to play), then the urgency of that target task can be set higher, and it can be designated as the second task. Conversely, if delaying the execution of a target task has no impact on the user's immediate perception, then the urgency of that target task can be set lower, and it can be designated as the first task.

[0040] Taking long speech synthesis as an example, multiple target tasks are sequentially added to the task queue during the long speech synthesis process. Each target task is used to synthesize different long speech segments. Among them, the target task used to synthesize the first long speech segment is the initial processing task. If the initial processing task is not scheduled for execution, the target tasks for synthesizing subsequent long speech segments cannot be executed. This manifests as the user not receiving the synthesized long speech output for a long time. In other words, the user directly perceives that their long speech synthesis request has not been responded to at the current moment, and the initial processing task must be scheduled for execution as soon as possible. The higher the urgency of the target task corresponding to the initial processing task, the more urgent it is.

[0041] For example, if a user perceives discontinuous speech playback phenomena such as sudden silence, repeated playback of a certain segment of speech, or fluctuating speech speed during the synthesis of long speech output, it indicates that the target task used to synthesize a certain segment of speech has not been scheduled and executed in a timely manner. The urgency level of the target task also needs to be set higher to ensure timely scheduling of the target task.

[0042] The estimated processing time of the target task is determined at a normal output speed, based on the time from the start of the first processing of the target task to the completion of processing some or all of the task data and / or task steps and output of the task results.

[0043] For example, in a speech decoding task, if only a portion of the speech data needs to be decoded, the estimated processing time is determined based on the time required to process that portion of the speech data; if all the speech data needs to be decoded, the estimated processing time is determined based on the time required to process all the speech data.

[0044] The throughput coefficient of the target task is used to control the throughput of the target task.

[0045] Throughput is a metric that measures the total number of transactions a system can process per unit of time, reflecting the system's load-bearing capacity. For example, in speech synthesis scenarios, depending on the target task, throughput can be measured by any of the following metrics: the number of text characters processed per second, the duration of synthesized speech per minute (minutes / minute), or the number of concurrent tasks.

[0046] For the same target task, the higher the throughput of the target task, the shorter the execution time of the target task; the lower the throughput of the target task, the longer the execution time of the target task.

[0047] Specifically, when the target task is a primary task with low urgency, the budgeted processing time of the target task is determined based on the calculation results of the estimated processing time and the throughput coefficient of the target task. The calculation results of the estimated processing time and the throughput coefficient can be any of the following: multiplication, division, or weighted multiplication of the estimated processing time and the throughput coefficient; this embodiment does not limit the specific result.

[0048] Furthermore, regardless of how the estimated processing time and throughput coefficient are calculated, when the target task is the first task, its budgeted processing time is always less than the estimated processing time. This ensures that the actual processing time of each target task does not exceed its estimated processing time; otherwise, data backlog would occur, causing processing bottlenecks. Simultaneously, ensuring that the budgeted processing time of the target task is always less than the estimated processing time minimizes the processing interval between two first tasks in the task queue, guaranteeing that task scheduling always follows the bottleneck-first principle, minimizing output delays and ensuring real-time task processing.

[0049] For example, if the estimated processing time for the target task of outputting synthesized speech segment A is 100ms, then the budgeted time for the target task needs to be less than 100ms, such as 90ms, 80ms, etc., to ensure that the target task can be processed within the actual 100ms playback time of synthesized speech segment A.

[0050] Step 120: Determine the remaining budgeted time for the target task based on the difference between the budgeted time and the current processing time of the target task.

[0051] The current processing time is the duration from the start of the target task to the current time.

[0052] Specifically, the current processing time of the target task is determined first based on the duration from the start time of the target task to the current time. Then, the remaining budgeted time of the target task is determined based on the difference between the budgeted time and the current processing time.

[0053] In one embodiment, the formula for calculating the remaining budget duration is as follows: ; in, The remaining time for the target task within the budget; The budgeted time for the target task; This represents the current processing time of the target task.

[0054] Step 130: Determine the task priority of the target task based on the remaining time of the budget.

[0055] The priority of the first task is inversely proportional to the remaining time of the budget.

[0056] The task priority is a value obtained by quantifying the remaining time in the budget. The larger the value, the higher the task priority, and the smaller the value, the lower the task priority. Alternatively, the task priority is a certain priority determined from a preset priority range based on the remaining time in the budget.

[0057] For example, if the remaining time for the first task A is 50ms, its task priority is 90; if the remaining time for the first task B is 150ms, its task priority is 70. In this case, the task priority of the first task A is higher than that of the first task B.

[0058] For example, the preset level range pre-defines three task priorities and their corresponding remaining budget duration ranges, including: when the remaining budget duration of the first task is (0, 100] ms, the task priority of the first task is the highest priority; when the remaining budget duration of the first task is (100, 200] ms, the task priority of the first task is the second highest priority; and when the remaining budget duration of the first task is (200, 300] ms, the task priority of the first task is the lowest priority.

[0059] Furthermore, the task priority is used to indicate the scheduling priority of the target task. Generally speaking, the higher the task priority of the target task, the higher its scheduling priority.

[0060] Specifically, for the target task that is the first task, the task priority of the target task is determined based on the remaining budget time of the target task, which is inversely proportional to the remaining budget time.

[0061] The shorter the remaining budget time for a target task, the higher its urgency, i.e., the higher its priority. Consequently, the task is scheduled to be executed earlier. Conversely, the longer the remaining budget time for a target task, the lower its urgency, i.e., the lower its priority. Consequently, the task is scheduled to be executed later.

[0062] In this embodiment, the task priority of the target task is linked to its remaining budget time. The target task with the shorter remaining budget time is processed first, so that the target tasks before and after are processed within a relatively stable processing time. This reduces the throughput deviation of different tasks during execution, ensures the load balance of task execution, and avoids sudden processing bottlenecks or resource overload.

[0063] Step 140: If the target task is the second task, set the task priority of the target task to the preset highest priority.

[0064] The preset highest priority is greater than the task priority of the first task. The preset highest priority is pre-set based on factors such as historical task processing scheduling data and the task type of the target task, and is greater than the task priority of any first task.

[0065] Optionally, the first task is a non-urgent task, and the second task is an urgent task.

[0066] For example, the second task is the first processing task and / or the task that will be stuck, while the first task is the second processing task and is not the task that will be stuck.

[0067] The second task, being a target task with a higher urgency than any of the first tasks, has its priority predetermined to be the highest preset priority, which is greater than the possible priority of any of the first tasks. This ensures that the second task can be executed before any of the first tasks, preventing the second task from being delayed in receiving a response.

[0068] Specifically, the priority of the second task, which has a higher urgency level, is predetermined to be the highest priority, which is higher than the priority level of all first tasks in the current processing round, so as to prioritize the processing of the second task.

[0069] In some cases, the priority of a second task with higher urgency, determined by the estimated processing time, throughput coefficient, and current processing time, may be lower than that of the first task. This can lead to a situation where the priority of a second task with higher urgency is lower than that of a first task with lower urgency, which can negatively impact task processing performance.

[0070] The task scheduling method provided in this invention determines the budget duration for target tasks with low urgency based on estimated processing time and throughput coefficient. Then, it determines the remaining budget duration based on the difference between the budget duration and the current processing time. Finally, it determines the task priority based on the inverse ratio of the remaining budget duration to ultimately indicate the task's scheduling priority. When optimizing task scheduling parameters, only the throughput coefficient needs to be adjusted to adjust the budget duration and ultimately adjust the scheduling priority. This eliminates the need for setting complex optimization parameters and simultaneously considers throughput, latency, and other metrics while improving response time, achieving load balancing in task scheduling and improving the user experience. This includes methods based on estimated processing time and throughput coefficient. When determining the budgeted processing time based on processing duration and throughput coefficient, the throughput coefficient is adjusted while ensuring that the budgeted processing time is less than the estimated processing time. This ensures that the actual processing time of the task does not exceed the estimated processing time, avoiding data backlog and resulting congestion. By setting the task priority of the target task and linking it to its remaining budgeted time, the target tasks with shorter remaining budgeted time are processed first to reduce the throughput deviation of different tasks during execution, ensuring balanced task execution load and avoiding sudden processing bottlenecks or resource overload. Prioritizing the processing of target tasks with higher urgency prevents non-urgent tasks from being processed before urgent tasks, thus avoiding errors and stabilizing the system's task scheduling performance.

[0071] In one embodiment, the task processing engine includes multiple parallel task processing modules. Each task processing module is configured to: determine the budget duration of the target task based on the estimated processing time and the throughput coefficient of the target task when the target task is a first task; the throughput coefficient is used to control the throughput of the target task, and the budget duration is less than the estimated processing time; determine the remaining budget duration of the target task based on the difference between the budget duration and the current processing time of the target task; the current processing time is the duration from the start of processing of the target task to the current time; determine the task priority of the target task based on the remaining budget duration; the task priority of the first task is inversely proportional to the remaining budget duration; when the target task is a second task, determine the task priority of the target task as a preset highest priority; the preset highest priority is greater than the task priority of the first task; wherein the urgency of the first task is less than the urgency of the second task; the task priority is used to indicate the scheduling priority of the target task.

[0072] Optionally, multiple parallel task processing modules in the task processing engine are used to execute target tasks with different processing granularities and different processing difficulties.

[0073] For example, the first processing module in the task processing engine is used to process fine-grained and low-difficulty target tasks, such as intensive tasks that are numerous, fragmented, and easy to piece together; the second processing module in the task processing engine is used to process coarse-grained and high-difficulty target tasks, such as tasks with a large task span and very few tasks at the same time; the third processing module in the task processing engine is used to process fine-grained and high-difficulty target tasks, such as tasks that can only piece together a small amount of data.

[0074] By executing the task scheduling method provided in this embodiment of the invention on multiple parallel task processing modules of the task processing engine, each task processing can balance throughput, lag and other indicators and improve response time without setting complex tuning parameters. It can make full use of limited server resources, maximize the number of concurrent paths, effectively reduce the deployment cost of the task processing engine, and make the budget scheduling performance of the task processing engine more balanced in the case of multi-path concurrency in complex resource scenarios where multiple people perform service scheduling, with the minimum throughput close to the average throughput.

[0075] Based on the above embodiments, as an optional embodiment, the target task is a speech synthesis task, and the estimated processing time is determined based on the following method: The total estimated number of output frames is determined based on the estimated number of output frames of the target task in multiple processing steps. The estimated processing time is determined based on the product of the total estimated number of output frames and the preset single frame duration.

[0076] The estimated output frame count is the total number of audio frames that will be produced in a single processing step of a speech synthesis task.

[0077] The total estimated output frames is the estimated total number of audio frames that will be produced during multiple processing steps in a speech synthesis task. It is used to measure the output scale of the speech synthesis task to be performed. The total estimated output frames can be calculated based on the complexity of the speech synthesis task, historical processing data, etc.

[0078] The preset single-frame duration is the duration of each audio frame in the speech synthesis task pre-set by the system. The preset single-frame duration can be determined comprehensively based on factors such as the server resources of the task processing engine, the type of the target task, the processing difficulty and granularity of the task processing module, and there are no restrictions on it.

[0079] For the same type of target task, the preset single-frame duration can be different when the processing difficulty and granularity of the task processing modules are different. Of course, for the same type of target task, the preset single-frame duration can also be the same even if the processing difficulty and granularity of the task processing modules are different.

[0080] Specifically, when the target task is a speech synthesis task, considering that the same speech synthesis task may be scheduled to be executed once or multiple times, some or all of the data and steps corresponding to the speech synthesis task will be executed each time it is scheduled to be executed. Therefore, the audio output duration, that is, the estimated processing duration, is determined by multiplying the total estimated number of audio frames of all audio frames estimated to be output in each processing of the speech synthesis task and the preset single frame duration of the audio frame.

[0081] Furthermore, the budgeted processing time is less than the estimated processing time. In the case of a speech synthesis task, the budgeted processing time for the speech synthesis task is less than the audio output time to ensure that there will be no stuttering in the audio output.

[0082] The task scheduling method provided in this invention cleverly determines the estimated processing time of a speech synthesis task by multiplying the total estimated output frames of the target task in multiple processing iterations by the preset single-frame duration. This allows the budget duration to be determined based on the estimated processing time and throughput coefficient, and then the remaining budget duration, task priority, and scheduling priority are gradually determined. When optimizing task scheduling parameters, only the throughput coefficient needs to be adjusted to adjust the budget duration and ultimately adjust the scheduling priority, without the need to set complex optimization parameters. Furthermore, by cleverly estimating the audio output duration and ensuring that the budget duration is less than the estimated audio output duration, the audio output process can be made smooth without any stuttering, improving the user experience of using the speech synthesis service.

[0083] In another embodiment, the task processing engine is a speech synthesis engine, which includes multiple parallel speech synthesis modules for processing speech synthesis tasks with different processing difficulties and different processing granularities. The estimated processing time is determined based on the product of the total estimated output frames and the preset single frame duration, including: determining the estimated processing time based on the product of the total estimated output frames, the preset single frame duration, and the module weight; the module weight is determined based on the processing difficulty and processing granularity of the speech synthesis module.

[0084] By determining the module weights when calculating the estimated processing time based on the processing difficulty and granularity of the speech synthesis tasks handled by different speech synthesis modules, and by obtaining a more accurate estimated processing time based on the total estimated output frames, the preset single frame duration, and the module weights, we can help to balance and maximize the utilization of resources of each speech synthesis module, thereby improving the efficiency and performance of the entire speech synthesis engine and bringing a better user experience.

[0085] Based on the above embodiments, as an optional embodiment, determining the task priority of the target task based on the remaining budget time includes: The task priority of the target task is determined based on the difference between the preset maximum budget duration and the remaining budget duration. Wherein, the preset maximum budget duration is greater than or equal to the budget duration of the first task.

[0086] The preset maximum budget duration is set based on the preset maximum priority of the second task, and the preset maximum budget duration is directly proportional to the preset maximum priority. When the preset maximum priority of the second task is higher than the task priority of the first task, the preset maximum budget duration is greater than or equal to the budget duration of all target tasks.

[0087] For example, if the maximum budget duration for each target task is 100ms, then the preset maximum budget duration can be set to 110ms.

[0088] When the preset maximum budget duration is greater than or equal to the budget duration of the target task, it can prevent the target task's priority from being determined as a negative number.

[0089] Understandably, by setting the maximum budget duration to be greater than or equal to the budget duration of all target tasks, the throughput deviation between tasks can be reduced, the system bottleneck caused by insufficient server resources during task scheduling can be eliminated, thereby ensuring task load balancing and stable system processing capacity.

[0090] Specifically, when determining the task priority of a target task, the estimated processing time and throughput coefficient of the target task are first used to determine the budget duration of the target task. Then, the remaining budget duration is determined based on the difference between the budget duration and the current processing time of the target task. Finally, the task priority of the target task is determined based on the difference between the preset maximum budget duration and the remaining budget duration, and the scheduling priority of the target task is determined based on the task priority.

[0091] Optionally, when the target task is the first task, the formula for calculating the task priority of the target task is as follows: ; in, Prioritize the target task; Preset the maximum budget duration; This represents the remaining time in the budget.

[0092] Optionally, when the task processing engine includes multiple parallel task processing modules, for each task processing module, the preset maximum budget duration for all target tasks in the task queue of that task processing module is the same.

[0093] Optionally, when the task processing engine includes multiple parallel task processing modules, the preset maximum budget duration of the target tasks in the task queues of different task processing modules can be the same or different.

[0094] Optionally, when the target task is a speech synthesis task, in determining the task priority of the target task, the estimated processing time is first determined based on the product of the total estimated output frames of the target task in multiple processing iterations and the preset single frame duration. Then, the budgeted processing time of the target task is determined based on the estimated processing time and the throughput coefficient of the target task, and the remaining budgeted time is determined based on the difference between the budgeted time and the current processing time of the target task. Finally, the task priority of the target task is determined based on the difference between the preset maximum budgeted time and the remaining budgeted time, thereby determining the scheduling priority of the target task based on the task priority.

[0095] The task scheduling method provided in this embodiment of the invention determines the task priority of the target task by the difference between the preset maximum preset duration corresponding to the preset highest priority of the second task and the remaining budget duration of the target task, and ensures that the preset maximum preset duration is greater than or equal to the budget duration of the target task. This can reduce the throughput deviation between tasks, eliminate the system bottleneck caused by insufficient server resources during task scheduling, and thus ensure task load balancing and stable system processing capabilities.

[0096] Based on the above embodiments, as an optional embodiment, determining the budgeted duration of the target task based on the estimated processing time of the target task and the throughput coefficient of the target task includes: The budget duration of the target task is determined based on the product of the estimated processing time and the throughput coefficient. The throughput coefficient is greater than 0 and less than or equal to 1; the smaller the throughput coefficient, the higher the throughput of the target task.

[0097] Understandably, when the throughput coefficient of the target task is 1, the throughput is 1x. The smaller the throughput coefficient, the shorter the budget duration of the target task, and the higher the throughput.

[0098] Specifically, when determining the budget duration of the target task, the throughput coefficient is controlled to be greater than 0 and less than or equal to 1, and the budget duration of the target task is determined based on the product of the estimated processing time and the throughput coefficient.

[0099] Optionally, when the target task is a speech synthesis task, the minimum throughput of the target task must be greater than the output speech rate set for the speech synthesis task.

[0100] For example, when the output speech rate of a speech synthesis task is set to 1.5x, the minimum throughput of the target task needs to be greater than 1.5x, and the corresponding throughput coefficient is less than 2 / 3. As another example, when the output speech rate of a speech synthesis task is set to 1x, the minimum throughput of the target task needs to be greater than 1x, and the corresponding throughput coefficient is less than 1.

[0101] In one embodiment, when the target task is speech synthesis, the formula for calculating the budget duration is as follows: ; in, Budget duration; This represents the total estimated number of output frames. The preset single-frame duration; This represents the throughput coefficient.

[0102] Among them, the preset single frame duration is determined in advance as 10ms, 15ms or 20ms, etc.

[0103] The task scheduling method provided in this invention determines the budget duration of a target task by multiplying a configurable throughput coefficient (greater than 0 and less than or equal to 1) with the estimated processing time. By configuring the throughput coefficient, the urgency of the target task can be controlled, thereby increasing the priority of target tasks with high throughput and achieving the purpose of controlling throughput. It has good performance in adjusting speech synthesis speed. Furthermore, by using a throughput coefficient greater than 0 and less than or equal to 1, it can ensure that the budget duration of the target task is less than or equal to the estimated processing time, thus ensuring that the task does not lag.

[0104] In another embodiment, the budgeted duration of the target task is determined based on the estimated processing time and throughput coefficient of the target task, including: The budget duration of the target task is determined by dividing the estimated processing time by the throughput coefficient; where the throughput coefficient is greater than 1, and the larger the throughput coefficient, the higher the throughput of the target task.

[0105] For example, when the target task is speech synthesis, the formula for calculating the budgeted processing time of the target task, based on the estimated processing time and throughput coefficient of the target task, is as follows: ; in, Budget duration; This represents the total estimated number of output frames. The preset single-frame duration; This represents the throughput coefficient.

[0106] Based on the above embodiments, as an optional embodiment, the second task includes an initial processing task and / or a task that will be delayed; The first processing task is the first task to be processed; the remaining budget time for the task that is about to be stuck is less than a preset time threshold. The preset highest priority includes a first preset priority and a second preset priority, wherein the first preset priority is greater than the second preset priority; The priority of the task that is about to be stuck is the first preset priority, and the priority of the task that is processed for the first time is the second preset priority.

[0107] The initial processing task, as the first task to be processed, is typically an initialization, loading, or initial rendering task. Since the initial processing task is generally for the purpose of handling subsequent tasks, its immediate impact on the user experience is not as direct and significant as that of interactive tasks.

[0108] Tasks that are about to experience lag are those whose output will be noticeably slowed down during user interaction due to improper task scheduling, affecting the user's perceived smoothness. This can be determined by checking if the remaining time is less than a preset time threshold. The preset time threshold can be determined comprehensively based on factors such as historical task scheduling data, task processing granularity, and processing difficulty, and is not subject to any restrictions.

[0109] Specifically, the first target task to be processed is identified as the first processing task, and the target task with a remaining budget time of less than a preset time threshold is identified as the task that will be stuck. Both the first processing task and the task that will be stuck are set as the second task with high urgency.

[0110] In cases where the second task includes the initial processing task and / or the task that will be stuck, the highest preset priority is set to the first preset priority and the second preset priority respectively, and the first preset priority is set to be greater than the second preset priority.

[0111] The task priority of the task that is about to be stuck is set to the highest first preset priority, and the task priority of the task that is processed for the first time is set to the second preset priority, which is lower than the first preset priority but higher than the task priority of all first tasks. The scheduling priority of each target task is determined based on the first preset priority, the second preset priority and the task priority of the first task.

[0112] It is understandable that the first preset priority of the task that is about to be stalled is higher than the second preset priority of the task that is processed for the first time, indicating that the scheduling priority of the task that is about to be stalled is higher than the scheduling priority of the task that is processed for the first time, and the task that is about to be stalled is scheduled to be executed before the task that is processed for the first time.

[0113] For example, assuming a budgeted time threshold of 10ms, if the remaining budgeted time for task A, which is about to be stalled, is 5ms, then the task priority for task A is set to the first preset priority of 100. For task B, which is being processed for the first time, regardless of its remaining budgeted time, its task priority is always set to the second budgeted priority of 95. For tasks C and D, which have remaining budgeted time of 15ms and 20ms respectively, task C's task priority is set to 85, and task D's task priority is set to 80. Based on the final determined task priorities, the scheduling execution order of the four target tasks is: task A, task B, task C, and task D.

[0114] Optionally, the expression for the task priority of the task to be stalled and the task to be processed for the first time is as follows: ; ; ; in, Prioritize tasks that are about to experience lag; Prioritize tasks that are processed for the first time; It is the first preset priority; It is the second preset priority.

[0115] The task scheduling method provided in this invention identifies target tasks with a remaining budget time of less than a preset time threshold as tasks that are about to stall. It also limits the priority of tasks that are about to stall to a higher priority than the priority of the first-processed task, and the priority of both tasks that are about to stall and the first-processed task is higher than the priority of other first tasks. This method prevents tasks from starving and avoids lag in result output, while ensuring that the first-processed task responds quickly enough to follow the principles of first-task priority and stall priority. It avoids scheduling non-stalled tasks that are not processed for the first time before tasks that are about to stall and the first-processed task, thereby improving the user's smoothness experience.

[0116] Based on the above embodiments, as an optional embodiment, it further includes: If at least one of the target tasks is detected in the task queue, several tasks to be combined are selected from the target tasks based on the task priority of each target task. The data of the several tasks to be combined are concatenated to obtain concatenated data; The spliced ​​data is processed to obtain processed data; According to the several tasks to be combined, the processing data is split into tasks to obtain the processing sub-data corresponding to the several tasks to be combined.

[0117] In this embodiment of the invention, "several" refers to one or more, that is, at least one.

[0118] Tasks to be combined are at least one target task that needs to be combined together.

[0119] Specifically, Figure 2 This is the second flowchart illustrating the task scheduling method provided by the present invention, as shown below. Figure 2 As shown, during task scheduling, the priority of each target task in the task queue is first determined, including but not limited to: the priority of tasks that are about to be delayed is determined as the first preset priority; the priority of tasks that are processed for the first time is determined as the second preset priority; for the first task other than the tasks that are processed for the first time and the tasks that are about to be delayed, the budget duration is determined based on its estimated processing time and throughput coefficient, the remaining budget duration is determined based on the difference between the budget duration and the current processing time, the urgency of the first task is assessed, and then the task priority that is inversely proportional to the remaining budget duration is determined.

[0120] If at least one target task is detected in the task queue, several tasks to be combined are selected in descending order of the target task's priority. First, the data of the several tasks to be combined are concatenated to obtain concatenated data. Then, the concatenated data is processed according to the pre-set processing steps of the target task to obtain processed data. Finally, according to the several tasks to be combined, the concatenated and processed data is split into tasks to obtain the processing sub-data corresponding to the several tasks to be combined.

[0121] Considering that the target task needs to be processed and executed multiple times to complete, after splitting the processing data into several tasks to be combined, and obtaining the processing sub-data corresponding to each task to be combined, the process returns to the step of selecting several tasks to be combined from each target task based on the task priority of each target task, until all target tasks in the task queue are detected to have been processed.

[0122] Optionally, when the task processing engine includes multiple parallel task processing modules for processing different processing granularities and different processing difficulties, for each task processing module, when the task processing module detects that there is at least one target task in the task queue, the task processing module determines the task priority of each target task based on its own preset single frame duration, module weight, preset maximum budget duration, and other configurations, as well as the throughput coefficient and current processing time of the target task, and selects several tasks to be combined from each target task; the data of the several tasks to be combined are concatenated to obtain concatenated data; the concatenated data is sent to the inference model for processing to obtain processed data; according to the several tasks to be combined, the processed data is split into tasks to obtain the processing sub-data corresponding to the several tasks to be combined.

[0123] For example, in a speech decoding task, different target tasks under different task processing modules A, B, and C in the task processing engine are combined into a large batch task, which is then sent to the task processing engine for decoding. After decoding, the processed data is split into sub-processing data and then sent out.

[0124] The task scheduling method provided in this invention selects several tasks to be combined from the target tasks based on the task priority determined by the estimated processing time and throughput coefficient. The tasks to be combined are then sequentially spliced, processed, and split to obtain the processing sub-data corresponding to each task to be combined. Thus, task scheduling is completed by simply adjusting the throughput coefficient to adjust the estimated time and finally adjusting the scheduling priority. The task scheduling processing order can be determined while taking into account indicators such as throughput and lag without setting complex tuning parameters. This facilitates parameter tuning, improves task response time, achieves load balancing in task scheduling, and improves the user's product experience.

[0125] Based on the above embodiments, as an optional embodiment, the step of selecting several tasks to be combined from the target tasks based on the task priorities of each target task includes: Based on the task priority of each target task and the preset maximum task quantity, a number of tasks to be combined are selected from each target task; the number of the number of tasks to be combined is less than or equal to the preset maximum task quantity. The step of concatenating the data of the several tasks to be combined to obtain concatenated data includes: The partial data of the several tasks to be combined are spliced ​​together to obtain spliced ​​data; the partial data of any one of the tasks to be combined is unprocessed data of a preset data size in the complete data of the task to be combined.

[0126] Understandably, the preset maximum task volume and preset data volume can be determined comprehensively based on factors such as historical task scheduling data, the computing performance of the task processing module, real-time requirements, and response time requirements, and there are no restrictions on them.

[0127] Optionally, when there are multiple task processing modules, the preset maximum task volume of each task processing module is different because the processing granularity and processing difficulty of each task processing module are different.

[0128] Specifically, in the process of selecting tasks to be combined based on task priority, according to the preset maximum task volume, a number of tasks to be combined that are less than or equal to the preset maximum task volume are determined in descending order of task priority. Then, a preset amount of unprocessed data from the complete data of each task to be combined is selected as a partial data set and concatenated to obtain concatenated data. This concatenated data is then processed and split to obtain the corresponding processing sub-data for each task to be combined.

[0129] For example, taking a speech decoding task as the target task, the linear priority scheduling process for speech decoding tasks includes "trigger scheduling → priority sorting → context task assembly → execution thread inference → context task decomposition". Specifically, when at least one speech decoding task is detected in the task queue, the scheduling process is triggered to determine the task priority of each speech decoding task in the task queue. Within a preset maximum task volume, speech decoding tasks to be combined are selected in descending order of task priority until the preset maximum task volume is reached. A portion of data of a preset data size from the complete data of the speech decoding tasks to be combined is assembled into a concatenated data. The concatenated data is then fed into the inference model to perform one linear inference of model decoding, obtaining the inference output data as the processing data. The inference output data is then split into sub-processing data corresponding to each speech decoding task, and finally returned to the task queue until all speech parsing tasks in the task queue have been parsed.

[0130] The task scheduling method provided in this invention first determines the number of tasks to be combined based on a preset maximum task volume, avoiding situations where tasks with excessive data volume in the task queue cannot be scheduled and executed due to data volume limitations. Then, in the process of assembling the combined tasks, at least a portion of the data is determined from the tasks to be combined based on a preset data volume for splicing processing. This avoids situations where the system is unstable or the load is unbalanced due to excessive data volume in task splicing and processing, and more effectively controls the complexity of task scheduling and the scale of data processing, thereby improving task scheduling performance and ensuring system task balance.

[0131] Based on the above embodiments, as an optional embodiment, when at least one of the target tasks is detected in the task queue, selecting several tasks to be combined from the target tasks based on the task priority of each target task includes: If at least one of the target tasks is detected in the task queue and the preset conditions are met, several tasks to be combined are selected from the target tasks based on the task priority of each target task. The preset conditions include at least one of the following: The workload of each target task reaches a preset workload threshold; the preset workload threshold is less than the preset maximum workload. The task volume of each target task is less than a preset task volume threshold, and there is a task among the target tasks whose task priority reaches a third preset priority; the third preset priority is less than the preset highest priority.

[0132] The preset task volume threshold is a pre-set threshold used to determine whether to perform task scheduling. Generally, when the total number of target tasks in the task queue exceeds the preset task volume threshold, it indicates that there are a large number of target tasks, triggering the target task scheduling process for the current round.

[0133] The third preset priority is a pre-defined task priority used to determine whether task scheduling should be performed. Generally, if the priority of any target task in the task queue is higher than the third preset priority, the target task scheduling for the current round will be triggered.

[0134] It should be noted that the preset task volume threshold and the third preset priority can be determined comprehensively based on factors such as historical task scheduling data, the computing performance of the task processing module, real-time requirements, and response time requirements, and there are no restrictions on them.

[0135] Furthermore, when the task priority of the target task is greater than or equal to the preset highest priority, it indicates that the target task is an urgent task, which may be the first task to be processed or a task that is about to be stuck; when the task priority of the target task is greater than or equal to the third preset priority and less than the preset highest priority, the target task is a normal task that is not urgent; when the task priority of the target task is less than the third preset priority, the target task is a non-urgent task with sufficient budget margin. In the case of tight resources, it can be temporarily shelved and not participate in task scheduling until the urgency of the task increases, at which point it will participate in scheduling and execution.

[0136] Optionally, the preset task volume threshold is half of the preset maximum task volume.

[0137] Optionally, the third preset priority is determined based on half of the preset highest priority.

[0138] Optionally, the third preset priority is determined based on half of the first preset priority, or the third preset priority is determined based on half of the second preset priority.

[0139] Specifically, Figure 3 This is the third flowchart of the task scheduling method provided by the present invention, as shown below. Figure 3 As shown, taking the example that the preset task volume threshold is half of the preset maximum task volume and the preset third duration corresponding to the third preset priority is half of the preset highest priority, after triggering the process of filtering tasks to be combined from the task queue, if at least one target task is detected in the task queue, it is further determined whether the target task in the task queue meets the task volume condition or priority condition.

[0140] During the task volume condition judgment process, if the task volume of target tasks in the task queue is greater than or equal to the preset task volume threshold, that is, the task volume reaches half of the preset maximum task volume, the task volume condition is met. Further, based on the task priority of each target task, tasks to be combined are selected from the target tasks to participate in subsequent task scheduling processing. At this point, if the task volume of target tasks in the task queue is greater than the preset maximum task volume, the tasks to be combined with the preset maximum task volume are determined in descending order of task priority for task splicing; if the task volume of target tasks in the task queue is less than the preset maximum task volume but greater than or equal to the preset task volume threshold, all target tasks in the task queue are identified as tasks to be combined.

[0141] If the number of target tasks in the task queue is less than the preset task quantity threshold, a priority condition judgment process is performed. If the priority of any target task in the task queue reaches the third preset priority, the priority condition is met. Then, based on the priority of each target task, several tasks to be combined are selected from each target task for this round of task scheduling.

[0142] If the number of target tasks in the task queue is less than the preset task quantity threshold, and the priority of the target tasks in the task queue has not reached the third preset priority, it means that the task at this time does not meet the task quantity condition or the priority condition, that is, it does not meet the preset conditions. All tasks in the queue are non-urgent tasks. In the current round, the task to be combined will not be screened for task scheduling and will wait for the next round of tasks.

[0143] The task scheduling method provided in this embodiment of the invention further limits the selection of several tasks to be combined from the target tasks to perform tasks such as context splicing only when the task quantity of the target tasks in the task queue reaches a preset task quantity threshold or the task priority of the target tasks reaches a third preset priority. This avoids performing task scheduling processing even when the task quantity is insufficient and the task is not urgent, thereby improving the performance of the task scheduling engine and ensuring the task balance of the system through a more efficient and reasonable task scheduling method.

[0144] Figure 4 This is a schematic diagram of the task scheduling device provided by the present invention, as shown below. Figure 4 As shown, the task scheduling device includes, but is not limited to, a first determining module 401, a second determining module 402, a third determining module 403, and a fourth determining module 404.

[0145] The first determining module 401 is used to determine the budget duration of the target task based on the estimated processing time of the target task and the throughput coefficient of the target task when the target task is the first task; the throughput coefficient is used to control the throughput of the target task, and the budget duration is less than the estimated processing time.

[0146] The second determining module 402 is used to determine the remaining budget duration of the target task based on the difference between the budget duration and the current processing time of the target task; the current processing time is the duration from the start of processing of the target task to the current time.

[0147] The third determining module 403 is used to determine the task priority of the target task based on the remaining budget time; the task priority of the first task is inversely proportional to the remaining budget time.

[0148] The fourth determining module 404 is used to determine the task priority of the target task as a preset highest priority when the target task is the second task; the preset highest priority is greater than the task priority of the first task.

[0149] The urgency of the first task is lower than that of the second task; the task priority is used to indicate the scheduling priority of the target task.

[0150] It should be noted that the task scheduling device provided by the present invention can execute the task scheduling method described in any of the above embodiments during specific operation, which will not be elaborated in this embodiment.

[0151] The task scheduling device provided in this invention determines the budget duration for target tasks with low urgency based on estimated processing time and throughput coefficient. It then determines the remaining budget duration based on the difference between the budget duration and the current processing time. Finally, it determines the task priority based on the inverse ratio of the remaining budget duration to ultimately indicate the task's scheduling priority. When optimizing task scheduling parameters, only the throughput coefficient needs to be adjusted to adjust the budget duration and ultimately adjust the scheduling priority. This eliminates the need for setting complex optimization parameters and simultaneously considers throughput, latency, and other metrics while improving response time, achieving task scheduling load balancing and improving the user experience. This includes methods based on estimated processing time and throughput coefficient. When determining the budgeted processing time based on processing duration and throughput coefficient, the throughput coefficient is adjusted while ensuring that the budgeted processing time is less than the estimated processing time. This ensures that the actual processing time of the task does not exceed the estimated processing time, avoiding data backlog and resulting congestion. By setting the task priority of the target task and linking it to its remaining budgeted time, the target tasks with shorter remaining budgeted time are processed first to reduce the throughput deviation of different tasks during execution, ensuring balanced task execution load and avoiding sudden processing bottlenecks or resource overload. Prioritizing the processing of target tasks with higher urgency prevents non-urgent tasks from being processed before urgent tasks, thus avoiding errors and stabilizing the system's task scheduling performance.

[0152] Based on any of the above embodiments, the task scheduling device further includes a fifth determining module, used to determine the total estimated number of output frames based on the estimated number of output frames of the target task in multiple processing steps; and to determine the estimated processing time based on the product of the total estimated number of output frames and the preset single frame duration; the target task is a speech synthesis task.

[0153] Based on any of the above embodiments, the third determining module is further configured to determine the task priority of the target task based on the difference between the preset maximum budget duration and the remaining budget duration; wherein the preset maximum budget duration is greater than or equal to the budget duration of the target task.

[0154] Based on any of the above embodiments, the first determining module is further configured to determine the budget duration of the target task based on the product of the estimated processing time and the throughput coefficient; wherein the throughput coefficient is greater than 0 and less than or equal to 1; the smaller the throughput coefficient, the higher the throughput of the target task.

[0155] Based on any of the above embodiments, the task scheduling device further includes a splicing processing module, which includes: The task filtering module is used to filter out several tasks to be combined from each of the target tasks based on the task priority of each target task when at least one of the target tasks is detected in the task queue. The data splicing module is used to splice the data of the several tasks to be combined to obtain spliced ​​data; The data processing module is used to process the spliced ​​data to obtain processed data; The data splitting module is used to split the processing data into task sub-data corresponding to the several tasks to be combined, according to the several tasks to be combined.

[0156] Based on any of the above embodiments, the task filtering module is further configured to filter out a plurality of tasks to be combined from each of the target tasks based on the task priority of each target task and a preset maximum task quantity; the number of the plurality of tasks to be combined is less than or equal to the preset maximum task quantity. The data splicing module is also used to splice partial data of the several tasks to be combined to obtain spliced ​​data; any partial data of the tasks to be combined is unprocessed data of a preset data size in the complete data of the tasks to be combined.

[0157] Based on any of the above embodiments, the task filtering module is further configured to, when detecting that there is at least one of the target tasks in the task queue and satisfying the preset conditions, filter out a number of tasks to be combined from each of the target tasks based on the task priority of each of the target tasks. The preset conditions include at least one of the following: The workload of each target task reaches a preset workload threshold; the preset workload threshold is less than the preset maximum workload. The task volume of each target task is less than a preset task volume threshold, and there is a task among the target tasks whose task priority reaches a third preset priority; the third preset priority is less than the preset highest priority.

[0158] Figure 5 This is a schematic diagram of the structure of the electronic device provided by the present invention, such as... Figure 5As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530, and a communications bus 540, wherein the processor 510, the communications interface 520, and the memory 530 communicate with each other through the communications bus 540. The processor 510 can invoke logical instructions in the memory 530 to execute a task scheduling method, the method comprising: when the target task is a first task, determining the budget duration of the target task based on the estimated processing time of the target task and the throughput coefficient of the target task; the throughput coefficient is used to control the throughput of the target task, and the budget duration is less than the estimated processing time; determining the remaining budget duration of the target task based on the difference between the budget duration and the current processing time of the target task; the current processing time is the duration from the start time of the target task to the current time; determining the task priority of the target task based on the remaining budget duration; the task priority of the first task is inversely proportional to the remaining budget duration; when the target task is a second task, determining the task priority of the target task as a preset highest priority; the preset highest priority is greater than the task priority of the first task; wherein the urgency of the first task is less than the urgency of the second task; the task priority is used to indicate the scheduling priority of the target task.

[0159] Furthermore, the logical instructions in the aforementioned memory 530 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0160] On the other hand, the present invention also provides a computer program product, the computer program product including a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the task scheduling method provided by the above methods. The method includes: when the target task is a first task, determining the budget duration of the target task based on the estimated processing time of the target task and the throughput coefficient of the target task; the throughput coefficient is used to control the throughput of the target task, and the budget duration is less than the estimated processing time; determining the remaining budget duration of the target task based on the difference between the budget duration and the current processing time of the target task; the current processing time is the duration from the start time of the target task to the current time; determining the task priority of the target task based on the remaining budget duration; the task priority of the first task is inversely proportional to the remaining budget duration; when the target task is a second task, determining the task priority of the target task as a preset highest priority; the preset highest priority is greater than the task priority of the first task; wherein the urgency of the first task is less than the urgency of the second task; the task priority is used to indicate the scheduling priority of the target task.

[0161] In another aspect, the present invention also provides a non-transitory computer-readable storage medium storing a computer program thereon, which, when executed by a processor, implements the task scheduling method provided by the above methods. The method includes: when the target task is a first task, determining a budgeted duration for the target task based on an estimated processing time and a throughput coefficient of the target task; the throughput coefficient is used to control the throughput of the target task, and the budgeted duration is less than the estimated processing time; determining a remaining budgeted duration for the target task based on the difference between the budgeted duration and the current processing time of the target task; the current processing time is the duration from the start of processing of the target task to the current time; determining a task priority for the target task based on the remaining budgeted duration; the task priority of the first task is inversely proportional to the remaining budgeted duration; when the target task is a second task, determining the task priority of the target task as a preset highest priority; the preset highest priority is greater than the task priority of the first task; wherein the urgency of the first task is less than the urgency of the second task; the task priority is used to indicate the scheduling priority of the target task.

[0162] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0163] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0164] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A task scheduling method, characterized in that, include: When the target task is the first task, the budgeted duration of the target task is determined based on the estimated processing time and the throughput coefficient of the target task; the throughput coefficient is used to control the throughput of the target task, and the budgeted duration is less than the estimated processing time. The remaining budgeted time for the target task is determined based on the difference between the budgeted time and the current processing time of the target task; the current processing time is the time from the start of processing of the target task to the current time. Based on the remaining time in the budget, the task priority of the target task is determined; the task priority of the first task is inversely proportional to the remaining time in the budget. If the target task is the second task, the task priority of the target task is set to the preset highest priority; The preset highest priority is greater than the task priority of the first task; The urgency of the first task is lower than that of the second task; the task priority is used to indicate the scheduling priority of the target task.

2. The task scheduling method according to claim 1, characterized in that, The target task is speech synthesis, and the estimated processing time is determined based on the following method: The total estimated number of output frames is determined based on the estimated number of output frames of the target task in multiple processing steps. The estimated processing time is determined based on the product of the total estimated number of output frames and the preset single frame duration.

3. The task scheduling method according to claim 1, characterized in that, Determining the task priority of the target task based on the remaining budget time includes: The task priority of the target task is determined based on the difference between the preset maximum budget duration and the remaining budget duration. Wherein, the preset maximum budget duration is greater than or equal to the budget duration of the target task.

4. The task scheduling method according to claim 1, characterized in that, The process of determining the budget duration of the target task based on the estimated processing time and the throughput coefficient of the target task includes: The budget duration of the target task is determined based on the product of the estimated processing time and the throughput coefficient. The throughput coefficient is greater than 0 and less than or equal to 1; the smaller the throughput coefficient, the higher the throughput of the target task.

5. The task scheduling method according to claim 1, characterized in that, The second task includes initial processing tasks and / or tasks that will be delayed; The first processing task is the first task to be processed; the remaining budget time for the task that is about to be stuck is less than a preset time threshold. The preset highest priority includes a first preset priority and a second preset priority, wherein the first preset priority is greater than the second preset priority; The priority of the task that is about to be stuck is the first preset priority, and the priority of the task that is processed for the first time is the second preset priority.

6. The task scheduling method according to any one of claims 1 to 5, characterized in that, Also includes: If at least one of the target tasks is detected in the task queue, several tasks to be combined are selected from the target tasks based on the task priority of each target task. The data of the several tasks to be combined are concatenated to obtain concatenated data; The spliced ​​data is processed to obtain processed data; According to the several tasks to be combined, the processing data is split into tasks to obtain the processing sub-data corresponding to the several tasks to be combined.

7. The task scheduling method according to claim 6, characterized in that, The step of selecting several tasks to be combined from the target tasks based on their task priorities includes: Based on the task priority of each target task and the preset maximum task quantity, a number of tasks to be combined are selected from each target task; the number of the number of tasks to be combined is less than or equal to the preset maximum task quantity. The step of concatenating the data of the several tasks to be combined to obtain concatenated data includes: The partial data of the several tasks to be combined are spliced ​​together to obtain spliced ​​data; the partial data of any one of the tasks to be combined is unprocessed data of a preset data size in the complete data of the task to be combined.

8. The task scheduling method according to claim 7, characterized in that, When at least one of the target tasks is detected in the task queue, based on the task priority of each target task, a number of tasks to be combined are selected from the target tasks, including: If at least one of the target tasks is detected in the task queue and the preset conditions are met, several tasks to be combined are selected from the target tasks based on the task priority of each target task. The preset conditions include at least one of the following: The workload of each target task reaches a preset workload threshold; the preset workload threshold is less than the preset maximum workload. The task volume of each target task is less than a preset task volume threshold, and there is a task among the target tasks whose task priority reaches a third preset priority; the third preset priority is less than the preset highest priority.

9. A task scheduling device, characterized in that, include: The first determining module is used to determine the budget duration of the target task based on the estimated processing time and the throughput coefficient of the target task when the target task is the first task; the throughput coefficient is used to control the throughput of the target task, and the budget duration is less than the estimated processing time. The second determining module is used to determine the remaining budgeted time of the target task based on the difference between the budgeted time and the current processing time of the target task; the current processing time is the time from the start of processing of the target task to the current time. The third determining module is used to determine the task priority of the target task based on the remaining budget time; the task priority of the first task is inversely proportional to the remaining budget time. The fourth determining module is used to determine the task priority of the target task as the preset highest priority when the target task is the second task. The preset highest priority is greater than the task priority of the first task; The urgency of the first task is lower than that of the second task; the task priority is used to indicate the scheduling priority of the target task.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the task scheduling method as described in any one of claims 1 to 8.

11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the task scheduling method as described in any one of claims 1 to 8.

12. A computer program product, comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the task scheduling method as described in any one of claims 1 to 8.