Task processing method and device, computer equipment and storage medium
Through task decomposition and parallel processing technology, the task tree and data carrier tree are built, which solves the problem of low efficiency of traditional serial processing, and realizes efficient processing of complex tasks, which is suitable for multi-core and multi-threaded environments.
Patent Information
- Application Number
- CN202411342025.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-25
- Publication Date
- 2024-12-20
AI Technical Summary
Traditional serial processing methods are inefficient when handling complex tasks, are difficult to meet the needs of fast response and large amounts of computing resources, and lack flexibility, especially when task dependencies are strong.
By decomposing tasks into multiple subtasks, building a task tree and a data carrier tree, processing each subtask in parallel, and storing task information using the task tree and data carrier tree to achieve parallel execution.
It significantly improves task processing efficiency, makes full use of multi-core processors and multi-threading capabilities, reduces the waiting time of a single task, and improves resource utilization and system throughput.
Smart Images

Figure CN119166314A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a task processing method, device, computer equipment and storage medium. Background Art
[0002] In task processing scenarios, complex tasks often need to be processed. Complex tasks usually refer to those tasks that have multiple interrelated subtasks, require the comprehensive use of multiple skills and knowledge, and may involve different fields. These tasks often do not have a clear time starting point and work goals, or the path to achieve the goal is not linear, but requires multiple steps and decisions to complete.
[0003] In traditional technology, complex tasks are usually processed in a serial manner. Multi-task serial processing means that tasks are executed in a certain order, and each task must wait for the previous task to complete before it can start. In computer science, serial processing is a basic task execution method in which tasks are executed one after another in sequence. The characteristic of this method is that the next task will not be started until the current task is completed. If there are dependencies between tasks, or the system resources are insufficient to support parallel or concurrent processing, serial processing becomes an inevitable choice.
[0004] However, in the traditional solution of serial processing tasks, each task must be completed in sequence, resulting in longer processing time. In the case of fast response, serial processing may not meet the real-time requirements, and for complex problems that require a large amount of computing resources and multi-step processing, serial processing may be difficult to complete within a reasonable time. In addition, when faced with task dependencies, serial processing must wait for the previous task to be completed before starting the next task, which lacks flexibility. Summary of the invention
[0005] Based on this, it is necessary to provide a task processing method, device, computer equipment and storage medium that can improve task processing efficiency in response to the above technical problems.
[0006] A task processing method, comprising:
[0007] Decompose the task to be processed into multiple subtasks;
[0008] Building a task tree according to the multiple subtasks, the task tree including multiple task nodes;
[0009] Creating a corresponding data carrier tree according to the task tree, the data carrier tree includes data carriers respectively associated with each task node, and the data carriers are used to store task information corresponding to each task node;
[0010] The task information in the data carrier tree is obtained, and the corresponding subtasks are executed according to the obtained task information, so as to process the subtasks in parallel.
[0011] In one embodiment, the task node includes a subtask node, which obtains task information in the data carrier tree and executes corresponding subtasks according to the obtained task information to process each subtask in parallel, including:
[0012] Get the data carrier associated with the current subtask node from the data carrier tree;
[0013] Find the task information corresponding to the current subtask node from the data carrier associated with the current subtask node;
[0014] The current subtask is executed according to the task information corresponding to the current subtask node to process each subtask in parallel.
[0015] In one embodiment, the task processing method further includes:
[0016] When the corresponding task information does not exist in the data carrier associated with the current subtask node, the task information is searched for in the parent carrier corresponding to the data carrier corresponding to the current subtask node.
[0017] In one embodiment, the task processing method further includes:
[0018] Pre-create a pointer from the data carrier of each level in the data carrier tree to the data carrier of the previous level;
[0019] Search the parent carrier corresponding to the data carrier corresponding to the current subtask node for task information, including:
[0020] The task information is searched through the pointer to the parent carrier corresponding to the data carrier corresponding to the current subtask node.
[0021] In one embodiment, the task processing method further includes:
[0022] When the current subtask node completes the corresponding task, the data carrier associated with the current subtask node is marked as a mergeable state;
[0023] Monitor the task execution status of the sibling nodes of the current subtask node. When the sibling nodes of the current subtask node have completed the corresponding tasks, merge the data carriers in the mergeable state corresponding to the current subtask node and the corresponding sibling nodes into the data carrier associated with the corresponding parent node.
[0024] In one embodiment, the task processing method further includes:
[0025] When the current subtask node completes the corresponding task, the current subtask node is deregistered, and the data carrier associated with the current subtask node is deregistered.
[0026] In one embodiment, the task processing method further includes:
[0027] The permission for data carriers at each level in the data carrier tree to access data carriers at the next level is set to inaccessible.
[0028] A task processing device, comprising:
[0029] A decomposition module is used to decompose the task to be processed into multiple subtasks;
[0030] A first construction module is used to construct a task tree according to a plurality of subtasks, wherein the task tree includes a plurality of task nodes;
[0031] A second construction module is used to create a corresponding data carrier tree according to the task tree, the data carrier tree includes data carriers respectively associated with each task node, and the data carrier is used to store task information corresponding to each task node;
[0032] The processing module is used to obtain task information in the data carrier tree and execute corresponding subtasks according to the obtained task information to process each subtask in parallel.
[0033] A computer device comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the following steps when executing the computer program:
[0034] Decompose the task to be processed into multiple subtasks;
[0035] Building a task tree according to the multiple subtasks, the task tree including multiple task nodes;
[0036] Creating a corresponding data carrier tree according to the task tree, the data carrier tree includes data carriers respectively associated with each task node, and the data carriers are used to store task information corresponding to each task node;
[0037] The task information in the data carrier tree is obtained, and the corresponding subtasks are executed according to the obtained task information, so as to process the subtasks in parallel.
[0038] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the following steps:
[0039] Decompose the task to be processed into multiple subtasks;
[0040] Building a task tree according to the multiple subtasks, the task tree including multiple task nodes;
[0041] Creating a corresponding data carrier tree according to the task tree, the data carrier tree includes data carriers respectively associated with each task node, and the data carriers are used to store task information corresponding to each task node;
[0042] The task information in the data carrier tree is obtained, and the corresponding subtasks are executed according to the obtained task information, so as to process the subtasks in parallel.
[0043] The above-mentioned task processing method, device, computer equipment and storage medium decompose the task to be processed to obtain multiple subtasks, construct a task tree according to the multiple subtasks, the task tree includes multiple task nodes, create a corresponding data carrier tree according to the task tree, the data carrier tree includes data carriers respectively associated with each task node, the data carrier is used to store task information corresponding to each task node, obtain the task information in the data carrier tree, and execute the corresponding subtask according to the obtained task information. The present application can decompose the task, construct a task tree according to the decomposed subtasks, and construct a data carrier tree according to the task tree, use the task tree and the task information stored in the data carrier tree, and process each subtask in parallel to improve the efficiency of task processing. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] Figure 1 is a flowchart of a task processing method in one embodiment;
[0045] Figure 2 A schematic diagram of the structure of a task tree in one embodiment;
[0046] Figure 3 A schematic diagram of the structure of a data carrier tree in one embodiment;
[0047] Figure 4 A schematic diagram of the association relationship between a task tree and a data carrier tree in one embodiment;
[0048] Figure 5 is a structural block diagram of a task processing device in one embodiment;
[0049] Figure 6 FIG. 4 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION
[0050] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0051] In one embodiment, Figure 1As shown, a task processing method is provided, which is described by taking the method applied to a server as an example, and includes the following steps:
[0052] Step S11, decomposing the task to be processed into multiple subtasks.
[0053] Among them, splitting a task into multiple subtasks can improve the execution efficiency and parallel processing capabilities of the task, and is suitable for various scenarios, including software development, project management, data processing, etc. By breaking down large and complex tasks into multiple small tasks, each small task can be executed in parallel under different resources or environments, and finally the results are merged to complete the original task.
[0054] Specifically, tasks can be decomposed through task partitioning in Spring Cloud Task. Among them, Spring Cloud Task is a framework for executing short-lived tasks, especially suitable for batch processing tasks. When a task is too large, it can be split into multiple subtasks through task partitioning technology. Each subtask can be executed in parallel on different processes or nodes, and finally the results of all subtasks are merged to complete the original task. Task partitioning can be implemented using task splitters and task processors, which communicate with each other through a messaging mechanism or a distributed task scheduling framework.
[0055] The pending tasks may be any pending tasks in any scenario and may be set according to the actual application scenario, and are not specifically limited here.
[0056] Step S12, constructing a task tree according to the multiple subtasks, the task tree including multiple task nodes.
[0057] Among them, the task tree refers to the tree structure of the task, which is a method of breaking down a task into multiple subtasks and organizing and representing them through a tree structure. The core idea of this structure is to break down complex tasks into smaller, manageable subtasks, each of which can be further broken down into smaller subtasks until an action that can be directly executed is reached. By creating a task tree, we can clearly see the various components of the task and the relationship between them, so as to plan and execute tasks more effectively.
[0058] The task nodes are used to represent each split task. Specifically, constructing a task tree based on multiple subtasks may include:
[0059] During the task creation process, each node of the task tree is created, or before the task is executed, a corresponding task tree is created in advance according to each subtask.
[0060] Among them, in the process of task creation, creating each node of the task tree means first creating a root node, which can be a task to be processed, and further judging whether the root node needs to be divided into multiple child nodes. When it is judged that the root node needs to be divided into multiple child nodes, at least one child node of the root node is created and each child node is processed. In the process of processing each child node, it is further judged whether each child node needs to be further divided. When division is required, the next level of child nodes is further created for each child node, and so on, to achieve the creation of each node of the task tree during the execution of the task.
[0061] Please refer to Figure 2 , Figure 2 FIG. 1 is a schematic diagram of the structure of a task tree in an embodiment. Figure 2 In the task tree, the root task is the root node, which is located at the first level of the task tree. According to the root task, tasks are split to obtain subtask 1 and subtask 2. Subtask 1 and subtask 2 are subtasks of the root task and are located at the second level of the task tree. Further, subtask 1 is split to obtain subtask 1.1 and subtask 1.2, which are subtasks of subtask 1 and are located at the third level of the task tree. And so on, the entire task tree is constructed. Figure 2 It can be seen that the task tree includes a multi-layer structure, the first layer is the root node, each layer is the parent node of the next layer of nodes, and each child node under each parent node is a brother node to each other.
[0062] Step S13, creating a corresponding data carrier tree according to the task tree, the data carrier tree includes data carriers respectively associated with each task node, and the data carriers are used to store task information corresponding to each task node.
[0063] The data carrier tree refers to a tree structure composed of data carriers, wherein the data carrier refers to a data structure used to store the task information of each subtask. Each data carrier is associated with a corresponding task node, such as creating a data carrier corresponding to the root node, creating a corresponding sub-carrier according to the first-level subtask, and so on, to obtain a data carrier tree. The task information refers to the information required to execute each subtask. In addition, the data carrier is used to store the results obtained by executing each subtask.
[0064] Please refer to Figure 3 , Figure 3 FIG. 1 is a schematic diagram of a structure diagram of a data carrier tree in an embodiment. Figure 3 The data carrier at the first level is a data carrier associated with the root node in the task tree, and is used to store the task information corresponding to the root node in the task tree. Each sub-carrier at the second level is associated with each task node of the second level of the task tree, and is used to store the task information corresponding to each task node of the second level of the task tree, and so on.
[0065] Specifically, sub-carrier 1 is associated with the first sub-task (such as sub-task 1) of the second layer in the task tree, sub-carrier 1.1 is associated with the first sub-task (sub-task 1.1) of the third layer in the task tree, sub-carrier 1 is the parent carrier of sub-carrier 1.1, and so on.
[0066] Please refer to Figure 4 , Figure 4 Schematic diagram of a structure diagram of establishing association relationships between nodes in a task tree and nodes in a data carrier tree in an embodiment. Figure 4 As shown, each task node in the task tree has a corresponding data carrier. For example, the data carrier of the first layer in the data carrier tree is associated with the root task of the first layer in the task tree, the sub-carrier 1 in the second layer is associated with sub-task 1, and the sub-carrier 1.1 in the third layer is associated with sub-task 1.1, and so on.
[0067] Step S14, acquiring task information in the data carrier tree, and executing corresponding subtasks according to the acquired task information, so as to process each subtask in parallel.
[0068] Parallel processing of each subtask means running multiple programs at the same time, so that they are executed concurrently at the same time. This processing method allows users to run multiple applications at the same time, and each application is called a task.
[0069] Specifically, the present application can simultaneously obtain the data carriers associated with each subtask, obtain the corresponding task information from each data carrier, execute the corresponding subtask according to each task information, realize the parallel execution of multiple subtasks, and improve the task execution efficiency.
[0070] This application can significantly improve processing efficiency and computing speed by breaking down complex tasks into multiple subtasks and executing them in parallel on multiple computing units. In addition, in a multi-threaded environment, a better interactive experience can be provided.
[0071] In one embodiment, the task node includes a subtask node, and task information in a data carrier tree is obtained, and corresponding subtasks are executed according to the obtained task information to process each subtask in parallel, including: obtaining a data carrier associated with a current subtask node from the data carrier tree, searching for task information corresponding to the current subtask node from the data carrier associated with the current subtask node, and executing the current subtask according to the task information corresponding to the current subtask node to process each subtask in parallel.
[0072] The task nodes of the task tree include the root node corresponding to the task to be processed and the subtask nodes corresponding to each subtask, each node represents a task or subtask. A data carrier is created for each task node, and an association relationship between each task node and the data carrier is created, or an association relationship between each subtask and the data carrier is created.
[0073] Specifically, when executing the current subtask, the data carrier corresponding to the current subtask or the current subtask node is obtained according to the association relationship, the task information required to execute the current subtask is searched from the data carrier, and the current subtask is executed according to the obtained task information. Among them, the current subtask node refers to the node used to represent the current subtask in the task tree.
[0074] The beneficial effects of this embodiment are as follows: by constructing a task tree and a data carrier tree, parallel processing of each subtask is achieved. Through the parallel processing of subtasks, the capabilities of multi-core processors and multi-threading are fully utilized to improve resource utilization and system throughput, and the waiting time of a single task is reduced, thereby improving the processing efficiency of tasks to be processed.
[0075] In one of the embodiments, the task processing method may further include: when there is no corresponding task information in the data carrier associated with the current subtask node, searching for the task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node.
[0076] Specifically, the task information corresponding to the current subtask is searched from the data carrier associated with the current subtask node. When the required data information cannot be found from the data carrier associated with the current subtask node, the data carrier associated with the current subtask node will entrust its parent carrier to obtain the corresponding task information, that is, the data carrier associated with the current subtask node obtains the corresponding task information from its parent carrier through the accessor parent carrier until the root data carrier.
[0077] For example, please refer to Figure 4 , assuming that the current task subtask is subtask 1.1.1, and its corresponding data carrier is subcarrier 1.1.1, first search for the corresponding task information from subcarrier 1.1.1. When the task information corresponding to subtask 1.1.1 cannot be found from subcarrier 1.1.1, subcarrier 1.1.1 will entrust its parent carrier, i.e. subcarrier 1.1, to obtain the corresponding task information. If the corresponding task information still cannot be found in subcarrier 1.1, subcarrier 1.1 will automatically entrust its parent carrier, i.e. subcarrier 1, to obtain the corresponding task information, and so on, until the root data carrier.
[0078] The beneficial effects of this embodiment are: through the data access strategy, the lower-level carrier can access the upper-level carrier step by step, and cannot access across levels, so as to achieve orderly data access and avoid data confusion between nodes. The level here refers to the level of the data carrier tree where the data carrier is located.
[0079] In one of the embodiments, the task processing method may also include: pre-creating pointers from data carriers at each level in the data carrier tree to data carriers at the previous level, and searching for task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node, including: searching for task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node through the pointer.
[0080] Among them, the present application pre-creates access pointers between various data carriers for data access between various data carriers.
[0081] For example, please refer to Figure 3 When the child carrier 1.1 needs to access its parent carrier 1.1.1, it can access the child carrier 1.1.1 by calling the pre-created pointer, thereby entrusting the parent carrier to obtain the corresponding task information.
[0082] The present application realizes the access of the lower level carrier to the upper level carrier by creating corresponding pointers, avoiding the data confusion caused by irregular access. The present application reduces cache competition and improves cache utilization through parallel processing technology and optimization algorithms and data access strategies, thereby improving program performance.
[0083] In one of the embodiments, the task processing method may also include: when the current subtask node completes the corresponding task, marking the data carrier associated with the current subtask node as a mergeable state, monitoring the task execution status of the brother nodes of the current subtask node, and when the brother nodes of the current subtask node have all completed the corresponding tasks, merging the data carriers in the mergeable state corresponding to the current subtask node and the corresponding brother nodes into the data carrier associated with the corresponding parent node.
[0084] The mergeable state refers to the state in which the data in the data carrier can be merged into the corresponding parent carrier. Specifically, the state of each data carrier is created in advance, and the value of the state of each data carrier is set. The data carrier associated with the current subtask node is marked as mergeable by modifying the value of the state of the data carrier associated with the current subtask node to the "mergeable" state. For example, the value of the mergeable state is set to 1, and the value of the non-mergeable state is set to 0, then the value of the state of the data carrier associated with the current subtask node is modified to 1.
[0085] In the present application, when executing to the current level, the execution status of each task node in the current level will be monitored, such as the execution progress. When one of the nodes, such as the current subtask node, is executed, the status of the data carrier associated with the current subtask node will be marked as a mergeable state, and the other task nodes of the current level (brother nodes of the current subtask node) will continue to be monitored. When it is monitored that all task nodes of the current level have completed the corresponding task execution, the data of the data carriers marked as mergeable in the data carriers corresponding to each task node will be merged into the parent carrier of the previous level.
[0086] For example, please refer to Figure 4 When subtask 1.1 completes the corresponding task, the data carrier associated with subtask 1.1, namely subcarrier 1.1, is marked as a mergeable state, and the brother node of subtask 1.1, namely subtask 1.2, is continuously monitored. When subtask 1.2 also completes the corresponding task processing, the mergeable data carrier corresponding to subtask 1.1, namely subcarrier 1.1, and the mergeable data carrier of subtask 1.2, namely subcarrier 1.2, are obtained, and the data in subcarrier 1.1 and subcarrier 1.2 are merged into the data carrier associated with subtask 1, namely subcarrier 1, to realize data aggregation.
[0087] In one of the embodiments, the task processing method may further include: when the current subtask node completes the corresponding task, deregistering the current subtask node and deregistering the data carrier associated with the current subtask node.
[0088] Specifically, when the current subtask node completes the execution of the corresponding task, the processing result obtained after the execution is stored in the corresponding data carrier, and the data carrier associated with the current subtask node is marked as a mergeable state.
[0089] Furthermore, after the data of the data carrier corresponding to the current subtask node is merged into its parent carrier, a step of canceling the data carrier associated with the current subtask node is performed to release resources.
[0090] In one of the embodiments, the task processing method may further include: setting the permission of the data carriers at each level in the data carrier tree to access the data carriers at the next level to inaccessible.
[0091] In the present application, by creating a pointer from each level of data carrier to the data carrier of the previous level, the lower level data carrier can access the upper level data carrier. At the same time, by setting the permission of the data carrier of each level in the data carrier tree to access the data carrier of the next level to inaccessible, the upper level data carrier cannot access the lower level data carrier, thereby achieving one-way access to data, avoiding data confusion, and preventing the pollution of intermediate data.
[0092] To sum up, in this application, the data carrier and the task node exist independently and interact through association; the task to be processed is divided into sub-tasks, which are interrelated and operate independently; the data carriers at the same level are independent and do not interfere with each other, the lower-level data carrier can access the upper-level data carrier, and the upper-level data carrier cannot access the lower-level data carrier, thereby realizing data isolation and preventing intermediate data contamination; after each task node completes the corresponding task processing, the child carrier transmits the data back to the parent carrier and cancels itself to release resources.
[0093] In one embodiment, Figure 5 As shown, a task processing device is provided, comprising: a decomposition module 51, a first construction module 52, a second construction module 53 and a processing module 54, wherein:
[0094] A decomposition module 51 is used to decompose the task to be processed into multiple subtasks;
[0095] A first construction module 52 is used to construct a task tree according to a plurality of subtasks, wherein the task tree includes a plurality of task nodes;
[0096] A second construction module 53 is used to create a corresponding data carrier tree according to the task tree, the data carrier tree includes data carriers respectively associated with each task node, and the data carrier is used to store task information corresponding to each task node;
[0097] The processing module 54 is used to obtain task information in the data carrier tree, and execute corresponding subtasks according to the obtained task information, so as to process each subtask in parallel.
[0098] In one embodiment, the task node includes a subtask node, and the processing module 54 can obtain the data carrier associated with the current subtask node from the data carrier tree, search for task information corresponding to the current subtask node from the data carrier associated with the current subtask node, and execute the current subtask according to the task information corresponding to the current subtask node to process each subtask in parallel.
[0099] In one embodiment, the processing module 54 may also search for task information in a parent carrier corresponding to the data carrier corresponding to the current subtask node when the corresponding task information does not exist in the data carrier associated with the current subtask node.
[0100] In one embodiment, the processing module 54 may also pre-create pointers for the data carriers at each level in the data carrier tree to point to the data carriers at the previous level, and search for task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node through the pointers.
[0101] In one embodiment, the second construction module 53 can also mark the data carrier associated with the current subtask node as a mergeable state when the current subtask node completes the corresponding task, monitor the task execution status of the sibling nodes of the current subtask node, and when the sibling nodes of the current subtask node have all completed the corresponding tasks, merge the data carriers in the mergeable state corresponding to the current subtask node and the corresponding sibling nodes into the data carrier associated with the corresponding parent node.
[0102] In one embodiment, the processing module 54 may also deregister the current subtask node and the data carrier associated with the current subtask node when the current subtask node completes the corresponding task.
[0103] In one embodiment, the second construction module 53 may further: set the permission of the data carriers at each level in the data carrier tree to access the data carriers at the next level to be inaccessible.
[0104] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 6 As shown. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, the task processing method is implemented.
[0105] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, the following steps are implemented: decomposing a task to be processed to obtain multiple subtasks, constructing a task tree based on the multiple subtasks, the task tree including multiple task nodes, creating a corresponding data carrier tree based on the task tree, the data carrier tree including data carriers respectively associated with each task node, the data carriers being used to store task information corresponding to each task node, acquiring the task information in the data carrier tree, and executing the corresponding subtasks based on the acquired task information, so as to process each subtask in parallel.
[0106] In one embodiment, the task node includes a subtask node, and the processor executes a computer program to implement the above-mentioned steps of obtaining task information in the data carrier tree and executing corresponding subtasks according to the obtained task information to process each subtask in parallel, specifically including the following steps: obtaining a data carrier associated with the current subtask node from the data carrier tree,
[0107] The task information corresponding to the current subtask node is searched from the data carrier associated with the current subtask node, and the current subtask is executed according to the task information corresponding to the current subtask node, so as to process each subtask in parallel.
[0108] In one embodiment, when the processor executes the computer program, the following steps are specifically implemented: when there is no corresponding task information in the data carrier associated with the current subtask node, search for task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node.
[0109] In one embodiment, when the processor executes a computer program, the following steps are specifically implemented: pre-create pointers for the data carriers at each level in the data carrier tree to point to the data carriers at the previous level; when the processor executes the computer program to implement the above-mentioned step of searching for task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node, the following steps are specifically implemented: search for task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node through the pointer.
[0110] In one embodiment, when the processor executes the computer program, the following steps are specifically implemented: when the current subtask node completes the corresponding task, the data carrier associated with the current subtask node is marked as a mergeable state, the task execution status of the sibling nodes of the current subtask node is monitored, and when the sibling nodes of the current subtask node have all completed the corresponding tasks, the data carriers in the mergeable state corresponding to the current subtask node and the corresponding sibling nodes are merged into the data carrier associated with the corresponding parent node.
[0111] In one embodiment, when the processor executes the computer program, it also specifically implements the following steps: when the current subtask node completes the corresponding task, the current subtask node is deregistered, and the data carrier associated with the current subtask node is deregistered.
[0112] In one embodiment, when the processor executes the computer program, the processor further specifically implements the following steps: setting the permission of the data carriers at each level in the data carrier tree to access the data carriers at the next level to inaccessible.
[0113] In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the following steps are implemented: decomposing a task to be processed to obtain multiple subtasks, building a task tree based on the multiple subtasks, the task tree including multiple task nodes, creating a corresponding data carrier tree based on the task tree, the data carrier tree including data carriers respectively associated with each task node, the data carriers are used to store task information corresponding to each task node, obtaining the task information in the data carrier tree, and executing the corresponding subtasks based on the obtained task information, so as to process each subtask in parallel.
[0114] In one embodiment, the task node includes a subtask node, and the computer program is executed by the processor to implement the above-mentioned steps of obtaining the task information in the data carrier tree, and executing the corresponding subtasks according to the obtained task information to process each subtask in parallel. Specifically, the following steps are implemented: obtaining the data carrier associated with the current subtask node from the data carrier tree, searching for the task information corresponding to the current subtask node from the data carrier associated with the current subtask node, and executing the current subtask according to the task information corresponding to the current subtask node to process each subtask in parallel.
[0115] In one embodiment, when the computer program is executed by the processor, the following steps are specifically implemented: when there is no corresponding task information in the data carrier associated with the current subtask node, search for task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node.
[0116] In one embodiment, when the computer program is executed by the processor, the following steps are specifically implemented: pre-create pointers for the data carriers at each level in the data carrier tree to point to the data carriers at the previous level; when the processor executes the computer program to implement the above-mentioned step of searching for task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node, the following steps are specifically implemented: search for task information in the parent carrier corresponding to the data carrier corresponding to the current subtask node through the pointer.
[0117] In one embodiment, when the computer program is executed by the processor, the following steps are specifically implemented: when the current subtask node completes the corresponding task, the data carrier associated with the current subtask node is marked as a mergeable state, the task execution status of the sibling nodes of the current subtask node is monitored, and when the sibling nodes of the current subtask node have all completed the corresponding tasks, the data carriers in the mergeable state corresponding to the current subtask node and the corresponding sibling nodes are merged into the data carrier associated with the corresponding parent node.
[0118] In one embodiment, when the computer program is executed by the processor, the following steps are specifically implemented: when the current subtask node completes the corresponding task, the current subtask node is deregistered, and the data carrier associated with the current subtask node is deregistered.
[0119] In one embodiment, when the computer program is executed by the processor, the following steps are specifically implemented: the permission of the data carriers at each level in the data carrier tree to access the data carriers at the next level is set to be inaccessible.
[0120] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be implemented by instructing related hardware through a computer program, and the above-mentioned computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media used in the embodiments provided in this application may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0121] The technical features of the above embodiments may be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0122] The above embodiments only express several implementation methods of the present application, and the descriptions thereof are relatively specific and detailed, but they cannot be understood as limiting the scope of the invention patent. It should be pointed out that, for a person of ordinary skill in the art, several variations and improvements can be made without departing from the concept of the present application, and these all belong to the protection scope of the present application. Therefore, the protection scope of the patent of the present application shall be subject to the attached claims.
Claims
1. A task processing method, characterized in that: The method comprises: Decompose the task to be processed into multiple subtasks; Constructing a task tree according to the multiple subtasks, wherein the task tree includes multiple task nodes; Creating a corresponding data carrier tree according to the task tree, wherein the data carrier tree includes data carriers respectively associated with each of the task nodes, and the data carriers are used to store task information corresponding to each of the task nodes; The task information in the data carrier tree is obtained, and corresponding subtasks are executed according to the obtained task information, so as to process each of the subtasks in parallel.
2. The method according to claim 1, characterized in that The task node includes a subtask node, and the acquiring task information in the data carrier tree and executing corresponding subtasks according to the acquired task information to process each subtask in parallel includes: Obtaining a data carrier associated with a current subtask node from the data carrier tree; Searching for task information corresponding to the current subtask node from a data carrier associated with the current subtask node; The current subtask is executed according to the task information corresponding to the current subtask node, so as to process each of the subtasks in parallel.
3. The method according to claim 2, characterized in that The method further comprises: When the corresponding task information does not exist in the data carrier associated with the current subtask node, the task information is searched for in the parent carrier corresponding to the data carrier corresponding to the current subtask node.
4. The method according to claim 3, characterized in that The method further comprises: Pre-creating a pointer from a data carrier at each level in the data carrier tree to a data carrier at the previous level; The searching the parent carrier corresponding to the data carrier corresponding to the current subtask node for the task information includes: The task information is searched for in the parent carrier corresponding to the data carrier corresponding to the current subtask node through the pointer.
5. The method according to claim 2, characterized in that: The method further comprises: When the current subtask node completes the corresponding task, marking the data carrier associated with the current subtask node as being in a mergeable state; Monitor the task execution status of the brother nodes of the current subtask node. When the brother nodes of the current subtask node have completed the corresponding tasks, merge the data carriers in the mergeable state corresponding to the current subtask node and the corresponding brother nodes into the data carrier associated with the corresponding parent node.
6. The method according to claim 5, characterized in that The method further comprises: When the current subtask node completes the corresponding task, the current subtask node is deregistered, and the data carrier associated with the current subtask node is deregistered.
7. The method according to claim 4, characterized in that The method further comprises: The permission for the data carriers at each level in the data carrier tree to access the data carriers at the next level is set to be inaccessible.
8. A task processing device, characterized in that: The device comprises: A decomposition module is used to decompose the task to be processed into multiple subtasks; A first construction module, configured to construct a task tree according to the plurality of subtasks, wherein the task tree includes a plurality of task nodes; A second construction module is used to create a corresponding data carrier tree according to the task tree, wherein the data carrier tree includes data carriers respectively associated with each of the task nodes, and the data carriers are used to store task information corresponding to each of the task nodes; The processing module is used to obtain the task information in the data carrier tree and execute the corresponding subtasks according to the obtained task information to process each of the subtasks in parallel.
9. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Data migration method and device, electronic equipment and storage medium
CN120631268A
Data migration method and device, electronic equipment and storage medium
CN120631268B
Financial product index calculation method and device and related product
CN122264939A
