Data processing method and apparatus
By releasing the resources of low-priority tasks in the task queue through the target proxy module, the problem of high-priority tasks being blocked is solved, thus achieving efficient task scheduling and system response.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-11-03
- Publication Date
- 2026-03-13
AI Technical Summary
In existing technologies, high-priority tasks are blocked by low-priority tasks occupying resources, which affects the response speed of critical business and system efficiency.
The target agent module reads the tasks to be executed from the target task queue. When the target task meets the suspension conditions, it switches it to the aborted state and releases resources to ensure that high-priority tasks can be executed in a timely manner.
It enables timely scheduling of high-priority tasks, avoids long-term blocking, and ensures high efficiency in task execution and overall system efficiency.
Smart Images

Figure CN121050864B_ABST
Abstract
Description
Technical Field
[0001] The embodiments in this specification relate to the field of data processing technology, and in particular to data processing methods and apparatus. Background Technology
[0002] In modern computer systems, distributed computing platforms, and automated task scheduling scenarios, concurrent execution of multiple tasks has become the norm. As system complexity increases, task queues often contain tasks with varying priorities. Traditional task scheduling mechanisms typically employ static priority queues or simple preemptive scheduling strategies. When a high-priority task enters the pending execution state, if its required resources are being used by a low-priority task, existing scheduling methods often fail to release resources promptly, leading to the high-priority task being blocked and impacting the response speed of critical business operations and overall system efficiency. Therefore, a more effective data processing method is urgently needed to address these issues. Summary of the Invention
[0003] In view of the above, embodiments of this specification provide a data processing method. One or more embodiments of this specification also relate to a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product, to address the technical deficiencies existing in the prior art.
[0004] According to a first aspect of the embodiments of this specification, a data processing method is provided, comprising:
[0005] Read the tasks to be executed from the target task queue and determine the target task that the target agent module is proxying;
[0006] The target proxy module is invoked. If the target task meets the suspension conditions based on the task attribute data associated with the target task queue, the target task is switched to an aborted state and the task execution resources occupied by the target task are released. The priority of the task to be executed is higher than the priority of the target task.
[0007] The task to be executed is performed using the task execution resources.
[0008] According to a second aspect of the embodiments of this specification, a data processing apparatus is provided, comprising:
[0009] The reading module is configured to read tasks to be executed from the target task queue and determine the target task that the target proxy module proxies;
[0010] The calling module is configured to call the target proxy module, and when it is determined that the target task meets the suspension conditions based on the task attribute data associated with the target task queue, switch the target task to an aborted state and release the task execution resources occupied by the target task. The priority of the task to be executed is higher than the priority of the target task.
[0011] The execution module is configured to execute the task to be executed using the task execution resources.
[0012] According to a third aspect of the embodiments of this specification, a computing device is provided, comprising:
[0013] Memory and processor;
[0014] The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the above-described data processing method.
[0015] According to a fourth aspect of the embodiments of this specification, a computer-readable storage medium is provided that stores computer-executable instructions, which, when executed by a processor, implement the steps of the data processing method described above.
[0016] According to a fifth aspect of the embodiments of this specification, a computer program product is provided, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described data processing method.
[0017] The data processing method provided in this specification, based on the matching results, determines the target task among at least one execution state task by reading the tasks to be executed from the target task queue and determining the target task to be proxies by the target proxy module. The target proxy module is invoked, and if the target task meets the suspension conditions based on the task attribute data associated with the target task queue, the target task is switched to an aborted state, and the task execution resources occupied by the target task are released. The priority of the tasks to be executed is higher than the priority of the target task. When a high-priority task to be executed is ready and needs to be executed immediately, the target proxy module can proxy the target task currently occupying task execution resources. If the target task meets the suspension conditions, indicating that there are currently no task resources available for the task to be executed, the execution of the target task is aborted, the occupied task execution resources are promptly released, and the task to be executed is executed using the task execution resources. This achieves priority scheduling of high-priority tasks to be executed, avoids long-term blocking of high-priority tasks to be executed, and ensures that tasks to be executed can be executed preferentially and promptly. Attached Figure Description
[0018] Figure 1 This is a schematic diagram of a data processing method provided in one embodiment of this specification;
[0019] Figure 2 This is a flowchart illustrating a data processing method provided in one embodiment of this specification;
[0020] Figure 3 This is a task scheduling view of a data processing method provided in one embodiment of this specification;
[0021] Figure 4 This is a flowchart illustrating the processing procedure of a data processing method provided in one embodiment of this specification.
[0022] Figure 5 This is a schematic diagram of the structure of a data processing apparatus provided in one embodiment of this specification;
[0023] Figure 6 This is a structural block diagram of a computing device provided in one embodiment of this specification. Detailed Implementation
[0024] Many specific details are set forth in the following description to provide a full understanding of this specification. However, this specification can be implemented in many other ways than those described herein, and those skilled in the art can make similar extensions without departing from the spirit of this specification. Therefore, this specification is not limited to the specific implementations disclosed below.
[0025] The terminology used in one or more embodiments of this specification is for the purpose of describing particular embodiments only and is not intended to be limiting of the one or more embodiments of this specification. The singular forms “a,” “described,” and “the” as used in one or more embodiments of this specification and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term “and / or” as used in one or more embodiments of this specification refers to and includes any or all possible combinations of one or more associated listed items.
[0026] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this specification, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this specification, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0027] Furthermore, it should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in one or more embodiments of this specification are all information and data authorized by the user or fully authorized by all parties. Moreover, the collection, use and processing of related data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and corresponding operation entry points are provided for users to choose to authorize or refuse.
[0028] First, the terms and concepts used in one or more embodiments of this specification will be explained.
[0029] Method Proxy: This is an implementation of the proxy pattern. It controls access to the target object through a proxy object, adding extra logic (such as permission verification, logging, transaction management, etc.) before and after calling the target method, without modifying the target object's code.
[0030] This specification provides a data processing method, and also relates to a data processing apparatus, a computing device, a computer-readable storage medium, and a computer program product, which will be described in detail in the following embodiments.
[0031] See Figure 1 The diagram illustrates how, to immediately allocate execution resources to high-priority tasks when they need to be executed, a target proxy module can be used to delegate the target task, freeing up the execution resources occupied by the target task and ensuring its priority and timely execution. The process involves reading tasks from the target task queue and identifying the target task delegated by the target proxy module. The target proxy module is then invoked. If the target task meets the suspension conditions based on the task attribute data associated with the target task queue, the target task is switched to an aborted state, and its execution resources are released. The priority of the task to be executed is higher than that of the target task. When a high-priority task is ready to be executed immediately, the target proxy module can proxy the target task that is currently using task execution resources. If the target task meets the suspension conditions, indicating that there are currently no task resources available for the task to be executed, the execution of the target task will be suspended, the occupied task execution resources will be promptly released, and the task to be executed will be executed using the task execution resources. This achieves priority scheduling of high-priority tasks, avoids long-term blocking of high-priority tasks, and ensures that tasks to be executed can be executed in a priority and timely manner.
[0032] See Figure 2 , Figure 2A flowchart of a data processing method according to an embodiment of this specification is shown, which specifically includes the following steps.
[0033] Step S202: Read the tasks to be executed from the target task queue and determine the target task to be proxied by the target agent module.
[0034] Specifically, tasks to be executed can be tasks that require task scheduling to execute in system environments such as distributed systems, multi-core systems, high-concurrency service environments, operating systems, and control systems. Tasks to be executed can be high-priority tasks that need to be executed immediately. The target task queue stores tasks that have been submitted and are waiting for resource allocation and execution. Target tasks can be low-priority tasks that have already occupied the resources required for task execution and are currently executing or waiting to be executed. The target proxy module, also known as a method proxy, is used to control the execution process, progress, and status of the target task through bytecode instrumentation. The target proxy module can intervene in the execution flow of the target task by inserting custom logic during its execution. The target proxy module can also terminate the target task and put it into a sleep state by configuring a sleep event (custom logic) for the target task. The sleep time corresponding to the sleep event can be set to a duration such as 100 milliseconds according to actual needs.
[0035] Based on this, high-priority tasks are read from the target task queue that stores submitted tasks awaiting execution, and the low-priority tasks to be handled by the target proxy module, i.e., the target tasks, are determined. The target proxy module can then delegate the execution of the target tasks.
[0036] In practical applications, when the target proxy module determines that the task to be executed needs to be executed, the priority of the task to be executed is determined to be higher than the priority of the proxy target task. Subsequently, the execution flow of the target task can be controlled to ensure that the task to be executed can be executed first.
[0037] Furthermore, the target task queue stores tasks that have already been submitted. Before a task is submitted and stored in the target task queue, it can be stored in a priority queue according to its priority. The specific implementation method is as follows:
[0038] A priority queue containing at least one executable task is determined, wherein the at least one executable task in the priority queue is arranged according to task priority; the task to be executed is extracted from the priority queue according to the task extraction method, and the task to be executed is submitted to the target task queue.
[0039] Specifically, a priority queue can be a task queue that maintains executable tasks. Executable tasks can be tasks that are yet to be executed and have not yet been submitted to the target task queue. The priority queue contains at least one executable task arranged in descending order of task priority, with higher-priority executable tasks being submitted to the target task queue first.
[0040] Based on this, a priority queue containing at least one executable task is determined. The at least one executable task in the priority queue is arranged in descending order of task priority. When extracting executable tasks from the priority queue, high-priority executable tasks can also be extracted first. That is, the high-priority executable tasks are extracted first. The high-priority tasks to be executed are extracted from the priority queue and submitted to the target task queue.
[0041] For example, in a task scheduling scenario, task scheduling can be implemented based on task priority to ensure the orderly execution of tasks. Figure 3 As shown, the task queue is a priority queue, containing multiple executable tasks with priority information, such as priority 1, priority 2, priority 3, and priority 5. The executable tasks in the task queue are arranged in descending order of priority; that is, priority 1 represents high priority, and priority 5 represents low priority. When retrieving executable tasks from the task queue, the highest-priority executable tasks must first be retrieved and submitted as pending tasks to the target task queue.
[0042] In summary, by extracting high-priority tasks from the priority queue according to the task extraction method and submitting them to the target task queue, high-priority tasks are submitted first, ensuring that they can be executed first in the future.
[0043] Furthermore, considering that multiple tasks may be executing concurrently in the thread pool corresponding to a task thread, the target task can be determined in the task thread through matching. The specific implementation method is as follows:
[0044] Determine the task thread associated with the task to be executed, and determine at least one task in execution state corresponding to the task thread; determine the target task that matches the preset data among the at least one task in execution state.
[0045] Specifically, a task thread can be a thread pool that stores tasks in execution status. Tasks in execution status within a task thread have been allocated resources and execute using those resources. Tasks in execution status within a task thread can be in an executing state or an inactive state. Preset data can be preset pointcut expressions, i.e., regular expressions. The preset data can be determined based on the configuration paths of the tasks in execution status within the task thread.
[0046] Based on this, the task thread associated with the task to be executed is determined, and the task thread contains multiple tasks in the execution state. At least one task in the execution state corresponding to the task thread is determined, and among the at least one task in the execution state, the low-priority task that matches the preset data is selected as the target task.
[0047] Continuing with the previous example, such as Figure 3 As shown, the task thread is the thread pool, which contains eight tasks, from task 1 to task 8. Each task records the amount of CPU time required for its execution. Tasks 1-5 are low-priority tasks, each requiring 10% of CPU resources. Tasks 6, 7, and 8 correspond to priority 1, priority 2, and priority 3 tasks submitted to the task queue, respectively. Tasks 1-5 are in the execution state. The target task can be determined from among tasks 1-5 by matching them with preset data.
[0048] In summary, by identifying a low-priority task that matches preset data among at least one task in the execution state, and selecting it as the target task, the target task can be controlled to relinquish its execution resources to the task to be executed.
[0049] Furthermore, when determining the target task in at least one execution state task, it can be determined by matching the task parameters corresponding to each of the at least one execution state task with preset data. The specific implementation method is as follows:
[0050] Determine the task parameters corresponding to the at least one execution state task; match the preset data with the at least one task parameter respectively, and determine the target task in the at least one execution state task based on the matching result.
[0051] Specifically, the task parameters corresponding to the execution status task can be the configuration path of the execution status task, such as the configuration path containing ReportService and StatService. Preset parameters can be regular expressions; the matching result is the target task parameter that matches the regular expression, and the target task parameter conforms to the parameter rules set by the regular expression. Preset data is used to determine the low-priority target task among at least one execution status task.
[0052] Based on this, the configuration paths corresponding to at least one task in each execution state are used as task parameters. Preset data is matched against at least one task parameter, and the target task is determined from at least one task in each execution state based on the matching results.
[0053] Continuing with the previous example, the configuration path of the execution status task can be used as a task parameter. The default data is a regular expression generated based on the class name, package name, and class method name. The task parameter is matched using the regular expression, and the execution status task that matches the regular expression is selected as the target task. When matching all methods of all classes under the com.example.service package, the regular expression can be configured as follows: When you need to match all methods of the UserService class, the regular expression can be configured as follows: When matching the `getUserById` method of the `UserService` class (with a `Long` parameter), the regular expression can be configured as: `com.example.service.UserService.getUserById(Long)`; when matching methods that begin with "save" (with any parameter), the regular expression can be configured as: The configuration path of the execution status task is matched against a regular expression. If a match is successful, the target task can be determined.
[0054] In summary, by matching preset data with at least one task parameter, the target task can be determined from at least one task in execution state, thus achieving precise selection of the target task.
[0055] Step S204: Invoke the target agent module. If the target task meets the suspension condition based on the task attribute data associated with the target task queue, switch the target task to the aborted state and release the task execution resources occupied by the target task. The priority of the task to be executed is higher than the priority of the target task.
[0056] Specifically, after reading the tasks to be executed from the target task queue and determining the target task to be handled by the target proxy module, the target proxy module can be invoked. If the target task meets the suspension conditions based on the task attribute data associated with the target task queue, the target task is switched to an aborted state, and the task execution resources occupied by the target task are released. The priority of the tasks to be executed is higher than the priority of the target task. The task attribute data can include the number of tasks in the target task queue and the priority of each task. The task attribute data can also include the number of resources, such as CPU cores, provided for the execution of tasks in the target task queue. The suspension conditions determine whether the target task needs to be actively suspended. If the target task meets the suspension conditions, it means that the execution of the target task needs to be suspended. Whether the target task meets the suspension conditions can be determined based on the number of resources and the number of tasks corresponding to the target task queue. Switching the target task to an aborted state means that the execution of the target task is temporarily suspended. Task execution resources refer to the resources required for the execution of the target task, including but not limited to CPU cores, storage resources, computing resources, and bandwidth resources.
[0057] Based on this, after reading the tasks to be executed from the target task queue and determining the target task to be handled by the target proxy module, the target proxy module is invoked. If the target task meets the suspension conditions based on the task attribute data associated with the target task queue, it indicates that there are currently no resources available for the task to be executed. The target task needs to relinquish the execution resources it is currently occupying for the execution of the task to be executed. The target task is then switched to a suspended state, temporarily suspending its execution and releasing the execution resources it is occupying. The priority of the task to be executed is higher than that of the target task.
[0058] In practical applications, when switching a target task to an aborted state, it's necessary to determine its execution status. If the target task is not yet executed, it can be directly switched to an aborted state. If the target task is in an executing state, meaning it's currently running, its execution data needs to be recorded before switching it to an aborted state. This ensures that when the target task can be resumed later, it can continue execution based on the execution data.
[0059] Furthermore, the target task queue contains multiple tasks waiting to be executed, but the available task resources corresponding to the target task queue are limited. Therefore, we can obtain the task attribute data associated with the target task queue to facilitate resource allocation. The specific implementation method is as follows:
[0060] The target agent module is invoked to obtain the number of tasks and the number of high-priority tasks corresponding to the target task queue, as well as the number of task resources corresponding to the target task queue; the number of task resources, the number of tasks, and the number of high-priority tasks are used as the task attribute data.
[0061] Specifically, the number of tasks corresponding to the target task queue can be the number of tasks waiting to be executed in the target task queue, and the number of high-priority tasks is the number of high-priority tasks in the target task queue. The number of task resources is the amount of resources available for the tasks in the target task queue to be executed.
[0062] Based on this, the target proxy module is invoked to obtain the number of tasks and the number of high-priority tasks corresponding to the target task queue, as well as the number of task resources available for task execution in the target task queue. The number of task resources refers to the amount of resources provided to the target task queue. The number of task resources, the number of tasks, and the number of high-priority tasks are then used as task attribute data.
[0063] Continuing with the previous example, such as Figure 3 As shown, the target task queue corresponds to four task resources, corresponding to CPU1-CPU4. The target task queue can contain high-priority and low-priority tasks. The sum of the number of high-priority and low-priority tasks equals the total number of tasks in the target task queue. The target proxy module is essentially a method proxy, which can assign a method proxy to each low-priority task (task 1-task 5) in the thread pool. The method proxy is used to determine with the task manager whether any high-priority tasks have been submitted for execution, thereby determining whether the target task meets the suspension conditions. Tasks 1-5, as low-priority tasks, can correspond to non-urgent tasks such as report export. Task 1 occupies CPU1, Task 2 occupies CPU2, Tasks 3 and 4 occupies CPU3, and Task 5 occupies CPU4. Tasks 6-8, as high-priority tasks, can be transaction processing tasks, each corresponding to a main method. Each main method can contain multiple methods such as Method 1 and Method 2.
[0064] In summary, by using the number of task resources, the number of tasks, and the number of high-priority tasks as task attribute data, subsequent suspension condition detection of the target task can be performed based on the task attribute data.
[0065] Furthermore, after determining the task attribute data, the suspension conditions of the target task can be detected based on the task attribute data. The specific implementation method is as follows:
[0066] The task attribute data associated with the target task queue is determined to include the number of task resources, the number of tasks, and the number of high-priority tasks; the number of low-priority tasks is determined based on the number of tasks and the number of high-priority tasks; if the number of high-priority tasks is greater than zero and the number of low-priority tasks is greater than the number of task resources, the target task is determined to meet the suspension condition.
[0067] Specifically, the number of low-priority tasks can be determined by subtracting the number of high-priority tasks from the total number of tasks. A high-priority task count greater than zero indicates that there are currently high-priority tasks that need to be executed. A low-priority task count greater than the number of task resources indicates that there are currently no task resources available for high-priority tasks.
[0068] Based on this, the task attribute data associated with the target task queue is determined to include the number of task resources, the number of tasks, and the number of high-priority tasks. The number of low-priority tasks is obtained by subtracting the number of high-priority tasks from the number of tasks. If the number of high-priority tasks is greater than zero and the number of low-priority tasks is greater than the number of task resources, it indicates that there are currently high-priority tasks that need to be executed, but there are currently no task resources available for high-priority tasks to use, and all task resources are occupied by low-priority tasks. In this case, the target task is determined to meet the suspension condition.
[0069] Continuing with the previous example, such as Figure 3 As shown, there are currently high-priority tasks that need to be executed immediately, namely tasks 6, 7, and 8, and task resources CPU1-CPU4 are occupied by low-priority tasks 1-5. Therefore, it is determined that the target task (task 1) meets the suspension condition.
[0070] In summary, when the number of high-priority tasks is greater than zero and the number of low-priority tasks is greater than the number of task resources, the target task is determined to meet the suspension condition, that is, all available resources are occupied, and the target task needs to promptly relinquish the occupied task execution resources.
[0071] Furthermore, the target agent module can determine in real time whether the target task meets the suspension conditions, so as to execute the target task in a timely manner. The specific implementation method is as follows:
[0072] If the number of tasks is greater than zero and the number of low-priority tasks is less than the number of task resources, it is determined that the target task does not meet the suspension condition; the target proxy module is invoked to execute the target task.
[0073] Therefore, if the number of tasks is greater than zero and the number of low-priority tasks is less than the number of task resources, it means that even if all low-priority tasks occupy task resources and execute, there are still other available task resources for high-priority tasks to use. In this case, it is determined that the target task does not meet the suspension conditions, so there is no need to suspend the target task. The proxy task can run normally, and the target proxy module can be called to execute the target task.
[0074] In summary, when it is determined that the target task does not meet the suspension conditions, the target proxy module is invoked to execute the target task and resume its execution.
[0075] Step S206: Execute the task to be executed using the task execution resources.
[0076] Specifically, in the aforementioned call to the target proxy module, if the target task meets the suspension conditions based on the task attribute data associated with the target task queue, the target task is switched to an aborted state, and the task execution resources occupied by the target task are released. Once the priority of the task to be executed is higher than that of the target task, the task to be executed can be executed using the task execution resources. This ensures that the task to be executed can use the task execution resources released by the target task to execute the task when there are insufficient available resources, thus achieving priority scheduling of the task to be executed.
[0077] Furthermore, considering that the execution of the task to be executed uses the task execution resources released by the target task, the task execution resources occupied can be released immediately after the task to be executed is completed, so that they can be used by the target task or other tasks, thus avoiding the target task being in a suspended state for a long time. The specific implementation method is as follows:
[0078] If the task to be executed is completed, the task execution resources are released; if the target agent module detects that the task execution resources are idle, the target task is executed using the task execution resources.
[0079] Based on this, when the task to be executed is completed, the task execution resources are released; when the target agent module detects that the task execution resources are in an idle state, it means that the task execution resources are not occupied by other tasks, and the target agent module can occupy the task execution resources and use the task execution resources to execute the target task.
[0080] If the target proxy module detects that the task execution resources are idle, it can retrieve the task attribute data associated with the target task queue again. If the task attribute data determines that the target task does not meet the suspension conditions, it means that there are no high-priority tasks that need to occupy task execution resources, and the target task can be executed using the task execution resources. After the target proxy module updates the task status of the target task to the aborted state, it can check whether there are available resources for the target task at fixed time intervals. If available resources are found, the target task can be executed directly using the available resources.
[0081] In summary, when the target proxy module detects that the task execution resources are idle, it uses the task execution resources to execute the target task, promptly restoring the target task's execution status. Utilizing the task execution resources to execute the target task avoids the target task remaining in a suspended state (i.e., a waiting state) for an extended period, ensuring the timely execution of the target task.
[0082] The data processing method provided in this specification, based on the matching results, determines the target task among at least one execution state task by reading the tasks to be executed from the target task queue and determining the target task to be proxies by the target proxy module. The target proxy module is invoked, and if the target task meets the suspension conditions based on the task attribute data associated with the target task queue, the target task is switched to an aborted state, and the task execution resources occupied by the target task are released. The priority of the tasks to be executed is higher than the priority of the target task. When a high-priority task to be executed is ready and needs to be executed immediately, the target proxy module can proxy the target task currently occupying task execution resources. If the target task meets the suspension conditions, indicating that there are currently no task resources available for the task to be executed, the execution of the target task is aborted, the occupied task execution resources are promptly released, and the task to be executed is executed using the task execution resources. This achieves priority scheduling of high-priority tasks to be executed, avoids long-term blocking of high-priority tasks to be executed, and ensures that tasks to be executed can be executed preferentially and promptly.
[0083] The following is in conjunction with the appendix Figure 4 Taking the application of the data processing method provided in this specification in task scheduling as an example, the data processing method will be further explained. Figure 4 A flowchart illustrating the processing procedure of a data processing method according to an embodiment of this specification is shown, specifically including the following steps.
[0084] Step S402: Determine a priority queue containing at least one executable task, wherein the at least one executable task in the priority queue is arranged according to task priority.
[0085] In task scheduling scenarios, priority queues are typically used to maintain the tasks that need to be executed. Each priority queue contains at least one executable task, and these tasks are arranged in descending order of priority, with higher-priority tasks being scheduled first.
[0086] Step S404: Extract the tasks to be executed from the priority queue and submit them to the target task queue.
[0087] High-priority tasks can be identified in the priority queue and submitted for execution. The target task queue maintains the tasks submitted for execution.
[0088] Step S406: Determine the task thread associated with the task to be executed, and determine at least one task in execution status corresponding to the task thread.
[0089] The target thread is the thread pool, which contains multiple tasks in the execution state.
[0090] Step S408: Determine the task parameters corresponding to at least one task in the execution state, and use regular expressions to match at least one task parameter respectively. Based on the matching results, determine the target task in at least one task in the execution state.
[0091] The configuration path corresponding to the task in the execution status is used as the task parameter, and the low-priority target task is found by matching it with a regular expression.
[0092] Step S410: Call the target agent module to obtain the number of tasks and the number of high-priority tasks corresponding to the target task queue, as well as the number of task resources corresponding to the target task queue.
[0093] Step S412: Determine the number of low-priority tasks based on the number of tasks and the number of high-priority tasks.
[0094] The target proxy module proxies the target task, queries the number of tasks in the target task queue, and the number of high-priority tasks. It then determines the number of task resources. The target task queue contains high-priority and low-priority tasks; the number of low-priority tasks is determined based on the total number of tasks and the number of high-priority tasks.
[0095] Step S414: If the number of high-priority tasks is greater than zero and the number of low-priority tasks is greater than the number of task resources, determine that the target task meets the suspension condition.
[0096] Step S416: Switch the target task to the aborted state and release the task execution resources occupied by the target task.
[0097] Step S418: Execute the task to be executed using task execution resources, and release the task execution resources after the task to be executed is completed.
[0098] Step S420: If the number of tasks is greater than zero and the number of low-priority tasks is less than the number of task resources, determine that the target task does not meet the suspension conditions, and call the target proxy module to execute the target task.
[0099] In summary, when a high-priority task is ready to be executed immediately, the target proxy module can proxy the target task currently using task execution resources. If the target task meets the suspension conditions, indicating that there are currently no task resources available for the task to be executed, the execution of the target task is suspended, the occupied task execution resources are promptly released, and the task to be executed is executed using the task execution resources. This achieves priority scheduling of high-priority tasks, avoids long-term blocking of high-priority tasks, and ensures that tasks to be executed can be executed in a priority and timely manner.
[0100] Corresponding to the above method embodiments, this specification also provides data processing apparatus embodiments. Figure 5 A schematic diagram of the structure of a data processing apparatus according to one embodiment of this specification is shown. Figure 5 As shown, the device includes:
[0101] The reading module 502 is configured to read tasks to be executed from the target task queue and determine the target task that the target agent module is acting as.
[0102] Module 504 is configured to call the target proxy module, and when it is determined that the target task meets the suspension conditions based on the task attribute data associated with the target task queue, switch the target task to an aborted state and release the task execution resources occupied by the target task. The priority of the task to be executed is higher than the priority of the target task.
[0103] The execution module 506 is configured to execute the task to be executed using the task execution resources.
[0104] In an optional embodiment, the reading module 502 is further configured to:
[0105] Determine a priority queue containing at least one executable task, wherein the at least one executable task in the priority queue is arranged according to task priority;
[0106] The task to be executed is extracted from the priority queue according to the task extraction method, and then submitted to the target task queue.
[0107] In an optional embodiment, the reading module 502 is further configured to:
[0108] Determine the task thread associated with the task to be executed, and determine at least one task in execution state corresponding to the task thread;
[0109] The target task that matches the preset data is determined in the at least one execution state task.
[0110] In an optional embodiment, the reading module 502 is further configured to:
[0111] Determine the task parameters corresponding to each of the at least one execution state task;
[0112] The preset data is matched with at least one task parameter, and the target task is determined from the at least one execution state task based on the matching result.
[0113] In an optional embodiment, the calling module 504 is further configured to:
[0114] Invoke the target proxy module to obtain the number of tasks and the number of high-priority tasks corresponding to the target task queue, as well as the number of task resources corresponding to the target task queue;
[0115] The number of task resources, the number of tasks, and the number of high-priority tasks are used as the task attribute data.
[0116] In an optional embodiment, the calling module 504 is further configured to:
[0117] Determine the number of task resources, the number of tasks, and the number of high-priority tasks included in the task attribute data associated with the target task queue;
[0118] The number of low-priority tasks is determined based on the number of tasks and the number of high-priority tasks.
[0119] If the number of high-priority tasks is greater than zero and the number of low-priority tasks is greater than the number of task resources, then the target task is determined to meet the suspension condition.
[0120] In an optional embodiment, the calling module 504 is further configured to:
[0121] If the number of tasks is greater than zero and the number of low-priority tasks is less than the number of task resources, then the target task is determined not to meet the suspension condition.
[0122] The target agent module is invoked to execute the target task.
[0123] In an optional embodiment, the execution module 506 is further configured to:
[0124] Upon completion of the task to be executed, the task execution resources are released.
[0125] If the target agent module detects that the task execution resource is idle, the target task is executed using the task execution resource.
[0126] The data processing apparatus provided in this specification determines the target task among at least one execution state task based on the matching result by reading the tasks to be executed from the target task queue and determining the target task to be proxies by the target proxy module. The target proxy module is invoked, and if the target task meets the suspension conditions based on the task attribute data associated with the target task queue, the target task is switched to an aborted state, and the task execution resources occupied by the target task are released. The priority of the tasks to be executed is higher than the priority of the target task. When a high-priority task to be executed is ready and needs to be executed immediately, the target proxy module can proxy the target task currently occupying task execution resources. If the target task meets the suspension conditions, indicating that there are currently no task resources available for the task to be executed, the execution of the target task is aborted, the occupied task execution resources are promptly released, and the task to be executed is executed using the task execution resources. This achieves priority scheduling of high-priority tasks to be executed, avoids long-term blocking of high-priority tasks to be executed, and ensures that tasks to be executed can be executed preferentially and promptly.
[0127] The above is an illustrative scheme of a data processing apparatus according to this embodiment. It should be noted that the technical solution of this data processing apparatus and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the data processing apparatus, please refer to the description of the technical solution of the data processing method described above.
[0128] Figure 6 A structural block diagram of a computing device 600 according to one embodiment of this specification is shown. The components of the computing device 600 include, but are not limited to, a memory 610 and a processor 620. The processor 620 is connected to the memory 610 via a bus 630, and a database 650 is used to store data.
[0129] The computing device 600 also includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., a network interface card (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, or a Near Field Communication (NFC) interface.
[0130] In one embodiment of this specification, the above-described components of the computing device 600 and Figure 6 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 6 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this specification. Those skilled in the art can add or replace other components as needed.
[0131] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or personal computers (PCs). The computing device 600 can also be a mobile or stationary server.
[0132] The processor 620 is configured to execute the following computer-executable instructions, which, when executed by the processor, implement the steps of the above-described data processing method.
[0133] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the data processing method described above.
[0134] An embodiment of this specification also provides a computer-readable storage medium storing computer-executable instructions that, when executed by a processor, implement the steps of the above-described data processing method.
[0135] The above is an illustrative embodiment of a computer-readable storage medium. It should be noted that the technical solution of this storage medium and the technical solution of the data processing method described above belong to the same concept. Details not described in detail in the technical solution of the storage medium can be found in the description of the technical solution of the data processing method described above.
[0136] An embodiment of this specification also provides a computer program product, including a computer program or instructions that, when executed by a processor, implement the steps of the above-described data processing method.
[0137] The above is an illustrative scheme of a computer program product according to this embodiment. It should be noted that the technical solution of this computer program product and the technical solution of the data processing method described above belong to the same concept. For details not described in detail in the technical solution of the computer program product, please refer to the description of the technical solution of the data processing method described above.
[0138] The foregoing has described specific embodiments of this specification. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than that shown in the embodiments and may still achieve the desired result. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired result. In some embodiments, multitasking and parallel processing are possible or may be advantageous.
[0139] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or certain intermediate forms. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added or removed according to the requirements of patent practice. For example, in some regions, according to patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0140] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that the embodiments in this specification are not limited to the described order of actions, because according to the embodiments in this specification, some steps can be performed in other orders or simultaneously. Furthermore, those skilled in the art should also understand that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the embodiments in this specification.
[0141] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0142] The preferred embodiments disclosed above are merely illustrative of this specification. Optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the embodiments described in this specification. These embodiments are selected and specifically described in this specification to better explain the principles and practical applications of the embodiments, thereby enabling those skilled in the art to better understand and utilize this specification.
Claims
1. A data processing method, characterized in that, include: Read the tasks to be executed from the target task queue and determine the target task that the target agent module is proxying; The target proxy module is invoked. If the target task meets the suspension condition based on the task attribute data associated with the target task queue, the target task is switched to an aborted state and the task execution resources occupied by the target task are released. The priority of the task to be executed is higher than the priority of the target task. The task attribute data includes the number of task resources, the number of tasks, and the number of high-priority tasks. If the number of high-priority tasks is greater than zero and the number of low-priority tasks is greater than the number of task resources, the target task is determined to meet the suspension condition. The number of low-priority tasks is determined based on the number of tasks and the number of high-priority tasks. The task to be executed is performed using the task execution resources.
2. The data processing method according to claim 1, characterized in that, Before reading the tasks to be executed from the target task queue, the process also includes: Determine a priority queue containing at least one executable task, wherein the at least one executable task in the priority queue is arranged according to task priority; The task to be executed is extracted from the priority queue according to the task extraction method, and then submitted to the target task queue.
3. The data processing method according to claim 1, characterized in that, Before reading the tasks to be executed from the target task queue, the process also includes: Determine the task thread associated with the task to be executed, and determine at least one task in execution state corresponding to the task thread; The target task that matches the preset data is determined in the at least one execution state task.
4. The data processing method according to claim 3, characterized in that, Determining the target task that matches the preset data in the at least one execution state task includes: Determine the task parameters corresponding to each of the at least one execution state task; The preset data is matched with at least one task parameter, and the target task is determined from the at least one execution state task based on the matching result.
5. The data processing method according to claim 1, characterized in that, The determination of the task attribute data includes: Invoke the target proxy module to obtain the number of tasks and the number of high-priority tasks corresponding to the target task queue, as well as the number of task resources corresponding to the target task queue; The number of task resources, the number of tasks, and the number of high-priority tasks are used as the task attribute data.
6. The data processing method according to claim 5, characterized in that, After determining the number of low-priority tasks based on the number of tasks and the number of high-priority tasks, the method further includes: If the number of tasks is greater than zero and the number of low-priority tasks is less than the number of task resources, then the target task is determined not to meet the suspension condition. The target agent module is invoked to execute the target task.
7. The data processing method according to claim 1, characterized in that, After executing the task to be executed using the task execution resources, the method further includes: Upon completion of the task to be executed, the task execution resources are released. If the target agent module detects that the task execution resource is idle, the target task is executed using the task execution resource.
8. A data processing apparatus, characterized in that, include: The reading module is configured to read tasks to be executed from the target task queue and determine the target task that the target proxy module proxies; The calling module is configured to call the target proxy module. If the target task meets the suspension condition based on the task attribute data associated with the target task queue, the module switches the target task to an aborted state and releases the task execution resources occupied by the target task. The priority of the task to be executed is higher than the priority of the target task. The task attribute data includes the number of task resources, the number of tasks, and the number of high-priority tasks. If the number of high-priority tasks is greater than zero and the number of low-priority tasks is greater than the number of task resources, the module determines that the target task meets the suspension condition. The number of low-priority tasks is determined based on the number of tasks and the number of high-priority tasks. The execution module is configured to execute the task to be executed using the task execution resources.
9. A computing device, characterized in that, include: Memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions, which, when executed by the processor, implement the steps of the method according to any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, It stores computer-executable instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 7.
11. A computer program product, characterized in that, It includes a computer program or instructions that, when executed by a processor, implement the steps of the method according to any one of claims 1 to 7.
Citation Information
Patent Citations
Task processing method and device, equipment and storage medium
CN117971405A