Task processing method and device, equipment and storage medium

By pre-mounting tasks on multiple lifecycle nodes in business scenarios and scheduling child thread execution when the lifecycle node enters an event, the problem of excessive time-consuming tasks caused by serial execution of the main thread is solved, and users are improved Experience.

CN119025224APending Publication Date: 2024-11-26BEIJING ZITIAO NETWORK TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202310588309.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2023-05-23
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

In business scenarios, the main thread performs tasks serially, which causes tasks to take a long time to execute, affecting the user experience.

Method used

By pre-mounting multiple tasks on multiple lifecycle nodes, in response to the preset entry event of the lifecycle node, at least one child thread is scheduled to asynchronously execute the tasks mounted by the lifecycle node, reducing the time-consuming task execution.

Benefits of technology

It effectively reduces the time-consuming task execution, improves the user experience, and shortens the waiting time by executing multiple tasks asynchronously.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119025224A_ABST
    Figure CN119025224A_ABST
Patent Text Reader

Abstract

The invention provides a task processing method and device, equipment and a storage medium, and the method comprises the steps: determining a task mounted on a first life cycle node as a to-be-executed task when a preset entry event for the first life cycle node is received; wherein the first life cycle node belongs to a plurality of life cycle nodes obtained by dividing the life cycle of the target scene, the target scene corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different life cycle nodes in the target scene; and scheduling at least one sub-thread to execute the to-be-executed task. Visibly, according to the embodiment of the invention, a plurality of tasks are mounted on a plurality of life cycle nodes in advance, and when a certain life cycle node is entered, the task mounted on the life cycle node is asynchronously executed by scheduling at least one sub-thread, so that the task execution time consumption in the target scene is reduced, and the user experience is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of data processing, and in particular to a task processing method, device, equipment and storage medium. Background Art

[0002] At present, when executing multiple tasks in business scenarios, the main thread is usually used to execute tasks serially, and each task is executed in sequence. However, this task processing method takes a long time to execute tasks in business scenarios, which can easily affect the user experience.

[0003] Therefore, how to reduce the time spent on task execution in business scenarios and improve user experience is a technical problem that needs to be solved urgently. Summary of the invention

[0004] In order to solve the above technical problems, an embodiment of the present disclosure provides a task processing method.

[0005] In a first aspect, the present disclosure provides a task processing method, the method comprising:

[0006] In response to a preset entry event for a first lifecycle node, determining a task mounted on the first lifecycle node as a task to be executed; wherein the first lifecycle node belongs to a plurality of lifecycle nodes obtained by dividing the lifecycle of a target scenario, the target scenario corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different lifecycle nodes in the target scenario;

[0007] At least one sub-thread is scheduled to execute the task to be executed.

[0008] In an optional implementation manner, the to-be-executed task includes a first to-be-executed task, and before the scheduling at least one sub-thread to execute the to-be-executed task, the method further includes:

[0009] If it is determined that the first task to be executed has execution dependency information, determining whether a dependent execution result of the first task to be executed is currently stored based on the execution dependency information; wherein the execution dependency information carries identification information of the dependent execution result;

[0010] Accordingly, scheduling at least one sub-thread to execute the task to be executed includes:

[0011] If it is determined that the dependent execution result of the first task to be executed is currently stored, the first sub-thread is scheduled to execute the first task to be executed based on the dependent execution result.

[0012] In an optional implementation manner, the method further includes:

[0013] If it is determined that the dependent execution result of the first task to be executed is not currently stored, the main thread executes the task on which the first task to be executed depends to obtain the execution result of the task;

[0014] The second sub-thread is scheduled to execute the first task to be executed based on the execution result of the task.

[0015] In an optional implementation manner, before determining the task mounted on the first lifecycle node as the task to be executed in response to the preset entry event of the first lifecycle node, the method further includes:

[0016] Receive a mount request for a first task corresponding to the target scenario; wherein the mount request carries an identifier of a target lifecycle node;

[0017] Mount the first task to the target lifecycle node.

[0018] In an optional implementation, there is no execution dependency between different tasks mounted on the same lifecycle node of the target scenario.

[0019] In an optional implementation, the multiple lifecycle nodes include a second lifecycle node and a third lifecycle node, the multiple tasks include a second task and a third task that have an execution dependency relationship, the execution dependency relationship includes a relationship in which the third task depends on the execution of the second task, the second task is mounted on the second lifecycle node, and the third task is mounted on the third lifecycle node.

[0020] In an optional implementation manner, the method further includes:

[0021] In response to a preset exit event for the first lifecycle node, determining an execution status of a task mounted on the first lifecycle node; wherein the execution status is used to reflect whether the task has been completed;

[0022] Send the execution status of the task mounted by the first life cycle node; wherein the execution status of the task mounted by the first life cycle node is used to update the number of tasks mounted by the first life cycle node and / or the at least one sub-thread.

[0023] In a second aspect, the present disclosure provides a task processing device, the device comprising:

[0024] A first determination module is used to determine, in response to a preset entry event for a first lifecycle node, a task mounted on the first lifecycle node as a task to be executed; wherein the first lifecycle node belongs to a plurality of lifecycle nodes obtained by dividing the lifecycle of a target scene, the target scene corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different lifecycle nodes in the target scene;

[0025] The first execution module is used to schedule at least one sub-thread to execute the task to be executed.

[0026] In a third aspect, the present disclosure provides a computer-readable storage medium, wherein the computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the above method.

[0027] In a fourth aspect, the present disclosure provides a task processing device, comprising: a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the above method when executing the computer program.

[0028] In a fifth aspect, the present disclosure provides a computer program product, wherein the computer program product comprises a computer program / instructions, and the computer program / instructions implement the above method when executed by a processor.

[0029] Compared with the prior art, the technical solution provided by the embodiments of the present disclosure has at least the following advantages:

[0030] The disclosed embodiment provides a task processing method, when receiving a preset entry event for a first life cycle node, determining the task mounted on the first life cycle node as a task to be executed; wherein the first life cycle node belongs to a plurality of life cycle nodes obtained by dividing the life cycle of a target scene, the target scene corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different life cycle nodes in the target scene; and scheduling at least one child thread to execute the task to be executed. It can be seen that the disclosed embodiment mounts a plurality of tasks on a plurality of life cycle nodes in advance, and when entering a certain life cycle node, asynchronously executes the task mounted on the life cycle node by scheduling at least one child thread, thereby reducing the time consumption of task execution in the target scene and improving the user experience. BRIEF DESCRIPTION OF THE DRAWINGS

[0031] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the present disclosure.

[0032] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.

[0033] Figure 1 A flowchart of a task processing method provided by an embodiment of the present disclosure;

[0034] Figure 2 A schematic diagram of a task processing architecture provided by an embodiment of the present disclosure;

[0035] Figure 3 A schematic diagram of the structure of a task processing device provided by an embodiment of the present disclosure;

[0036] Figure 4 A schematic diagram of the structure of a task processing device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION

[0037] In order to more clearly understand the above-mentioned objectives, features and advantages of the present disclosure, the scheme of the present disclosure will be further described below. It should be noted that the embodiments of the present disclosure and the features in the embodiments can be combined with each other without conflict.

[0038] In the following description, many specific details are set forth to facilitate a full understanding of the present disclosure, but the present disclosure may also be implemented in other ways different from those described herein; it is obvious that the embodiments in the specification are only part of the embodiments of the present disclosure, rather than all of the embodiments.

[0039] Currently, when executing multiple tasks in business scenarios, the main thread is usually used to execute tasks serially, and each task is executed in sequence. However, this task processing method takes a long time to execute tasks, which can easily affect the user experience.

[0040] Therefore, how to reduce the time spent on task execution in business scenarios and improve user experience is a technical problem that needs to be solved urgently.

[0041] In order to reduce the time consumption of task execution in business scenarios, the embodiment of the present disclosure provides a task processing method, when receiving a preset entry event for a first life cycle node, determining the task mounted on the first life cycle node as a task to be executed; wherein the first life cycle node belongs to a plurality of life cycle nodes obtained by dividing the life cycle of a target scenario, the target scenario corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different life cycle nodes in the target scenario; and scheduling at least one child thread to execute the task to be executed. It can be seen that the embodiment of the present disclosure mounts a plurality of tasks on a plurality of life cycle nodes in advance, and when entering a certain life cycle node, asynchronously executes the task mounted on the life cycle node by scheduling at least one child thread, thereby reducing the time consumption of task execution in the target scenario and improving the user experience.

[0042] Based on this, the present disclosure provides a task processing method, referring to Figure 1 , is a flowchart of a task processing method provided by an embodiment of the present disclosure, the method specifically comprising:

[0043] S101: In response to a preset entry event for a first lifecycle node, determine a task mounted on the first lifecycle node as a task to be executed.

[0044] Among them, the first life cycle node belongs to multiple life cycle nodes obtained by dividing the life cycle of the target scene, the target scene corresponds to multiple tasks, and the multiple tasks are respectively mounted on the same or different life cycle nodes in the target scene.

[0045] The task processing method provided by the embodiment of the present disclosure can be applied to a client, and specifically can be applied to an application program deployed on the client, etc.

[0046] In actual applications, the target scenario is also called the target business scenario, which can be determined based on the actual business type. For example, in the live broadcast business type, any business scenario involved in the live broadcast business type can be determined as the target scenario according to actual needs, such as the scene where the user watching the broadcast enters the live broadcast room (entering the room scene), the scene where the anchor connects with the anchor, etc. The embodiments of the present disclosure do not limit this.

[0047] The life cycle of a target scene refers to all the stages experienced from entering the target scene to exiting the target scene. Specifically, the life cycle of the target scene can be divided into multiple life cycle nodes to characterize the different stages experienced by the target scene.

[0048] In the disclosed embodiment, the life cycle of the target scenario may be divided into a plurality of life cycle nodes, and each life cycle node may be mounted with one or more tasks.

[0049] For example, the scene where the user enters the live broadcast room can be divided into multiple life cycle nodes such as SDK (Software Development Kit, also known as software development kit) initialization completion, user entering the live broadcast page, and user watching a specific live broadcast room. Among them, the life cycle node where SDK initialization is completed can be mounted with tasks such as loading preview streams, and the life cycle node where the user enters the live broadcast page can be mounted with tasks such as loading page components and loading images. In other words, the tasks corresponding to the target scene can be the tasks that need to be performed from entering the target scene (start) to exiting the target business scene (end), and the tasks mounted on each life cycle node can be the tasks corresponding to this life cycle node, such as the tasks that need to be completed through this life cycle node.

[0050] In an optional implementation, the target scene may include a scene in which a viewing user enters a live broadcast room. Specifically, the process of the viewing user entering the live broadcast room may be from clicking the live broadcast room control to completing the display of the live broadcast room page. In this scenario, the life cycle of the target scene may be pre-divided into life cycle nodes such as SDK initialization completion, user entering the live broadcast page, and user viewing a specific live broadcast room. Figure 2 , which is a schematic diagram of an architecture of task processing provided by an embodiment of the present disclosure.

[0051] In the disclosed embodiment, after the life cycle of the target scene is divided into multiple life cycle nodes in advance, each life cycle node corresponds to a preset entry event and a preset exit event, wherein the preset entry event refers to an event used to trigger the opening of the first life cycle node, and the preset exit event refers to an event used to trigger the exit of the first life cycle node; when the main thread executes a life cycle node, it detects each event on the life cycle node, and when the preset entry event corresponding to the life cycle node is detected, the task mounted on the first life cycle node is determined as the task to be executed.

[0052] For example, in a scenario where a user entering a live broadcast room is detected, one or more tasks mounted on the page node of the live broadcast room where the user enters are first determined. Assuming that the tasks mounted on the node include tasks such as loading page components and loading images, the page component loading task and the image loading task are treated as tasks to be executed, so as to facilitate the subsequent execution of the above tasks to be executed by scheduling at least one child thread.

[0053] In the disclosed embodiment, the target scene corresponds to multiple tasks, and the multiple tasks are respectively mounted on the same or different life cycle nodes in the target scene. By pre-mounting the tasks on the life cycle nodes in the target scene, a corresponding relationship between the tasks and the life cycle nodes is established, so that when a life cycle node is subsequently started, the tasks mounted on the life cycle node can be determined based on the life cycle node.

[0054] In the disclosed embodiment, the first life cycle node may be any life cycle node in the target scenario. For example, in a scenario where a viewing user enters a live broadcast room, the first life cycle node may be a node where the user enters a live broadcast page.

[0055] In actual applications, before determining the tasks mounted on the first lifecycle node, each task in the target scenario needs to be mounted on the corresponding lifecycle node.

[0056] In an optional implementation, when a mount request for a first task corresponding to a target scenario is received, the first task may be mounted to a target lifecycle node, wherein the mount request carries an identifier of the target lifecycle node.

[0057] In the disclosed embodiment, the first task may be any one of the multiple tasks corresponding to the target scene. When a mount request for the first task is received, the first task is mounted on the target lifecycle node based on the identifier of the target lifecycle node carried in the mount request, thereby establishing a correspondence between the first task and the target lifecycle node, so that when a preset entry event of the target lifecycle node is subsequently received, the task mounted on the target lifecycle node can be determined based on the above correspondence.

[0058] In the embodiment of the present disclosure, since there is a corresponding relationship between the first life cycle node and the task mounted on the first life cycle node, when a preset entry event of the first life cycle node is received, the task mounted on the first life cycle node can be determined based on the above corresponding relationship as a task to be executed, so that the task to be executed can be subsequently executed.

[0059] S102: Scheduling at least one sub-thread to execute the task to be executed.

[0060] In the disclosed embodiment, when the main thread receives a preset entry event of the first life cycle node, it takes the task mounted on the first life cycle node as a task to be executed, and then schedules at least one child thread to execute the task to be executed.

[0061] In actual applications, the number of sub-threads can be set based on demand. It should be noted that by scheduling multiple sub-threads, multiple tasks mounted on the same lifecycle node can be asynchronously executed. The number of sub-threads determines the number of tasks that can be asynchronously executed. Compared with the prior art method of scheduling the main thread to execute multiple tasks serially, the embodiment of the present disclosure can asynchronously execute multiple tasks to be executed by scheduling multiple sub-threads, thereby reducing the time consumption of task execution in the target scenario, shortening the waiting time of users, and improving the user experience.

[0062] In an optional implementation, after the task mounted on the first lifecycle node is determined as a task to be executed, the task to be executed can be encapsulated in a task queue for queueing. When an idle sub-thread appears, the task to be executed is taken out from the task queue and placed on the idle sub-thread for execution.

[0063] In an optional implementation, the target scenario may include a scenario in which a viewing user enters a live broadcast room. In this scenario, at least one sub-thread is scheduled to asynchronously execute tasks on nodes such as initialization completion, user entering the live broadcast page, and user entering a specific live broadcast room, thereby reducing the time consumption of task execution in the target scenario and improving the user experience.

[0064] In the task processing method provided by the embodiment of the present disclosure, when a preset entry event for a first life cycle node is received, the task mounted on the first life cycle node is determined as a task to be executed; wherein the first life cycle node belongs to a plurality of life cycle nodes obtained by dividing the life cycle of a target scene, the target scene corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different life cycle nodes in the target scene; and at least one child thread is scheduled to execute the task to be executed. It can be seen that the embodiment of the present disclosure mounts a plurality of tasks on a plurality of life cycle nodes in advance, and when entering a certain life cycle node, the task mounted on the life cycle node is asynchronously executed by scheduling at least one child thread, thereby reducing the time consumption of task execution in the target scene and improving the user experience.

[0065] In actual applications, the tasks to be executed may include a first task to be executed. Before scheduling the child thread to execute the first task to be executed, it is first necessary to determine whether there is execution dependency information for the first task to be executed, wherein the execution dependency information carries identification information of the dependent execution result of the first task to be executed.

[0066] If it is determined that there is execution dependency information for the first task to be executed, it means that the execution of the first task to be executed depends on one or more execution results of a certain task, where one or more execution results of a certain task can be called dependent execution results of the first task to be executed. Therefore, before executing the first task to be executed, it is also necessary to determine whether the dependent execution results of the first task to be executed are currently stored.

[0067] Specifically, if it is determined that there is execution dependency information for the first task to be executed, then based on the identification information of the dependent execution result carried in the execution dependency information, it is determined whether the dependent execution result of the first task to be executed is currently stored. Only after the dependent execution result of the first task to be executed is obtained can the child thread be scheduled to execute the first task to be executed.

[0068] In the disclosed embodiment, the execution dependency information may carry a task identifier corresponding to the task on which the first task to be executed depends. For example, if the task on which the first task to be executed depends is A, then the execution dependency information of the first task to be executed may carry the task identifier of task A. The execution dependency information may also carry identification information of a dependency execution result corresponding to the dependent task. For example, if the dependency execution result of the first task to be executed is an intermediate execution result of task A, then the execution dependency information of the first task to be executed may carry identification information of the intermediate execution result.

[0069] In an optional implementation, it is possible to determine whether the dependent execution result of the first task to be executed exists in the preset execution result storage module based on the identification information of the dependent execution result carried in the execution dependency information. For example, assuming that the execution dependency information carries the identification information corresponding to the intermediate execution result A1 of task A, it is possible to query whether the intermediate execution result A1 of task A exists in the preset execution result storage module based on the identification information.

[0070] In an optional implementation, if it is determined that a dependent execution result of the first task to be executed is currently stored, the first sub-thread is scheduled to execute the first task to be executed based on the dependent execution result; wherein the first sub-thread belongs to at least one sub-thread.

[0071] In another optional implementation, if it is determined that the dependent execution result of the first task to be executed is not currently stored, the main thread executes the task on which the first task to be executed depends, obtains the execution result of the task, and then schedules the second sub-thread to execute the first task to be executed based on the execution result of the task; wherein the second sub-thread can be the same sub-thread as the first sub-thread, or can be a different sub-thread.

[0072] In actual applications, the execution results corresponding to the completed tasks can also be stored in a preset execution result storage module in advance. When it is determined that the first task to be executed has execution dependency information, the preset execution result storage module is queried whether the execution result on which the first task to be executed depends is stored. If it is determined that the execution result on which the first task to be executed depends does not exist in the preset execution result storage module, the main thread executes the task on which the first task to be executed depends to obtain the execution result of the task.

[0073] In the embodiment of the present disclosure, if the execution result on which the first task to be executed depends does not exist in the execution result storage module, it means that the task on which the first task to be executed depends is being executed by a child thread, or is still waiting for execution in the task queue. At this time, the main thread can execute the task on which the first task to be executed depends to obtain the execution result of the dependent task.

[0074] In an optional implementation, after determining that the execution result on which the first task to be executed depends does not exist in the execution result storage module, it is also possible to determine whether the task on which the first task to be executed depends is executed by the main thread based on the execution progress corresponding to the task on which the first task to be executed depends.

[0075] Specifically, if it is determined that the execution progress corresponding to the task on which the first task to be executed depends has not reached the preset progress threshold, the main thread executes the task on which the first task to be executed depends to obtain the execution result of the task; otherwise, the child thread continues to execute the task on which the first task to be executed depends until the task execution is completed and stored in the execution result storage module.

[0076] In an optional implementation, the preset progress threshold can be set based on actual needs. For example, the preset progress threshold can be set to 90%. If it is determined that the execution result on which the first task to be executed depends does not exist in the execution result storage module, the execution progress corresponding to the task on which the first task to be executed depends is queried. If the execution progress corresponding to the task exceeds 90%, it means that the task is about to be completed. At this time, the child thread continues to execute the task until the task is completed and stored in the execution result storage module.

[0077] In the disclosed embodiment, after obtaining the execution result of the task on which the first task to be executed depends, the second sub-thread is scheduled to execute the first task to be executed based on the execution result of the task.

[0078] It can be seen that when the embodiment of the present disclosure determines that the execution result on which the first task to be executed depends does not exist in the execution result storage module, the main thread executes the task on which the first task to be executed depends to obtain the execution result of the task, so that before scheduling the child thread to execute the first task to be executed, the execution result of the task can be obtained, which facilitates the subsequent execution of the first task to be executed based on the execution result of the task, further reducing the task execution time in the target scenario and improving the user experience.

[0079] In actual applications, there may be execution dependencies between tasks in the target scenario. Tasks with execution dependencies have an execution order. Assuming that the execution of Task B depends on the execution result of Task A, it means that there is an execution dependency between Task A and Task B, and Task B can only be executed when Task A is completed.

[0080] In an optional implementation, in order to reduce the total execution time of multiple tasks in the target scenario, different tasks with execution dependencies can also be mounted on different lifecycle nodes. In the process of executing multiple tasks in the target scenario, since there is no execution dependency between different tasks on the same lifecycle node, the tasks mounted on the lifecycle node can be asynchronously executed by scheduling at least one child thread, thereby reducing the execution time of tasks in the target scenario.

[0081] In actual applications, since there is a chronological execution relationship between multiple lifecycle nodes of the target scenario, and there are tasks with execution dependencies among multiple tasks of the target scenario, when determining the correspondence between lifecycle nodes and tasks, it is also necessary to comprehensively consider the two dimensions of the chronological execution relationship of lifecycle nodes and the execution dependency relationship between tasks, and mount the tasks to the corresponding lifecycle nodes.

[0082] In an optional implementation, the multiple lifecycle nodes of the target scenario include a second lifecycle node and a third lifecycle node, wherein the second lifecycle node is executed before the third lifecycle node. In addition, the multiple tasks corresponding to the target scenario include a second task and a third task having an execution dependency relationship, wherein the execution of the third task depends on the execution result of the second task.

[0083] Since the execution order of the second life cycle node is before the third life cycle node, and the execution of the third task depends on the execution result of the second task, the second task can be mounted on the second life cycle node, and the third task can be mounted on the third life cycle node, so that when the main thread executes each life cycle node, it can first schedule the child thread to execute the second task, and after obtaining the execution result of the second task, execute the third task based on the execution result of the second task.

[0084] For example, assume that the life cycle of the target scene is divided into node A1, node A2 and node A3, and the execution order of each node is A1, A2, A3 respectively, and the tasks in the target scene are B1, B2, B3 respectively, among which B2 and B3 have an execution dependency relationship, and the execution of B3 depends on the execution result of B2. Therefore, the life cycle nodes corresponding to B2 and B3 can include the following situations: 1. Mount B2 on A1 and mount B3 on A2; 2. Mount B2 on A1 and mount B3 on A3; 3. Mount B2 on A2 and mount B3 on A3.

[0085] It can be seen that the embodiment of the present disclosure mounts tasks with execution dependencies on different lifecycle nodes, so that different tasks mounted on the same lifecycle node can be executed asynchronously based on at least one sub-thread, thereby further reducing the task execution time in the target scenario.

[0086] In actual applications, when a preset exit event of a first life cycle node is received, the execution status of the tasks mounted on the life cycle node can also be counted so that the number of tasks and / or at least one sub-thread mounted on the life cycle node can be adjusted based on the execution status.

[0087] In an embodiment of the present disclosure, when a preset exit event of a first life cycle node is received, the execution status of the task mounted on the first life cycle node is determined, wherein the execution status is used to reflect whether the task is completed. Then, the execution status of the task mounted on the first life cycle node is sent, wherein the execution status of the task mounted on the first life cycle node is used to update the number of tasks mounted on the first life cycle node and / or at least one sub-thread.

[0088] In the disclosed embodiment, the first life cycle node may be any life cycle node in the target scenario.

[0089] In an optional implementation, the execution status of the tasks mounted on the first life cycle node is sent, and the technicians can evaluate whether the number of sub-threads is reasonable and whether the number of tasks mounted on the first life cycle node is reasonable based on the execution status of each task, and make corresponding adjustments for unreasonable situations.

[0090] In an optional implementation, the tasks mounted on the first life cycle node can be divided into unfinished tasks and completed tasks based on the execution status of the tasks. If it is determined that the number of unfinished tasks is much larger than the number of completed tasks, it means that the number of tasks mounted on the first life cycle node is large, or the number of at least one sub-thread is small. At this time, the number of tasks mounted on the first life cycle node can be reduced and / or the number of at least one sub-thread can be increased; if it is determined that all tasks mounted on the first life cycle node are completed, and there are still some idle sub-threads, it means that the number of tasks mounted on the first life cycle node is small, or the number of at least one sub-thread is large. At this time, the number of tasks mounted on the first life cycle node can be increased and / or the number of at least one sub-thread can be reduced.

[0091] It can be seen that the embodiment of the present disclosure can update the number of tasks and / or at least one sub-thread mounted on the first life cycle node based on the execution status of the tasks mounted on the first life cycle node, thereby further reducing the task execution time in the target scenario and improving the user experience.

[0092] Based on the above method embodiment, the present disclosure also provides a task processing device, referring to Figure 3 , is a structural diagram of a task processing device provided by an embodiment of the present disclosure, the device comprising:

[0093] A first determination module 301 is used to determine, in response to a preset entry event for a first lifecycle node, a task mounted on the first lifecycle node as a task to be executed; wherein the first lifecycle node belongs to a plurality of lifecycle nodes obtained by dividing the lifecycle of a target scenario, the target scenario corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different lifecycle nodes in the target scenario;

[0094] The first execution module 302 is used to schedule at least one sub-thread to execute the task to be executed.

[0095] In an optional implementation, the device further includes:

[0096] A second determination module is used to determine whether a dependent execution result of the first task to be executed is currently stored based on the execution dependency information if it is determined that the first task to be executed has execution dependency information; wherein the execution dependency information carries identification information of the dependent execution result;

[0097] Accordingly, the first execution module includes:

[0098] The execution submodule is used to schedule a first sub-thread to execute the first task to be executed based on the dependent execution result if it is determined that the dependent execution result of the first task to be executed is currently stored.

[0099] In an optional implementation, the device further includes:

[0100] A second execution module is configured to execute, by a main thread, a task on which the first task to be executed depends, to obtain an execution result of the task if it is determined that the dependent execution result of the first task to be executed is not currently stored;

[0101] The third execution module is used to schedule the second sub-thread to execute the first task to be executed based on the execution result of the task.

[0102] In an optional implementation, the device further includes:

[0103] A receiving module, configured to receive a mount request for a first task corresponding to the target scenario; wherein the mount request carries an identifier of a target lifecycle node;

[0104] A mounting module is used to mount the first task to the target lifecycle node.

[0105] In an optional implementation, there is no execution dependency between different tasks mounted on the same lifecycle node of the target scenario.

[0106] In an optional implementation, the multiple lifecycle nodes include a second lifecycle node and a third lifecycle node, the multiple tasks include a second task and a third task that have an execution dependency relationship, the execution dependency relationship includes a relationship in which the third task depends on the execution of the second task, the second task is mounted on the second lifecycle node, and the third task is mounted on the third lifecycle node.

[0107] In an optional implementation, the device further includes:

[0108] a third determination module, configured to determine, in response to a preset exit event for the first lifecycle node, an execution status of the task mounted on the first lifecycle node; wherein the execution status is used to reflect whether the task has been completed;

[0109] A sending module is used to send the execution status of the task mounted by the first life cycle node; wherein the execution status of the task mounted by the first life cycle node is used to update the number of tasks mounted by the first life cycle node and / or the at least one sub-thread.

[0110] In the task processing device provided by the embodiment of the present disclosure, when a preset entry event for a first life cycle node is received, the task mounted on the first life cycle node is determined as a task to be executed; wherein the first life cycle node belongs to a plurality of life cycle nodes obtained by dividing the life cycle of a target scene, the target scene corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different life cycle nodes in the target scene; and at least one child thread is scheduled to execute the task to be executed. It can be seen that the embodiment of the present disclosure mounts a plurality of tasks on a plurality of life cycle nodes in advance, and when entering a certain life cycle node, the task mounted on the life cycle node is asynchronously executed by scheduling at least one child thread, thereby reducing the time consumption of task execution in the target scene and improving the user experience.

[0111] In addition to the above-mentioned method and apparatus, the embodiments of the present disclosure further provide a computer-readable storage medium, in which instructions are stored. When the instructions are executed on a terminal device, the terminal device implements the task processing method described in the embodiments of the present disclosure.

[0112] The embodiment of the present disclosure further provides a computer program product, which includes a computer program / instructions. When the computer program / instructions are executed by a processor, the task processing method described in the embodiment of the present disclosure is implemented.

[0113] In addition, the present disclosure also provides a task processing device, see Figure 4 As shown, it may include:

[0114] Processor 401, memory 402, input device 403 and output device 404. The number of processors 401 in the task processing device can be one or more. Figure 4 In some embodiments of the present disclosure, the processor 401, the memory 402, the input device 403 and the output device 404 may be connected via a bus or other means, wherein: Figure 4 The example of connecting through bus is taken in the following.

[0115] The memory 402 can be used to store software programs and modules. The processor 401 executes various functional applications and data processing of the task processing device by running the software programs and modules stored in the memory 402. The memory 402 can mainly include a program storage area and a data storage area, wherein the program storage area can store an operating system, at least one application required for a function, etc. In addition, the memory 402 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other volatile solid-state storage devices. The input device 403 can be used to receive input digital or character information, and generate signal input related to user settings and function control of the task processing device.

[0116] Specifically in this embodiment, the processor 401 will load the executable files corresponding to the processes of one or more applications into the memory 402 according to the following instructions, and the processor 401 will run the applications stored in the memory 402, thereby realizing the various functions of the above-mentioned task processing device.

[0117] It should be noted that, in this article, relational terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or device. In the absence of further restrictions, the elements defined by the sentence "comprise a ..." do not exclude the existence of other identical elements in the process, method, article or device including the elements.

[0118] The above description is only a specific embodiment of the present disclosure, so that those skilled in the art can understand or implement the present disclosure. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present disclosure. Therefore, the present disclosure will not be limited to the embodiments described herein, but will conform to the widest scope consistent with the principles and novel features disclosed herein.

Claims

1. A task processing method, characterized in that: The method comprises: In response to a preset entry event for a first lifecycle node, determining a task mounted on the first lifecycle node as a task to be executed; wherein the first lifecycle node belongs to a plurality of lifecycle nodes obtained by dividing the lifecycle of a target scenario, the target scenario corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different lifecycle nodes in the target scenario; At least one sub-thread is scheduled to execute the task to be executed.

2. The method according to claim 1, characterized in that The to-be-executed tasks include a first to-be-executed task, and before scheduling at least one sub-thread to execute the to-be-executed task, the method further includes: If it is determined that the first task to be executed has execution dependency information, determining whether a dependent execution result of the first task to be executed is currently stored based on the execution dependency information; wherein the execution dependency information carries identification information of the dependent execution result; Accordingly, scheduling at least one sub-thread to execute the task to be executed includes: If it is determined that the dependent execution result of the first task to be executed is currently stored, the first sub-thread is scheduled to execute the first task to be executed based on the dependent execution result.

3. The method according to claim 2, characterized in that The method further comprises: If it is determined that the dependent execution result of the first task to be executed is not currently stored, the main thread executes the task on which the first task to be executed depends to obtain the execution result of the task; The second sub-thread is scheduled to execute the first task to be executed based on the execution result of the task.

4. The method according to claim 1, characterized in that: Before determining the task mounted on the first lifecycle node as the task to be executed in response to the preset entry event of the first lifecycle node, the method further includes: Receive a mount request for a first task corresponding to the target scenario; wherein the mount request carries an identifier of a target lifecycle node; Mount the first task to the target lifecycle node.

5. The method according to claim 1, characterized in that There is no execution dependency between different tasks mounted on the same lifecycle node of the target scenario.

6. The method according to claim 1, characterized in that The multiple lifecycle nodes include a second lifecycle node and a third lifecycle node, the multiple tasks include a second task and a third task that have an execution dependency relationship, the execution dependency relationship includes a relationship in which the third task depends on the execution of the second task, the second task is mounted on the second lifecycle node, and the third task is mounted on the third lifecycle node.

7. The method according to claim 1, characterized in that The method further comprises: In response to a preset exit event for the first lifecycle node, determining an execution status of a task mounted on the first lifecycle node; wherein the execution status is used to reflect whether the task has been completed; Send the execution status of the task mounted by the first life cycle node; wherein the execution status of the task mounted by the first life cycle node is used to update the number of tasks mounted by the first life cycle node and / or the at least one sub-thread.

8. A task processing device, characterized in that: The device comprises: A first determination module is used to determine, in response to a preset entry event for a first lifecycle node, a task mounted on the first lifecycle node as a task to be executed; wherein the first lifecycle node belongs to a plurality of lifecycle nodes obtained by dividing the lifecycle of a target scene, the target scene corresponds to a plurality of tasks, and the plurality of tasks are respectively mounted on the same or different lifecycle nodes in the target scene; The first execution module is used to schedule at least one sub-thread to execute the task to be executed.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores instructions, and when the instructions are executed on a terminal device, the terminal device implements the method according to any one of claims 1 to 7.

10. A task processing device, characterized in that: include: A memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.