Task execution method and device, equipment and storage medium
By dynamically adjusting the topological sorting based on the terminal device environment and user behavior data, the problem of task execution mismatch is solved, and dynamic adaptation of task execution and process stability are achieved.
Patent Information
- Application Number
- CN202510932199.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-07-07
- Publication Date
- 2025-10-10
AI Technical Summary
During the execution of multiple tasks, if the status of the terminal device changes, the existing technology cannot dynamically adjust the task execution order, resulting in execution not matching the device status and affecting the process processing effect.
By acquiring the device environment and user behavior data of the terminal device, the topological sorting is dynamically adjusted, a second topological sorting is generated, and the unfinished information processing tasks are re-executed.
It realizes the dynamic adjustment of the execution timing and dependency relationships of information processing tasks, adapts to dynamic demand scenarios, and improves the adaptability of task execution and the stability of process processing.
Smart Images

Figure CN120769073A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to the technical field of computer, and particularly relate to a task execution method and device, equipment and storage medium. BACKGROUND
[0002] For the process of entering a live room, related technologies split the process into multiple tasks (such as network detection, live room initialization, video loading, etc.), and then execute them in order, triggering the next task after each task is completed.
[0003] However, during the execution of multiple tasks, if the state of the terminal device changes, continuing to execute according to the execution order of the multiple tasks may not be suitable for the state of the terminal device. SUMMARY
[0004] Embodiments of the present application provide a task execution method, device, equipment and storage medium. The technical solution is as follows:
[0005] According to an aspect of an embodiment of the present application, a task execution method is provided, the method comprising:
[0006] In response to a first user account entering a live room, a first topological order is obtained, the first topological order comprising N information processing tasks, the N information processing tasks being used to display a user interface corresponding to the live room on a terminal device of the first user account, N being a positive integer;
[0007] Based on the first topological order, the N information processing tasks are executed;
[0008] During the execution of the N information processing tasks, if a first condition is met, the first topological order is adjusted to obtain a second topological order, the first condition being determined based on a device environment of the terminal device and / or behavior data of the first user account;
[0009] Based on the second topological order, unexecuted information processing tasks in the N information processing tasks are executed.
[0010] According to an aspect of an embodiment of the present application, a task execution device is provided, the device comprising:
[0011] An obtaining module is configured to, in response to a first user account entering a live room, obtain a first topological order, the first topological order comprising N information processing tasks, the N information processing tasks being used to display a user interface corresponding to the live room on a terminal device of the first user account, N being a positive integer;
[0012] A first execution module is configured to execute the N information processing tasks based on the first topological order.
[0013] an adjustment module, configured to adjust the first topological sorting to obtain a second topological sorting if a first condition is satisfied during the execution of the N information processing tasks, wherein the first condition is determined based on a device environment of the terminal device and / or behavioral data of the first user account;
[0014] A second execution module is configured to execute unexecuted information processing tasks among the N information processing tasks based on the second topological sorting.
[0015] According to one aspect of an embodiment of the present application, a computer device is provided, comprising a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the above-mentioned task execution method.
[0016] According to one aspect of an embodiment of the present application, a computer-readable storage medium is provided, in which a computer program is stored. The computer program is loaded and executed by a processor to implement the above-mentioned task execution method.
[0017] According to one aspect of an embodiment of the present application, a computer program product is provided, wherein the computer program product includes a computer program, and the computer program is loaded and executed by a processor to implement the above-mentioned task execution method.
[0018] The technical solutions provided by the embodiments of the present application may have the following beneficial effects:
[0019] Based on the device environment of the terminal device and / or the behavioral data of the first user account, the system can dynamically adjust the first topological sorting during the execution of N information processing tasks to obtain a second topological sorting, and then execute the unexecuted information processing tasks based on the second topological sorting. It supports dynamic adjustment of the execution timing and / or dependencies of information processing tasks, as well as cancellation of information processing tasks, to adapt to dynamic demand scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 is a schematic diagram of a computer system provided by one embodiment of the present application;
[0021] Figure 2 This is a flowchart of a task execution method provided by an embodiment of the present application;
[0022] Figure 3 This is a schematic diagram of a first topological sorting provided by an embodiment of the present application;
[0023] Figure 4 This is an architecture diagram of a task execution system provided by one embodiment of the present application;
[0024] Figure 5 is a schematic diagram of a first topological sorting provided by another embodiment of the present application;
[0025] Figure 6 is a schematic diagram of a first topological sorting provided by another embodiment of the present application;
[0026] Figure 7 is a block diagram of a task execution device provided by one embodiment of the present application;
[0027] Figure 8 This is a structural diagram of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0028] In order to make the objectives, technical solutions and advantages of this application clearer, the implementation methods of this application will be further described in detail below with reference to the accompanying drawings.
[0029] Please refer to Figure 1 , which shows a schematic diagram of a computer system provided by an embodiment of the present application. The computer system may include: a terminal device 100 and a server 200.
[0030] The terminal device 100 can be an electronic device such as a PC (Personal Computer), a mobile phone, a wearable device, a vehicle terminal, a VR (Virtual Reality) device, an AR (Augmented Reality) device, an MR (Mixed Reality) device, etc. The terminal device 10 can run a target application or a client of the target application. In the embodiment of the present application, the above-mentioned target application refers to an application that provides a live broadcast function. Optionally, the target application can be a system-level application, such as an operating system or a native application provided by the operating system; it can also be a third-party application, such as a third-party application downloaded and installed by the user, which is not limited in the embodiment of the present application. For example, the target application can be a video application, or it can be a learning application, a game application, or other application that provides a live broadcast or viewing live broadcast function. In addition, the present application does not limit the form of the target application, including but not limited to an App (Application) installed in the terminal device 100, a mini-program, etc., and can also be in the form of a web page.
[0031] Exemplarily, the terminal device 100 is installed with a target application program, the target application program is provided with a live broadcast or watching live broadcast function, in response to a first user account entering a live broadcast room, a first topological sequence is acquired, the first topological sequence includes N information processing tasks, the N information processing tasks are used for displaying a user interface corresponding to the live broadcast room on a terminal device of the first user account, N is a positive integer; based on the first topological sequence, the N information processing tasks are executed; in the execution process of the N information processing tasks, if a first condition is met, the first topological sequence is adjusted to obtain a second topological sequence, the first condition is determined based on a device environment of the terminal device and / or behavior data of the first user account; based on the second topological sequence, an information processing task that is not executed in the N information processing tasks is executed.
[0032] The server 200 can be a standalone physical server, can be a server cluster or a distributed system composed of multiple physical servers, or can be a cloud server providing cloud computing services. The server 200 can be a background server of the target application program, and is configured to provide background services for clients of the target application program.
[0033] The terminal device 100 and the server 200 can communicate through a network, such as a wired or wireless network.
[0034] The task execution method provided by the embodiment of the present application can be executed by a computer device. The computer device is an electronic device with data calculation, processing and storage capabilities. For example, the computer device can be a terminal device, a server, a cloud server, etc. Figure 1 The computer system shown in the figure can execute the task execution method (for example, the client of the target application program installed and running in the terminal device 100 executes the task execution method), or the server 200 can execute the task execution method, or the terminal device 100 and the server 200 can interact and cooperate to execute the task execution method, and the present application does not limit this. For example, the terminal device 100 acquires the behavior data of the first user account and the device environment of the terminal device, and sends them to the server 200, and the server 200 executes the steps of: in response to the first user account entering the live broadcast room, acquiring the first topological sequence, based on the first topological sequence, executing the N information processing tasks; in the execution process of the N information processing tasks, if the first condition is met, the first topological sequence is adjusted to obtain the second topological sequence, the first condition is determined based on the device environment of the terminal device and / or the behavior data of the first user account; based on the second topological sequence, an information processing task that is not executed in the N information processing tasks is executed.
[0035] Regarding the process of entering the live broadcast room, the relevant technology divides the process into multiple tasks (such as network detection, room initialization, video loading, etc.), and then executes them sequentially, triggering the next task after each task is completed. However, after determining the execution order of multiple tasks, the execution order of the multiple tasks cannot be changed during the execution of the multiple tasks. At this time, if the process of entering the live broadcast room is cancelled, or the device environment changes and causes an error, the above-mentioned multiple tasks still need to be executed in the execution order. Moreover, during the execution of multiple tasks, if the status of the terminal device changes, continuing to execute according to the execution order of the multiple tasks may not match the status of the terminal device.
[0036] In this regard, an embodiment of the present application proposes a task execution method that can dynamically adjust the topological sorting of tasks based on the device environment of the terminal device and / or the behavioral data of the first user account. Based on the device environment of the terminal device and / or the behavioral data of the first user account, the first topological sorting can be dynamically adjusted during the execution of N information processing tasks to obtain a second topological sorting, and then the unexecuted information processing tasks in the N information processing tasks are executed based on the second topological sorting. It supports dynamic adjustment of the execution timing and / or dependency of information processing tasks, as well as cancellation of the execution of information processing tasks, and can adapt to dynamic demand scenarios.
[0037] Please refer to Figure 2 , which shows a flowchart of a task execution method provided by an embodiment of the present application. This method can be applied to Figure 1 In the computer system shown in FIG. , the method includes at least one of the following steps 210 to 240 .
[0038] Step 210, in response to the first user account entering the live broadcast room, obtain a first topological sorting, the first topological sorting includes N information processing tasks, the N information processing tasks are used to display the user interface corresponding to the live broadcast room on the terminal device of the first user account, and N is a positive integer.
[0039] In some embodiments, the first user account is a user account of the target application. In some embodiments, the target application provides a live broadcast or viewing live broadcast function. The live broadcast function is the function of the first user account to enable live broadcast, and the viewing live broadcast function is the function of the first user account to watch the live broadcast enabled by the second user account. In some embodiments, the target application can be a video application, a learning application, a social application, a game application, a music application, etc. In some embodiments, the target application can be an independent application, a mini-program or a quick application attached to other program architectures, or an application in the form of a web page.
[0040] In some embodiments, the first user account enters the live room, which is a process of switching display from the first user interface to the second user interface relative to the terminal device, where the first user interface displays an entrance of the live room, and the second user interface is a main interface of the live room.
[0041] In some embodiments, the first user interface is a user interface of the target application. In some embodiments, the first user interface can display an entrance of the live room. In some embodiments, the entrance of the live room can be a cover picture of the live room. Illustratively, the cover picture of the live room can be presented with host information, for example, the cover picture of the live room is an avatar picture of the host. In some embodiments, the entrance of the live room can be a link of the live room. Illustratively, the first user interface displays a link of the live room, and in response to a triggering operation on the link of the live room, the first user account enters the live room.
[0042] In some embodiments, the first user interface is an information stream interface. Illustratively, the first user interface displays at least one information stream, where one information stream is an entrance of the live room. In some embodiments, the at least one information stream can be different forms of information streams. Illustratively, the first user interface displays at least one video stream. Illustratively, the first user interface displays at least one text and image information stream. Illustratively, the first user interface displays at least one live room entrance. For example, the first user interface only displays entrances of different live rooms, such as only displays thumbnail pictures of live rooms.
[0043] In some embodiments, the operation of the first user account entering the live room can be an operation of the first user account entering the first live room from a state of never entering the live room. Illustratively, the first user interface displays a link of the first live room, and in response to a triggering operation on the link of the first live room, the first user account enters the first live room. In some embodiments, the operation of the first user account entering the live room can also be an operation of the first user account switching from the first live room to the second live room. Illustratively, the first user interface displays the first live room, and in response to a switching operation on the first live room, the first user account switches to the second live room.
[0044] In some embodiments, the N information processing tasks are used to display a user interface corresponding to the live room on the terminal device of the first user account. In some embodiments, the N information processing tasks are used to obtain relevant information of the user interface of the live room, and determine the network state of the first user account. For example, the N information processing tasks include one or more of the following: a live room initialization task, a network detection task, a live room information task, a stream information task, a live room list task, and a host information task. The live room initialization task is used to obtain initialization information of the live room, for example, to obtain the initialization UI layout of the user interface of the live room. The network detection task is used to determine the network state of the terminal device, that is, to determine whether the terminal device establishes a network connection with the server, or whether the terminal device can obtain data support of the live room from the server. The live room information task is used to obtain personalized information of the live room, for example, to obtain information such as popularity, barrage, and special effects of the live room. The stream information task is used to determine the information stream in the first user interface. The live room list task is used to determine the list order for switching to other live rooms based on the current live room.
[0045] In some embodiments, the N information processing tasks can be divided in advance based on the process of the first user account entering the live room, for example, by the developer of the target application; or can be divided based on the operation of the first user account entering the live room. For example, if the first user account is in a state of not entering the live room and enters the first live room, the N information processing tasks include the stream information task; if the first user account switches from the first live room to the second live room, the N information processing tasks include the live room list task.
[0046] Step 220, based on the first topological sorting, executing the N information processing tasks.
[0047] In some embodiments, the first topological sorting is determined based on the execution order and the dependency relationship of the N information processing tasks. In some embodiments, the execution order is the order of execution of the N information processing tasks. The dependency relationship is the association relationship between the execution and / or completion state of one information processing task and other information processing tasks in the N information processing tasks. For example, as shown in the first topological order, the network detection task needs to be executed after the completion of the live room initialization task, and the live room information task, the stream information task, and the live room list task all need to be executed after the completion of the network detection task, and the live room information task, the stream information task, and the live room list task are parallel tasks. Figure 3
[0048] In some embodiments, the first topological sorting is in the form of a DAG (Directed Acyclic Graph). In some embodiments, when generating the first topological sorting, the first topological sorting needs to be subjected to a cyclic detection. If there is a cyclic dependency in the first topological sorting, an error is reported for the first topological sorting. After the error is reported, the process of exiting the first user account and entering the live broadcast room is performed. If no cyclic dependency is detected, N information processing tasks are executed based on the first topological sorting. The cyclic dependency refers to the existence of a dependency relationship between one or more information processing tasks among the N information processing tasks to form a cyclic dependency, or the dependency relationship between one or more processing tasks among the N information processing tasks is cyclic in the DAG.
[0049] Step 230: During the execution of N information processing tasks, if a first condition is met, the first topological sorting is adjusted to obtain a second topological sorting, where the first condition is determined based on the device environment of the terminal device and / or the behavioral data of the first user account.
[0050] In some embodiments, during the execution of N information processing tasks, it is also necessary to monitor the device environment of the terminal device and / or obtain the behavioral data of the first user account.
[0051] In some embodiments, the device environment of the terminal device is monitored, and the device environment includes one or more of the following parameters: network status, device power, and CPU (Central Processing Unit) load. Among them, the network status is used to indicate the communication status between the terminal device and the server. If the communication connection between the terminal device and the server is disconnected during the execution of N information processing tasks, the unexecuted information processing tasks in the N information processing tasks can be suspended or canceled. In some embodiments, the device power is the power of the terminal device. The power of the terminal device may affect the performance or processing power of the terminal device. At this time, the execution order or execution timing of each information processing task needs to be adjusted according to the performance or processing power of the terminal device. The CPU load refers to the resource occupancy of the CPU of the terminal device. Similarly, if the CPU of the terminal device occupies more resources, it can only provide fewer resources to process the relevant data of the live broadcast room. At this time, the execution order or execution timing of each information processing task can also be adjusted to reduce the load on the CPU.
[0052] In some embodiments, behavioral data of the first user account is obtained, and the behavioral data is used to record the operations of the first user account during the execution of N information processing tasks. In some embodiments, during the execution of N information processing tasks, the first user account may trigger the operation of switching the live broadcast room or exiting the live broadcast room. At this time, whether the unexecuted information processing tasks in the N information processing tasks need to continue to be executed needs to be determined based on the behavioral data of the first user account. In some embodiments, the operations of the first user account may also affect the relevant information of the live broadcast room. For example, the first user account's follow-up operation on the live broadcast room will affect the live broadcast room information task, which also needs to be processed based on the behavioral data of the first user account.
[0053] Step 240 : Execute the unexecuted information processing tasks among the N information processing tasks based on the second topological sorting.
[0054] In some embodiments, after obtaining the second topological sorting, only the unexecuted information processing tasks among the N information processing tasks need to be executed. In some embodiments, the second topological sorting may include N information processing tasks, and execution may be performed from the unexecuted information processing tasks among the N information processing tasks. In some embodiments, the second topological sorting may also include only the unexecuted information processing tasks among the N information processing tasks, in which case execution may be performed according to the second topological sorting.
[0055] In some embodiments, the second topological sorting is in the form of a DAG. In some embodiments, when generating the second topological sorting, a loop check is also performed. If a loop dependency exists in the second topological sorting, an error is reported for the second topological sorting. After the error is reported, the process of entering the live broadcast room using the first user account is exited. If no loop dependency is detected, the unexecuted information processing tasks among the N information processing tasks are executed based on the second topological sorting.
[0056] The technical solution provided by the embodiments of this application can dynamically adjust a first topological sorting during the execution of N information processing tasks based on the device environment of the terminal device and / or the behavioral data of the first user account to obtain a second topological sorting, and then execute the unexecuted information processing tasks among the N information processing tasks based on the second topological sorting. This solution supports dynamic adjustment of the execution timing and / or dependencies of information processing tasks, as well as cancellation of information processing tasks, and can adapt to dynamic demand scenarios.
[0057] Next, we will combine Figure 2 The technical solutions of the embodiments of the present application are described in detail.
[0058] Step 210, in response to the first user account entering the live broadcast room, obtain a first topological sorting, the first topological sorting includes N information processing tasks, the N information processing tasks are used to display the user interface corresponding to the live broadcast room on the terminal device of the first user account, and N is a positive integer.
[0059] In some embodiments, the step of obtaining a first topological sorting may be implemented as at least one of the following steps a to c.
[0060] Step a: Obtain N information processing tasks.
[0061] In some embodiments, N information processing tasks are used to display the user interface corresponding to the live broadcast room on the terminal device of the first user account. In some embodiments, the N information processing tasks are used to obtain relevant information of the live broadcast room user interface and determine the network status of the first user account. Exemplarily, the N information processing tasks include one or more of the following: a live broadcast room initialization task, a network detection task, a live broadcast room information task, a stream information task, a live broadcast room list task, and a host information task. The live broadcast room initialization task is used to obtain the initialization information of the live broadcast room, such as obtaining the initialization UI layout of the live broadcast room user interface. The network detection task is used to determine the network status of the terminal device, that is, to determine whether the terminal device has established a network connection with the server, or whether the terminal device can obtain data support for the live broadcast room from the server. The live broadcast room information task is used to obtain personalized information of the live broadcast room, such as obtaining information such as popularity, barrage, special effects, etc. of the live broadcast room. The stream information task is used to determine the information flow in the first user interface. The live broadcast room list task is used to determine the list order based on switching to other live broadcast rooms based on the current live broadcast room.
[0062] In some embodiments, the N information processing tasks are predefined or determined based on the operation of the first user account entering the live broadcast room. In some embodiments, the N information processing tasks can be pre-divided based on the process of the first user account entering the live broadcast room, for example, by the developer of the target application; or they can be divided based on the operation of the first user account entering the live broadcast room. For example, if the first user account enters the first live broadcast room from a state where it has not entered the live broadcast room, then the N information processing tasks include the stream information task; if the first user account switches from the first live broadcast room to the second live broadcast room, then the N information processing tasks include the live broadcast room list task.
[0063] In some embodiments, due to the different operations of the first user account entering the first live broadcast room, multiple candidate information processing task division methods can be pre-configured, and then a suitable information processing task division method can be selected based on the operation of the first user account accessing the first live broadcast room.
[0064] In some embodiments, an information processing task can be abstracted as a task node unit, for example, represented by the Processor base class. In some embodiments, an information processing task can define the basic behavior of the information processing task execution. For example, an information processing task can include one or more of the following: standard interfaces such as task start (start()), task end (end()), and task cancel (cancel()), supporting synchronous and asynchronous task execution modes.
[0065] In some embodiments, an information processing task can also define an interface for monitoring task status. This interface monitors task status in real time to ensure accurate triggering of task dependencies. Task implementations inheriting Processor are responsible for specific task flows, such as network detection, request flow address, and room information acquisition.
[0066] Step b: Arrange the execution order and dependency of N information processing tasks through a declarative chain API (Application Programming Interface).
[0067] In some embodiments, a chaining API, also known as a "streaming API" or "chaining calls," allows developers to simplify code by calling object methods sequentially, improving readability and maintainability. The core principle is that each method call returns the object itself, allowing multiple operations to be performed in the same statement.
[0068] In some embodiments, the declarative chain API uses before(), after(), and with() to define the dependencies of information processing tasks, supporting flexible arrangement of the dependencies of information processing tasks.
[0069] For example, taking the live broadcast room initialization task, network detection task, and then executing the live broadcast room information task, stream information task, and live broadcast room list task in parallel as an example, the API definitions of dependency API (with, before, after) and dynamic update dependency (updateDependency) are as follows:
[0070]
[0071]
[0072] For example, the execution order and dependency relationship of N information processing tasks in a schedule are as follows:
[0073] controller.process(roomInitProcessor)
[0074] .before(networkProcessor); / / Declare roomInitProcessor before networkProcessor
[0075] controller.process(videoProcessor)
[0076] .with(roomInfoProcessor) / / Parallel binding roomInfoProcessor
[0077] .with(relevanceInfoProcessor) / / Parallel binding relevanceInfoProcessor
[0078] .after(networkProcessor); / / Declare that all three are executed after networkProcessor
[0079] For example, another arrangement of the execution order and dependency relationships of N information processing tasks is as follows:
[0080] / / Sequence: roomInitProcessor → networkProcessor → roomInfoProcessor → parallel task (videoProcessor.relevanceInfoProcessor)
[0081] controller.process(roonInitProcessor)
[0082] .before(networkProcessor); / / roomInitProcessor front
[0083] controller.process(networkProcessor)
[0084] .before(roonInfoProcessor); / / networkProcessor before roomInfoProcessor
[0085] controller.process(videoProcessor)
[0086] .with(relevanceInfoProcessor) / / Parallel binding relevanceInfoProcessor
[0087] .after(roomInfoProcessor); / / Both are executed after roomInfoProcessor
[0088] Among them, roomInitProcessor is the live broadcast room initialization task, networkProcessor is the network detection task, roomInfoProcessor is the live broadcast room information task, videoProcessor is the stream information task, and relevanceInfoProcessor is the live broadcast room list task.
[0089] Step c: determining a first topological sorting based on the execution order and dependency relationship of the N information processing tasks.
[0090] In some embodiments, the first topological sorting is in the form of a DAG. In some embodiments, the execution order and dependency relationship of the N information processing tasks are converted into a DAG graph to obtain the first topological sequence.
[0091] In some embodiments, when generating the first topological sorting, a loop check is performed on the first topological sorting. If a loop dependency exists in the first topological sorting, an error is reported for the first topological sorting. After the error is reported, the first user account exits the process of entering the live broadcast room. If no loop dependency is detected, N information processing tasks are executed based on the first topological sorting.
[0092] In some embodiments, the Kahn algorithm is used to detect loops in the first topological sorting, and an exception is thrown to prevent process deadlock. In some embodiments, the Kahn algorithm is used to generate the topological sorting, and loop detection is also performed while generating the topological sorting. If a loop is detected, an exception is thrown, and the process of exiting the first user account and entering the live broadcast room is executed.
[0093] Step 220: Execute N information processing tasks based on the first topological sorting.
[0094] In some embodiments, for the first information processing task in the first topological sorting, the N information processing tasks can be divided into synchronous tasks and asynchronous tasks. Synchronous tasks refer to information processing tasks that are executed in the same thread and in sequence with the first information processing task, and asynchronous tasks refer to information processing tasks that are executed in different threads and in sequence with the first information processing task. Figure 3 Taking the first topological sorting shown as an example, the live broadcast room initialization task and the network detection task are synchronous tasks, while the live broadcast room information task and the stream information task are asynchronous tasks.
[0095] In some embodiments, for the first information processing task in the first topological sorting, the synchronous task of the first information processing task is executed by the main thread, and the first information processing task is any one of the N information processing tasks executed by the main thread; the asynchronous task of the first information processing task is executed by the child thread.
[0096] For synchronous tasks (typically lightweight tasks or tasks with extremely high real-time requirements, such as UI updates), the execution engine executes the task logic directly on the main thread. After the task is completed, the end() method is automatically called to update the task state (via the TaskStateTracker state synchronizer) and trigger the checking and scheduling of dependent tasks.
[0097] For asynchronous tasks (typically time-consuming tasks such as network requests and loading audio and video streams), the execution engine assigns a worker thread from a preconfigured thread pool to execute the task. To optimize mobile device resource usage, the thread pool size is dynamically adjusted (based on the number of device CPU cores and current load) to avoid performance degradation caused by excessive thread creation. After the asynchronous task is completed, the completion event is callbacked to the main thread through the state synchronizer, and the end() method is executed in the main thread, ensuring thread-safety for task status updates and subsequent task scheduling.
[0098] In some embodiments, child threads are determined from a preconfigured thread pool, the size of which is dynamically adjusted based on the device environment of the terminal device. In some embodiments, the size of the thread pool changes as the device environment of the terminal device changes. For example, as the CPU load increases, the thread pool may be reduced accordingly to avoid performance degradation caused by excessive thread creation.
[0099] To address state consistency issues in a multi-threaded environment, this application also designs a state synchronizer (TaskStateTracker) as a central management unit for task states. In some embodiments, after a child thread completes an asynchronous task, it obtains the task state of the asynchronous task through the state synchronizer; based on the task state, the main thread is dispatched to confirm the completion of the asynchronous task.
[0100] The state synchronizer, based on a thread-safe queue and lock mechanism, ensures that the results of asynchronous tasks are processed sequentially in the main thread, avoiding state contention. To address the Android system's constraint that UI operations must be executed on the main thread, the state synchronizer uses lightweight messaging mechanisms (such as the Android Handler or a custom message queue) to seamlessly switch asynchronous callbacks to the main thread. This significantly reduces thread switching overhead and ensures real-time UI responsiveness in live broadcast scenarios (for example, avoiding pop-up window delays or interface freezes).
[0101] Step 230: During the execution of N information processing tasks, if a first condition is met, the first topological sorting is adjusted to obtain a second topological sorting, where the first condition is determined based on the device environment of the terminal device and / or the behavioral data of the first user account.
[0102] In some embodiments, the first condition includes at least one of the following:
[0103] One or more parameters in the device environment reach preset thresholds;
[0104] The behavioral data includes the behavior of the first user account canceling entry into the live broadcast room.
[0105] In some embodiments, the preset threshold is set based on the capabilities of the terminal device, for example, the developer pre-sets the threshold based on the capabilities of different terminal models. In some embodiments, the preset threshold is set based on the requirements of the target application. For example, the developer designs the preset threshold based on the requirements of the target application for performing information processing tasks.
[0106] In some embodiments, the device environment includes one or more of the following parameters: network status, device power, and CPU load. In some embodiments, different thresholds can be set for different parameters, which is not limited in this application. Exemplarily, when the network status switches from a connected state to an unconnected state, you can choose to delay the processing of unexecuted information processing tasks, for example, restart the execution from the network detection task after M seconds. Exemplarily, when the device power reaches a first threshold, the number of threads executed in parallel is reduced. Exemplarily, when the CPU load reaches a second threshold, the number of threads executed in parallel is reduced.
[0107] In some embodiments, the behavior data includes the first user account's behavior of canceling entry into the live broadcast room, which may include one or more of the following:
[0108] The first user account cancels the operation of accessing the live broadcast room;
[0109] The first user account exits the live broadcast room;
[0110] The operation of switching the live broadcast room with the first user account;
[0111] The first user account exits the target application;
[0112] The first user account shuts down the terminal device;
[0113] The first user account turns off the screen of the terminal device.
[0114] In some embodiments, when the first condition is met, the adjustment strategies corresponding to the unexecuted information processing tasks among the N information processing tasks are determined, and the adjustment strategies are used to adjust the execution timing and / or dependency relationships of the unexecuted information processing tasks; the first topological sorting is adjusted based on the adjustment strategies corresponding to the unexecuted information processing tasks to obtain a second topological sorting.
[0115] In some embodiments, the adjustment strategy includes one or more of the following:
[0116] Delay adjustment strategy, used to delay the execution of unexecuted information processing tasks;
[0117] A synchronization adjustment strategy is used to adjust the dependency between the unexecuted information processing task and other information processing tasks in the N information processing tasks except the unexecuted information processing task;
[0118] Cancellation strategy, used to cancel unexecuted information processing tasks.
[0119] In some embodiments, the first condition may include multiple sub-conditions, and the adjustment policies corresponding to the unexecuted information processing tasks among the N information processing tasks are determined based on the satisfied sub-conditions. In some embodiments, the association between the sub-conditions and the adjustment policies can be pre-configured. For example, the adjustment policy associated with the operation of the first user account exiting the target application program according to the behavioral data of the first user account is a cancellation policy. For example, the adjustment policy associated with the device power reaching a first threshold is a synchronization adjustment policy.
[0120] In some embodiments, if multiple subtasks included in the first condition are simultaneously met, the adjustment policies associated with the subtasks may overlap. For example, if two subtasks in the first condition are simultaneously met, and both are associated with delay adjustment policies, one with a delay of 1 second and the other with a delay of 2 seconds, then the determined delay adjustment policy is a delay of 3 seconds.
[0121] In some embodiments, the sub-conditions in the first condition may be associated with the adjustment policy of the i-th information processing task, where i is an integer less than or equal to N. For example, the behavioral data of the first user account includes the adjustment policy associated with the operation of the first user account exiting the target application as the cancellation policy of the live broadcast room initialization task. For example, the adjustment policy associated with the device power reaching the first threshold is the synchronization adjustment policy of the stream information task. In some embodiments, a sub-condition may be associated with the adjustment policy of one or more information processing tasks. In some embodiments, when a sub-condition is associated with the adjustment policy of multiple information processing tasks, the adjustment policies of different information processing tasks associated with the sub-condition may be different. Exemplarily, the device power reaching the first threshold is associated with the delay adjustment policy of the stream information task, and the synchronization adjustment policy of the live broadcast room information task.
[0122] In some embodiments, when a sub-condition is associated with the adjustment policies of multiple information processing tasks, if the adjustment policies of the multiple information processing tasks are the same, the adjustment policies of different information processing tasks may have different values. For example, when the device power reaches the first threshold, the delay adjustment policy of the stream information task associated with the device is a delay of 2 seconds, and the delay adjustment policy of the associated live broadcast room information task is a delay of 4 seconds.
[0123] In some embodiments, an information processing task may correspond to one or more adjustment policies. For example, an information processing task may correspond to both a delay adjustment policy and a synchronization adjustment policy. In some embodiments, an information processing task may not correspond to an adjustment policy. If an adjustment policy for an information processing task cannot be determined, the execution timing of the information processing task will not be adjusted, but its dependencies may be adjusted based on the adjustment policies of other information processing tasks.
[0124] In some embodiments, the adjustment strategy further includes a re-execution strategy. Exemplarily, the re-execution strategy is set for a network detection task. Exemplarily, the first task in the second topological sorting is a network detection task, and subsequent information processing tasks can only be executed after the network detection task is completed.
[0125] In some embodiments, if the adjustment strategies corresponding to the unexecuted information processing tasks are all cancellation strategies, the resources allocated to the N information processing tasks are recovered. During the execution of asynchronous tasks, if an exception occurs or the user actively interrupts the process (such as exiting the live broadcast room), the execution engine sends a cancellation signal to the relevant tasks through the state synchronizer, suspends task scheduling and terminates the execution of unfinished tasks. The execution engine is responsible for coordinating the interruption process and notifying the resource recovery module of the resource recovery requirements, and waiting for the recovery completion signal to continue subsequent operations (such as closing the execution process or thread pool). When the execution engine receives an interruption signal during the execution of a task (task execution exception or user actively interrupts the process), this module is responsible for receiving notifications from the execution engine and performing specific resource recovery operations, including the recovery of thread resources related to asynchronous tasks, canceling unexecuted tasks, and releasing audio and video resources such as streaming media players. After the recovery is completed, the module feeds back a completion signal to the execution engine to ensure that the process can continue or terminate safely.
[0126] In some embodiments, the reclaimed resources include unoccupied resources and occupied resources. For example, the reclaimed resources include: resources of threads to be executed later (unoccupied) and resources of the currently executed video player (occupied).
[0127] Step 240 : Execute the unexecuted information processing tasks among the N information processing tasks based on the second topological sorting.
[0128] In some embodiments, after obtaining the second topological sorting, only the unexecuted information processing tasks among the N information processing tasks need to be executed. In some embodiments, the second topological sorting may include N information processing tasks, and execution may be performed from the unexecuted information processing tasks among the N information processing tasks. In some embodiments, the second topological sorting may also include only the unexecuted information processing tasks among the N information processing tasks, in which case execution may be performed according to the second topological sorting.
[0129] In some embodiments, the second topological sorting is in the form of a DAG. In some embodiments, when generating the second topological sorting, a loop check is also performed. If a loop dependency exists in the second topological sorting, an error is reported for the second topological sorting. After the error is reported, the process of entering the live broadcast room using the first user account is exited. If no loop dependency is detected, the unexecuted information processing tasks among the N information processing tasks are executed based on the second topological sorting.
[0130] The technical solution provided by the embodiments of this application can dynamically adjust a first topological sorting during the execution of N information processing tasks based on the device environment of the terminal device and / or the behavioral data of the first user account to obtain a second topological sorting, and then execute the unexecuted information processing tasks among the N information processing tasks based on the second topological sorting. This solution supports dynamic adjustment of the execution timing and / or dependencies of information processing tasks, as well as cancellation of information processing tasks, and can adapt to dynamic demand scenarios.
[0131] Please refer to Figure 4 , which shows an architecture diagram of a task execution system provided by an embodiment of the present application. The task execution system includes: a task scheduling module, an execution engine, a dynamic update module, an environment monitoring module, and a resource recovery module.
[0132] The task scheduling module is configured to obtain a first topological sorting in response to a first user account entering the live broadcast room, where the first topological sorting includes N information processing tasks, and the N information processing tasks are configured to display a user interface corresponding to the live broadcast room on a terminal device of the first user account, where N is a positive integer.
[0133] The execution engine is used to execute N information processing tasks based on the first topological sorting;
[0134] The dynamic update module is configured to adjust the first topological sorting to obtain a second topological sorting if a first condition is satisfied during the execution of the N information processing tasks, wherein the first condition is determined based on a device environment of the terminal device and / or behavioral data of the first user account;
[0135] The execution engine is further configured to execute unexecuted information processing tasks among the N information processing tasks based on the second topological sorting.
[0136] The dynamic update module is used to determine the adjustment strategies corresponding to the unexecuted information processing tasks among the N information processing tasks when the first condition is met. The adjustment strategies are used to adjust the execution timing and / or dependency relationship of the unexecuted information processing tasks; the first topological sorting is adjusted based on the adjustment strategies corresponding to the unexecuted information processing tasks to obtain a second topological sorting.
[0137] In some embodiments, the adjustment strategy includes one or more of the following:
[0138] Delay adjustment strategy, used to delay the execution of unexecuted information processing tasks;
[0139] A synchronization adjustment strategy is used to adjust the dependency between the unexecuted information processing task and other information processing tasks in the N information processing tasks except the unexecuted information processing task;
[0140] Cancellation strategy, used to cancel unexecuted information processing tasks.
[0141] In some embodiments, if the adjustment policies corresponding to the unexecuted information processing tasks are all cancellation policies, the resource recovery module is used to recover unoccupied resources from the resources allocated to the N information processing tasks.
[0142] In some embodiments, the first condition includes at least one of the following:
[0143] One or more parameters in the device environment reach preset thresholds;
[0144] The behavioral data includes the behavior of the first user account canceling entry into the live broadcast room.
[0145] In some embodiments, the environment monitoring module is used to monitor the device environment of the terminal device, and the device environment includes one or more of the following parameters: network status, device power, and central processing unit CPU load; obtain the behavior data of the first user account, and the behavior data is used to record the operations of the first user account during the execution of N information processing tasks.
[0146] In some embodiments, the execution engine is used to execute the synchronous task of the first information processing task in the first topological sorting through the main thread, where the first information processing task is any one of the N information processing tasks executed through the main thread; and execute the asynchronous task of the first information processing task through the child thread.
[0147] In some embodiments, the child thread is determined from a preconfigured thread pool, and the size of the thread pool is dynamically adjusted based on the device environment of the terminal device.
[0148] In some embodiments, the execution engine is used to obtain the task status of the asynchronous task through the state synchronizer after the child thread completes the execution of the asynchronous task; and schedule the main thread to confirm the completion of the asynchronous task based on the task status.
[0149] In some embodiments, the first topological ordering and the second topological ordering are in the form of DAGs.
[0150] In some embodiments, the task orchestration module is used to obtain N information processing tasks; orchestrate the execution order and dependencies of the N information processing tasks through a declarative chained application programming interface API; and determine a first topological sorting based on the execution order and dependencies of the N information processing tasks.
[0151] The technical solution provided by the embodiments of this application can dynamically adjust a first topological sorting during the execution of N information processing tasks based on the device environment of the terminal device and / or the behavioral data of the first user account to obtain a second topological sorting, and then execute the unexecuted information processing tasks among the N information processing tasks based on the second topological sorting. This solution supports dynamic adjustment of the execution timing and / or dependencies of information processing tasks, as well as cancellation of information processing tasks, and can adapt to dynamic demand scenarios.
[0152] In addition, this application adopts dynamic task orchestration with declarative chain API, which explicitly defines complex task dependencies through APIs such as before(), after(), with(), and supports dynamic insertion, parallel execution, and delayed triggering at runtime. Moreover, asynchronous state drive and thread collaborative optimization are designed to design a unified callback mechanism to achieve automatic synchronization of asynchronous task states and support seamless switching of multiple threads. Furthermore, environment-adaptive execution control dynamically adjusts task execution strategies (such as delay time and priority) based on environmental data (such as network status and device load). Finally, the resource recovery and task cancellation mechanism has built-in cancellation and resource recovery logic to support active task cancellation and resource recovery during abnormal interruption.
[0153] Next, the technical solution of the embodiment of the present application will be exemplified by the scenario of the first user account accessing the live broadcast room. Among them, N information processing tasks include:
[0154] Live broadcast room initialization task (T1): responsible for environment initialization and synchronous execution;
[0155] Network detection task (T2): responsible for checking the current network status. If it is mobile data, a pop-up window will pop up to indicate the data usage and execute it synchronously.
[0156] Live broadcast room information task (T3): obtains the information of the current live broadcast room host, such as avatar, nickname, etc., and is executed asynchronously;
[0157] Stream information task (T4): obtains the address, video type, etc. of the current live broadcast room information stream and executes asynchronously;
[0158] Live broadcast room audience list task (T5): obtains the audience information of the current live broadcast room and executes asynchronously.
[0159] The first topological sorting design is as follows Figure 5 As shown, the live broadcast room initialization task (T1) and the network detection task (T2) are first executed, and then the live broadcast room information task (T3) and the stream information task (T4) are executed in parallel. After the live broadcast room information task (T3) is executed, the live broadcast room audience list task (T5) is executed.
[0160] When the network status of the first user account is not good, such as Figure 6 As shown, the parallel execution of the live broadcast room information task (T3) and the stream information task (T4) is changed to executing the stream information task (T4) first, then executing the live broadcast room information task (T3), and then executing the live broadcast room audience list task (T5).
[0161] In addition, the execution time of the live broadcast room audience list task (T5) can be delayed according to the CPU utilization rate of the terminal device of the first user account, network status and other information. Figure 5 Based on the process shown, the execution time of the live broadcast room audience list task (T5) is delayed by 2s.
[0162] Taking the live broadcast room audience list task (T5) as an example, the delay adjustment strategy can be designed as follows:
[0163] The default execution delay of the Live Room Audience List Task (T5) is 0 seconds, that is, it will be executed immediately after its predecessor task is completed;
[0164] Check CPU utilization. If the CPU utilization is greater than 35%, the delay time increases by 2 seconds.
[0165] Check the network status. If the current network environment is weak, the delay time will be increased by 2 seconds.
[0166] Taking the live broadcast room information task (T3) and the stream information task (T4) as examples, the synchronization adjustment strategy can be designed as follows:
[0167] By default, the live broadcast room information task (T3) and the stream information task (T4) are executed in parallel;
[0168] Get the current network status. If it is neither Wi-Fi nor 5G, dynamically adjust to execute the stream information task (T4) first, and then execute the live broadcast room information task (T3).
[0169] About task execution and interruption:
[0170] Call the execution engine's start to execute tasks in the DAG order after task scheduling;
[0171] When a task should be exited abnormally (for example, the first user account actively exits the live broadcast room while entering the live broadcast room), the release of player resources and the cancellation of asynchronous tasks are called to avoid resource leakage.
[0172] The technical solution of the embodiment of the present application can achieve the following technical effects: dynamic task scheduling with declarative chain APIs, explicitly defining complex task dependencies through APIs such as before(), after(), with(), and supporting dynamic insertion, parallel execution, and delayed triggering at runtime. Asynchronous state drive and thread collaborative optimization, design of a unified callback mechanism, automatic synchronization of asynchronous task states, and support for seamless switching of multiple threads. Environmental adaptive execution control, dynamically adjusting task execution strategies (such as delay time, priority) based on environmental data (such as network status, device load). Resource recovery and task cancellation mechanism, built-in cancellation and resource recovery logic, supporting active task cancellation and resource recovery during abnormal interruption.
[0173] The following are device embodiments of the present application, which can be used to implement the method embodiments of the present application. For details not disclosed in the device embodiments of the present application, please refer to the method embodiments of the present application.
[0174] Please refer to Figure 7 , which shows a block diagram of a control device for a three-dimensional model provided by an embodiment of the present application. The device has the function of implementing the above method example, and the function can be implemented by hardware or by hardware executing corresponding software. The device can be the computer device described above, or it can be set in a computer device. Figure 7 As shown, the apparatus 700 may include: an acquisition module 710 , a first execution module 720 , an adjustment module 730 and a second execution module 740 .
[0175] Acquisition module 710 is used to obtain a first topological sorting in response to a first user account entering the live broadcast room. The first topological sorting includes N information processing tasks. The N information processing tasks are used to display the user interface corresponding to the live broadcast room on the terminal device of the first user account, and N is a positive integer.
[0176] The first execution module 720 is configured to execute the N information processing tasks based on the first topological sorting.
[0177] The adjustment module 730 is used to adjust the first topological sorting to obtain a second topological sorting if a first condition is met during the execution of the N information processing tasks. The first condition is determined based on the device environment of the terminal device and / or the behavioral data of the first user account.
[0178] The second execution module 740 is configured to execute unexecuted information processing tasks among the N information processing tasks based on the second topological sorting.
[0179] In some embodiments, the adjustment module 730 is used to determine the adjustment strategies corresponding to the unexecuted information processing tasks among the N information processing tasks when the first condition is met, and the adjustment strategies are used to adjust the execution timing and / or dependency relationship of the unexecuted information processing tasks; and adjust the first topological sorting based on the adjustment strategies corresponding to the unexecuted information processing tasks to obtain the second topological sorting.
[0180] In some embodiments, the adjustment strategy includes one or more of the following:
[0181] a delay adjustment strategy for delaying the execution timing of the unexecuted information processing task;
[0182] a synchronization adjustment strategy for adjusting the dependency relationship between the unexecuted information processing task and other information processing tasks among the N information processing tasks except the unexecuted information processing task;
[0183] A cancellation strategy is used to cancel the execution of the unexecuted information processing task.
[0184] In some embodiments, if the adjustment strategies corresponding to the unexecuted information processing tasks are all the cancellation strategies, the apparatus 700 further includes a recycling module (not shown in the figure).
[0185] The recycling module is used to recycle the resources allocated to the N information processing tasks.
[0186] In some embodiments, the first condition includes at least one of the following:
[0187] One or more parameters in the device environment reach a preset threshold;
[0188] The behavior data includes the behavior of the first user account canceling entry into the live broadcast room.
[0189] In some embodiments, the device 700 further includes an environment monitoring module (not shown).
[0190] The environment monitoring module is used to monitor the device environment of the terminal device, and the device environment includes one or more of the following parameters: network status, device power, and central processing unit CPU load; obtain the behavior data of the first user account, and the behavior data is used to record the operations of the first user account during the execution of the N information processing tasks.
[0191] In some embodiments, the first execution module 720 is used to execute a synchronous task of the first information processing task in the first topological sorting through a main thread, where the first information processing task is any one of the N information processing tasks executed through the main thread; and to execute an asynchronous task of the first information processing task through a child thread.
[0192] In some embodiments, the child thread is determined from a preconfigured thread pool, and the size of the thread pool is dynamically adjusted based on the device environment of the terminal device.
[0193] In some embodiments, the first execution module 720 is further used to obtain the task status of the asynchronous task through the state synchronizer after the child thread completes the execution of the asynchronous task; and schedule the main thread based on the task status to confirm the completion of the execution of the asynchronous task.
[0194] In some embodiments, the first topological ordering and the second topological ordering are in the form of a directed acyclic graph (DAG).
[0195] In some embodiments, the acquisition module 710 is used to obtain the N information processing tasks; arrange the execution order and dependencies of the N information processing tasks through a declarative chain application programming interface API; and determine the first topological sorting based on the execution order and dependencies of the N information processing tasks.
[0196] The technical solution provided by the embodiments of this application can dynamically adjust a first topological sorting during the execution of N information processing tasks based on the device environment of the terminal device and / or the behavioral data of the first user account to obtain a second topological sorting, and then execute the unexecuted information processing tasks among the N information processing tasks based on the second topological sorting. This solution supports dynamic adjustment of the execution timing and / or dependencies of information processing tasks, as well as cancellation of information processing tasks, and can adapt to dynamic demand scenarios.
[0197] Please refer to Figure 8 , which shows a schematic diagram of the structure of a computer device provided by an embodiment of the present application. The computer device may be Figure 1 The terminal device 100 in the implementation environment shown can also be Figure 1 The server 200 in the implementation environment shown is used to implement the task execution method provided in the above embodiment. Specifically:
[0198] Typically, the terminal device 800 includes a processor 801 and a memory 802 .
[0199] The processor 801 may include one or more processing cores, such as a 4-core processor, an 8-core processor, etc. The processor 801 may be implemented in at least one hardware form of DSP (Digital Signal Processing), FPGA (Field Programmable Gate Array), or PLA (Programmable Logic Array). The processor 801 may also include a main processor and a coprocessor. The main processor is a processor for processing data in the awake state, also known as a CPU (Central Processing Unit); the coprocessor is a low-power processor for processing data in the standby state. In some embodiments, the processor 801 may be integrated with a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the display screen. In some embodiments, the processor 801 may also include an AI (Artificial Intelligence) processor, which is used to process computing operations related to machine learning.
[0200] The memory 802 may include one or more computer-readable storage media, which may be non-transitory. The memory 802 may also include high-speed random access memory and non-volatile memory, such as one or more magnetic disk storage devices or flash memory storage devices. In some embodiments, the non-transitory computer-readable storage media in the memory 802 is used to store a computer program, which is configured to be executed by one or more processors to implement the above-described task execution method.
[0201] In some embodiments, terminal device 800 may optionally include a peripheral device interface 803 and at least one peripheral device. The processor 801, memory 802, and peripheral device interface 803 may be connected via a bus or signal lines. Each peripheral device may be connected to peripheral device interface 803 via a bus, signal lines, or circuit boards. Specifically, the peripheral device may include at least one of a radio frequency circuit 804, a display screen 805, an audio circuit 807, and a power supply 808.
[0202] Those skilled in the art will understand that Figure 8 The structure shown in the figure does not constitute a limitation on the terminal device 800, and the terminal device 800 may include more or fewer components than shown in the figure, or combine certain components, or adopt a different component arrangement.
[0203] In an exemplary embodiment, a computer-readable storage medium is further provided, wherein the storage medium stores a computer program, and the computer program implements the above-mentioned task execution method when executed by a processor of a computer device.
[0204] Optionally, the computer-readable storage medium may include: ROM (Read-Only Memory), RAM (Random-Access Memory), SSD (Solid State Drives), or an optical disk, etc. Among them, the random access memory may include ReRAM (Resistance Random Access Memory) and DRAM (Dynamic Random Access Memory).
[0205] In an exemplary embodiment, a computer program product is also provided, the computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the above-mentioned task execution method.
[0206] It should be noted that before collecting the user's relevant data and during the process of collecting the user's relevant data, this application can display a prompt interface, pop-up window or output voice prompt information. The prompt interface, pop-up window or voice prompt information is used to remind the user that its relevant data is currently being collected, so that this application only starts to execute the relevant steps of obtaining the user's relevant data after obtaining the user's confirmation operation on the prompt interface or pop-up window. Otherwise (that is, when the user's confirmation operation on the prompt interface or pop-up window is not obtained), the relevant steps of obtaining the user's relevant data are terminated, that is, the user's relevant data is not obtained. In other words, all user data collected by this application (including the behavioral data of the first user account, the device environment of the terminal device, etc.) are processed strictly in accordance with the requirements of relevant national laws and regulations. The informed consent or separate consent of the personal information subject is obtained only when the user agrees and authorizes it to be collected, and the subsequent data use and processing behavior is carried out within the scope of authorization of laws and regulations and the personal information subject. The collection, use and processing of relevant user data must comply with the relevant laws, regulations and standards of relevant countries and regions.
[0207] It should be understood that the term "plurality" used herein refers to two or more. "And / or" describes a relationship between associated objects, indicating that three possible relationships exist. For example, "A and / or B" can mean: A exists alone, A and B exist simultaneously, or B exists alone. The character " / " generally indicates an "or" relationship between the associated objects.
[0208] The above description is merely an exemplary embodiment of the present application and is not intended to limit the present application. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present application shall be included in the scope of protection of the present application.
Claims
1. A task execution method, characterized in that: The method comprises: In response to a first user account entering a live broadcast room, obtaining a first topological sorting, where the first topological sorting includes N information processing tasks, and the N information processing tasks are used to display a user interface corresponding to the live broadcast room on a terminal device of the first user account, where N is a positive integer; Based on the first topological sorting, executing the N information processing tasks; During the execution of the N information processing tasks, if a first condition is satisfied, adjusting the first topological sorting to obtain a second topological sorting, wherein the first condition is determined based on the device environment of the terminal device and / or the behavior data of the first user account; Based on the second topological sorting, unexecuted information processing tasks among the N information processing tasks are executed.
2. The method according to claim 1, characterized in that If the first condition is met, adjusting the first topological sorting to obtain a second topological sorting includes: When the first condition is met, determining adjustment strategies corresponding to the unexecuted information processing tasks among the N information processing tasks, wherein the adjustment strategies are used to adjust the execution timing and / or dependency relationship of the unexecuted information processing tasks; The first topological sorting is adjusted based on the adjustment strategies corresponding to the unexecuted information processing tasks to obtain the second topological sorting.
3. The method according to claim 2, characterized in that The adjustment strategy includes one or more of the following: a delay adjustment strategy for delaying the execution timing of the unexecuted information processing task; a synchronization adjustment strategy for adjusting the dependency relationship between the unexecuted information processing task and other information processing tasks among the N information processing tasks except the unexecuted information processing task; A cancellation strategy is used to cancel the execution of the unexecuted information processing task.
4. The method according to claim 3, characterized in that If the adjustment strategies corresponding to the unexecuted information processing tasks are all the cancellation strategies, the method further includes: The resources allocated to the N information processing tasks are recovered.
5. The method according to any one of claims 1 to 4, characterized in that The first condition includes at least one of the following: One or more parameters in the device environment reach a preset threshold; The behavior data includes the behavior of the first user account canceling entry into the live broadcast room.
6. The method according to claim 5, characterized in that The method further comprises: Monitoring the device environment of the terminal device, wherein the device environment includes one or more of the following parameters: network status, device power, and central processing unit (CPU) load; Behavior data of the first user account is obtained, where the behavior data is used to record operations of the first user account during the execution of the N information processing tasks.
7. The method according to any one of claims 1 to 6, characterized in that The executing the N information processing tasks based on the first topological sorting includes: For a first information processing task in the first topological sorting, executing a synchronization task of the first information processing task through a main thread, where the first information processing task is any one of the N information processing tasks executed through the main thread; The asynchronous task of executing the first information processing task is performed by a child thread.
8. The method according to claim 7, characterized in that The child thread is determined from a preconfigured thread pool, and the size of the thread pool is dynamically adjusted based on the device environment of the terminal device.
9. The method according to claim 7 or 8, characterized in that The method further comprises: After the child thread completes executing the asynchronous task, obtaining the task status of the asynchronous task through a state synchronizer; The main thread is scheduled based on the task status to confirm that the asynchronous task is completed.
10. The method according to any one of claims 1 to 9, characterized in that The first topological sorting and the second topological sorting are in the form of directed acyclic graphs (DAGs).
11. The method according to any one of claims 1 to 10, characterized in that The obtaining of the first topological sorting includes: Obtaining the N information processing tasks; Arrange the execution order and dependency relationships of the N information processing tasks through a declarative chained application programming interface (API); The first topological sorting is determined based on the execution order and dependency relationship of the N information processing tasks.
12. A computer device, characterized in that: The computer device includes a processor and a memory, wherein a computer program is stored in the memory, and the computer program is loaded and executed by the processor to implement the task execution method according to any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the task execution method according to any one of claims 1 to 11.
14. A computer program product, characterized in that The computer program product comprises a computer program, which is loaded and executed by a processor to implement the task execution method according to any one of claims 1 to 11.