Task processing method, device, terminal and storage medium

By generating scheduling instance allocation and monitoring worker threads, and optimizing task processing, the problem of insufficient thread allocation when the terminal is in large tasks is solved, and processing efficiency and fault tolerance are improved.

CN112363834BInactive Publication Date: 2024-11-19CHINA PING AN LIFE INSURANCE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202011249736.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-11-10
Publication Date
2024-11-19
Estimated Expiration
Not applicable · inactive patent

AI Technical Summary

Technical Problem

When there are many tasks, the terminal cannot allocate enough threads for processing, resulting in low task processing efficiency and prone to thread blockage, especially when multiple threads are running for a long time, the terminal load is increased.

Method used

By generating scheduling instances, the worker threads are allocated and monitored, the task is processed, the task is processed, the exception tasks are determined, and the processing strategy is formulated based on the worker thread load value, and the task allocation and processing are optimized.

Benefits of technology

It improves the efficiency and fault tolerance of task processing, ensures that tasks can be processed in a timely manner, and reduces the occurrence of thread blockage.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112363834B_ABST
    Figure CN112363834B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a task processing method, device, terminal and storage medium, wherein the method includes receiving at least one task, generating a scheduling instance according to the at least one task, allocating a corresponding work thread to each task in the at least one task based on the scheduling instance, and monitoring the processing progress of each work thread on the task based on the scheduling instance to obtain the processing progress for each task; if it is determined that there is an abnormal task in at least one task based on the processing progress of each task, then determining the load value of each work thread based on the scheduling instance, and determining the target processing strategy for the abnormal task according to the load value of each work thread; processing the abnormal task according to the target processing strategy to obtain the processing result for the abnormal task. The generated scheduling instance is used to realize the allocation and monitoring of tasks, and a strategy is formulated in time to process the abnormal tasks, thereby improving the efficiency and fault tolerance of task processing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of load allocation, and in particular to a task processing method, device, terminal and storage medium. Background Art

[0002] A worker thread is the smallest unit that the operating system can schedule operations on. A worker thread refers to a single sequential control flow. A terminal (mobile phone, computer, host, etc.) can include multiple worker threads. When a terminal receives a task, it can assign the task to a worker thread, so that the worker thread processes the task and obtains the task processing result.

[0003] Currently, when a terminal receives a task, a working thread is assigned to the task, that is, for N tasks, N threads need to be assigned to process them. Since the number of threads in the terminal is limited, when there are many tasks, the terminal cannot assign enough threads to process the tasks, which will cause some tasks to not be processed in time. When the terminal runs multiple threads for a long time, the load on the terminal will increase, and when abnormal tasks occur, it is easy to cause thread congestion, and the task processing efficiency is low. Summary of the invention

[0004] The embodiments of the present invention provide a task processing method, device, terminal and storage medium, which can realize task allocation and monitoring based on the generated scheduling instance, thereby improving the efficiency and fault tolerance of task processing.

[0005] In one aspect, an embodiment of the present invention provides a task processing method, the method comprising:

[0006] receiving at least one task, and generating a scheduling instance according to the at least one task;

[0007] Allocate a corresponding work thread to each task in the at least one task based on the scheduling instance, so that each work thread processes the corresponding task in the at least one task;

[0008] Based on the scheduling instance, monitoring the processing progress of the tasks by the respective working threads, and obtaining the processing progress for each task;

[0009] If it is determined based on the processing progress of each task that there is an abnormal task in the at least one task, then determining the load value of each work thread based on the scheduling instance, and determining a target processing strategy for the abnormal task according to the load value of each work thread;

[0010] The abnormal task is processed according to the target processing strategy to obtain a processing result for the abnormal task.

[0011] In one aspect, an embodiment of the present invention provides a task processing device, the device comprising:

[0012] A receiving module, used for receiving at least one task;

[0013] A generating module, configured to generate a scheduling instance according to the at least one task;

[0014] an allocation module, configured to allocate a corresponding work thread to each task in the at least one task based on the scheduling instance, so that each work thread processes a corresponding task in the at least one task;

[0015] A monitoring module, used to monitor the processing progress of the tasks by the various working threads based on the scheduling instance, and obtain the processing progress for each task;

[0016] A determination module, configured to determine a load value of each work thread based on the scheduling instance if it is determined based on the processing progress of each task that there is an abnormal task in the at least one task, and determine a target processing strategy for the abnormal task according to the load value of each work thread;

[0017] A processing module is used to process the abnormal task according to the target processing strategy to obtain a processing result for the abnormal task.

[0018] On the one hand, an embodiment of the present invention provides a terminal, including a processor, an input interface, an output interface and a memory, wherein the processor, input interface, output interface and memory are interconnected, wherein the memory is used to store a computer program, the computer program includes program instructions, and the processor is configured to call the program instructions to execute the task processing method.

[0019] On the one hand, an embodiment of the present invention provides a computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program, the computer program includes program instructions, and when the program instructions are executed by a processor, the processor executes the task processing method.

[0020] In an embodiment of the present invention, a terminal receives at least one task, and generates a scheduling instance according to at least one task. The terminal allocates a corresponding work thread to each task in the at least one task based on the scheduling instance, and monitors the processing progress of each work thread on the task based on the scheduling instance to obtain the processing progress of each task; if it is determined that there is an abnormal task in at least one task based on the processing progress of each task, the terminal determines the load value of each work thread based on the scheduling instance, and determines the target processing strategy for the abnormal task according to the load value of each work thread; the terminal processes the abnormal task according to the target processing strategy to obtain the processing result for the abnormal task. The generated scheduling instance is used to realize the allocation and monitoring of tasks, and a strategy is formulated in time to process abnormal tasks, thereby improving the efficiency and fault tolerance of task processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without paying any creative work.

[0022] Figure 1 It is a flowchart of a task processing method provided by an embodiment of the present invention;

[0023] Figure 2 is a flowchart of another task processing method provided by an embodiment of the present invention;

[0024] Figure 3 is a structural schematic diagram of a task processing device provided by an embodiment of the present invention;

[0025] Figure 4 It is a schematic diagram of the structure of a terminal provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0026] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0027] The task processing method provided in the embodiment of the present invention is implemented in a terminal, and the terminal includes electronic devices such as a smart phone, a tablet computer, a digital audio and video player, an electronic reader, a handheld game console, or a vehicle-mounted electronic device.

[0028] Figure 1is a flowchart of a task processing method in an embodiment of the present invention, such as Figure 1 As shown, the process of the task processing method in this embodiment may include:

[0029] S101. A terminal receives at least one task, and generates a scheduling instance according to the at least one task.

[0030] In the embodiment of the present invention, the terminal may receive at least one task, and each task may be generated based on an operation input by a user in the terminal, or may be sent by other devices, and the terminal receives the task.

[0031] Further, the terminal can store the above-mentioned at least one task in a database, wherein the database can specifically store the above-mentioned at least one task in a queue manner, and the queue can be such as a kafka queue. Since the task is stored in the database after receiving the task, the tasks input by the user can be received in large quantities, so that the user does not need to wait for the previous task to be processed before inputting the task, thereby realizing the dynamic addition of tasks and improving the flexibility of the task addition process. It should be noted that each task in the at least one task can correspond to a different type. After receiving each task, the terminal can determine the type corresponding to each task, and determine the storage area of ​​each task in the database based on the type of each task. The terminal stores each task in the database according to the storage area of ​​each task in the database, so that the scheduling instance obtains at least one task from the database and completes the allocation of at least one task. Among them, the type of the task can be a calculation type, a query type or a detection type. The specific way for the terminal to determine the type of the task can be to determine based on the keywords in the task. For example, if the keyword "calculation" exists in the task, the task is determined to be a calculation type, or the terminal can also determine the type of the task based on the format type of the data in the task, or the task received by the terminal contains a type tag in advance, and the terminal determines the type of each task based on the type tag. Optionally, the type of task is determined based on the number of splittable nodes in the task, wherein splitting the task at a splittable node can obtain two subtasks corresponding to the task. In this way, the type of task can be determined as an indivisible type and a type that can be split N times, where N is an integer. By using the above differentiated regional storage, after determining the processing priority and processing method of each task, the corresponding task can be directly obtained from the corresponding area, thereby improving the efficiency of task acquisition.

[0032] Furthermore, the terminal can generate a scheduling instance based on the at least one task, wherein the scheduling instance can occupy a working thread in the terminal, and is specifically used to allocate the at least one task, so that each working thread in the terminal receives the corresponding task and processes the received task. Each working thread can have a different load capacity. A working thread with a high load capacity can process tasks with a larger amount of tasks, or can process multiple tasks with smaller amounts of tasks at the same time.

[0033] The specific method for the terminal to generate a scheduling instance based on at least one task can be that the terminal obtains the number of tasks stored in the database, and selects a corresponding number of working threads from at least one working thread based on the corresponding relationship between the number and the working thread, and establishes a scheduling instance in the working thread, wherein the larger the number, the higher the load capacity corresponding to the working thread, that is, when there are many tasks, a scheduling instance is generated in a working thread with a large load capacity to complete the distribution of tasks, and when there are few tasks, a scheduling instance is generated in a working thread with a small load capacity to complete the distribution of tasks. The above method can better select working threads, so that the performance of working threads in the terminal can be fully utilized.

[0034] S102: The terminal allocates a corresponding work thread to each task in at least one task based on the scheduling instance, so that each work thread processes the at least one task.

[0035] In the embodiment of the present invention, after the terminal generates a scheduling instance according to at least one task, a corresponding working thread may be allocated to each task in the at least one task based on the scheduling instance, so that each working thread processes the at least one task.

[0036] In one implementation, different types of tasks have different storage areas in the database, and each storage area may correspond to one or more work threads. The specific method in which the terminal assigns a corresponding work thread to each task in at least one task based on the scheduling instance may be that the terminal obtains the target task stored in the target storage area in the database, and assigns the target task to the target work thread corresponding to the target storage area, so that the target work thread processes the target task stored in the target storage area. For example, storage area 1 in the database corresponds to work thread 1, and task 1 is stored in storage area 1. Then the scheduling instance can obtain task 1 from storage area 1, and assign task 1 to work thread 1, so that work thread 1 processes task 1.

[0037] In one implementation, the specific method of assigning a corresponding work thread to each task in at least one task based on the scheduling instance can be that the terminal obtains the residual load value corresponding to each work thread in at least one work thread, and preprocesses at least one task according to the residual load value of each work thread to obtain multiple preprocessing tasks, the task amount of each preprocessing task corresponds to the residual load value of each work thread, and the preprocessing method includes splitting processing or merging processing. The terminal determines the work thread corresponding to each preprocessing task based on the principle of matching the task amount with the residual load value, and assigns each preprocessing task in the multiple preprocessing tasks to the corresponding work thread based on the scheduling instance. For example, the residual load value of work thread 1 is 100, the task amount of task 1 is 50, and the task amount of task 2 is 40, then the terminal can assign task 1 and task 2 to work thread 1 after merging. Among them, when the task amount is less than the residual load value, and the difference between the residual load value and the task amount is less than the preset difference, it can be considered that the residual load value matches the task amount.

[0038] It should be noted that the specific method for the terminal to preprocess at least one task according to the residual load value of each work thread can be that the terminal obtains the target work thread and the target residual load value corresponding to the target work thread, and detects whether there is a target task amount matching the target residual load value in the task amount corresponding to each task. If so, the task corresponding to the target task amount is determined as the task corresponding to the target work thread. If not, multiple tasks are selected from at least one task, and the multiple tasks are merged so that the task amount of the merged multiple tasks matches the target residual load value, and the multiple tasks are determined as the preprocessing tasks corresponding to the target work thread; or, the terminal selects a task from at least one task, splits the task, so that the task amount of the target subtask in the multiple subtasks obtained by splitting matches the target residual load value, and the target subtask is determined as the preprocessing task corresponding to the target work thread. Among them, the target work thread can be any one of the at least one work thread.

[0039] In one implementation, a specific method for the terminal to allocate a corresponding work thread to each task in at least one task based on a scheduling instance may be that the terminal determines a first number of idle work threads and a second number of at least one task based on the scheduling instance; if the first number is greater than the second number, M tasks are selected from at least one task for splitting processing to obtain a first number of split tasks, and the first number of split tasks are allocated to the corresponding idle work threads based on the scheduling instance; if the first number is less than the second number, K tasks are selected from at least one task for merging processing to obtain a first number of merged tasks, and the first number of merged tasks are allocated to the corresponding idle work threads based on the scheduling instance, wherein K and M are positive integers, and the load value of the idle work thread is less than the preset load value.

[0040] Specifically, the terminal determines the number of idle working threads based on the scheduling instance, and determines the preprocessing strategy for at least one task according to the number of idle working threads, and preprocesses at least one task according to the preprocessing strategy to obtain multiple preprocessing tasks; the terminal allocates each preprocessing task in the multiple preprocessing tasks to the corresponding working thread based on the scheduling instance. Wherein, the preprocessing strategy includes merging or splitting, and the load value of the idle working thread is less than the preset load value. The specific manner in which the terminal determines the preprocessing strategy for at least one task based on the number of idle working threads can be that the terminal detects the size relationship between the number of idle working threads and the number of tasks of at least one task. If the number of idle working threads is greater than the number of tasks, the terminal determines the preprocessing strategy to split the M tasks with a larger task volume in at least one task, so that the number of preprocessing tasks obtained by the splitting process is the same as the number of idle working threads, and M can be the difference between the number of idle working threads and the number of tasks. Alternatively, if the number of idle working threads is less than the number of tasks, the terminal determines the preprocessing strategy to merge the K tasks with a smaller task volume in at least one task, so that the number of preprocessing tasks obtained by the merged process is the same as the number of idle working threads, and K can be the difference between the number of tasks and the number of idle working threads. Furthermore, the scheduling instance can allocate each preprocessing task in multiple preprocessing tasks to the corresponding work thread based on the load balancing principle. The load balancing principle refers to the principle of achieving a relatively balanced load value for each work thread. The load value here can be used to represent the ratio between the current load and the maximum load, which can also be called the load rate. The load balancing principle may include but is not limited to: the ratio between the current load value and the load capacity of each work thread is less than a preset threshold, and the preset threshold here can be set according to actual conditions, such as 50%, 60%, etc.; or, the ratio between the current load value and the load capacity of each work thread tends to be equal; and so on.

[0041] S103: The terminal monitors the processing progress of each working thread for at least one task based on the scheduling thread, and obtains the processing progress for each task.

[0042] In the embodiment of the present invention, after the terminal allocates a corresponding work thread to each task in at least one task based on the scheduling instance, the terminal can monitor the processing progress of each work thread for at least one task based on the scheduling thread to obtain the processing progress for each task.

[0043] In a specific implementation, the terminal can call the scheduling instance to send a progress query instruction to each work thread when the monitoring condition is met. The progress query instruction is used to obtain the processing progress of each work thread on at least one task. Further, the terminal calls the scheduling instance to receive the progress information returned by each work thread, and updates the work thread status table recorded in the scheduling instance based on the progress information. The work thread status table records the current processing progress of each work thread on the task. The terminal queries the processing progress of each work thread on at least one task from the updated work thread status table. Among them, when the monitoring cycle arrives, it can be determined that the monitoring condition is met, that is, the terminal regularly calls the scheduling instance to send a progress query instruction to each work thread. The monitoring cycle can be pre-set by the R&D personnel, or determined by the number of work threads currently processing the task, that is, the number of work threads processing the task has a corresponding relationship with the monitoring cycle, which can be an inverse relationship, that is, the more the number of work threads currently processing the task, the shorter the monitoring cycle, that is, the fewer the number of work threads currently processing the task, the longer the monitoring cycle, so that the processing progress of the task can be monitored in time and the waste of monitoring resources is avoided. Alternatively, the terminal can also determine that the monitoring condition is met when receiving the monitoring instruction. The progress information specifically indicates the processing time for the task returned by each work thread, the amount of tasks that have been processed, the amount of tasks remaining to be completed, the processing progress, etc. The work thread status table may specifically include the current processing progress of each task in at least one task, and the processing progress includes the task completion rate and processing time. For example, at least one task includes task 1, task 2, and task 3. Task 1 and task 2 are combined to obtain pre-processing task 1, which is then processed by work thread 1, and task 3 is processed by work thread 2. Then, the processing progress for task 1 returned by work thread 1 is 45%, 20 seconds, the processing progress for task 2 is 50%, 15 seconds, and the processing progress for task 3 returned by work thread 2 is 80%, 15 seconds. The scheduling instance updates the work thread status table based on the above information, and the updated work thread status table is shown in Table 1.

[0044] Table 1

[0045]

[0046] S104: If it is determined based on the processing progress of each task that there is an abnormal task in at least one task, the terminal determines the load value of each work thread based on the scheduling instance, and determines a target processing strategy for the abnormal task according to the load value of each work thread.

[0047] In an embodiment of the present invention, after the terminal obtains the processing progress for each task, it can detect whether there is an abnormal task in at least one task based on the processing progress of each task. If there is an abnormal task, the load value of each working thread is determined based on the scheduling instance, and the target processing strategy for the abnormal task is determined according to the load value of each working thread.

[0048] Specifically, the specific method for determining an abnormal task can be that the terminal obtains the task type corresponding to the target task and determines the average processing time corresponding to the task type. The target task is any one of the at least one task. The terminal calculates the difference between the target processing time for the target task indicated in the processing progress and the average processing time. If the difference is greater than the preset difference, the target task is determined to be an abnormal task. Alternatively, the terminal obtains the work thread status table at different time nodes of the history and records. When the processing progress for the target task recorded multiple times in the work thread status table is the same processing progress, the target task is determined to be an abnormal task. The abnormality is specifically the processing stagnation of the target task. Alternatively, the terminal obtains the average processing time corresponding to other tasks of the same type as the target task from the historical records, and detects the processing progress for the target task when the average processing time is reached. If the processing progress is less than the preset progress, the target task is determined to be an abnormal task. The target task can be any one or more of the at least one task.

[0049] Furthermore, the terminal determines the load value of each working thread based on the scheduling instance. In a specific implementation, the terminal can obtain the load value of each working thread from the dynamic load table recorded in the scheduling instance. The scheduling instance can manage and maintain a dynamic load table, which is shown in Table 2.

[0050] Table 2

[0051] Worker Threads Load value Worker Thread 1 45% Worker Thread 2 50% … … Worker Thread N 60%

[0052] As shown in Table 2 above, the dynamic load table records the load value of each working thread, for example: the load value of working thread 1 is 45%, the load value of working thread 2 is 50%, and the load value of working thread N is 60%. It should be noted that the data in Table 2 above changes in real time. In one embodiment, each working thread can report its own load value to the scheduling instance at a regular interval (every 2 seconds, every 5 seconds, etc.), and the scheduling instance determines whether the load value of each working thread has changed. If it has changed, the above Table 2 is updated in real time according to the reported data; in another embodiment, when the working thread self-checks and finds that its load value has changed, it reports the changed load value to the scheduling instance, and the scheduling instance updates the above Table 2 in real time according to the reported data.

[0053] Further, the target processing strategy for abnormal tasks is determined according to the load value of each work thread, wherein the target processing strategy can specifically indicate the target work thread used to process the abnormal task. In one implementation, the target work thread can be 1, and the terminal can select the work thread with the smallest load value from each work thread as the target work thread, and the target processing strategy determined by the terminal is to assign the abnormal task to the target work thread for processing. Optionally, there can be multiple target work threads, and the multiple target work threads can be work threads with load values ​​less than the preset load value, and the target processing strategy determined by the terminal can be to split the abnormal task into N abnormal subtasks, and assign each abnormal subtask to the corresponding target work thread.

[0054] S105. The terminal processes the abnormal task according to the target processing strategy to obtain a processing result for the abnormal task.

[0055] In the embodiment of the present invention, after the terminal determines the target processing strategy for the abnormal task, the abnormal task can be processed according to the target processing strategy to obtain a processing result for the abnormal task.

[0056] Specifically, the target processing strategy is to split the exception task into N exception subtasks, and assign the N exception subtasks to the corresponding N target working threads. The terminal can execute the target processing strategy and assign each exception subtask to the corresponding target working thread, so that each working thread processes the assigned exception subtask and returns the processing result of each exception subtask to the scheduling instance. The terminal obtains the processing result for each exception subtask from the scheduling instance, and detects whether each subtask has a corresponding subtask processing result. If so, the processing results of each exception subtask are merged to obtain the processing result for the exception task. If not, the terminal determines the target exception subtask that has not returned the processing result, and determines that the target exception subtask is the cause of the task processing exception. When the target exception subtask can be further split, the scheduling thread continues to process the target exception subtask after splitting. Through the above method, a feedback mechanism can be provided for abnormal tasks to obtain the corresponding processing results of abnormal tasks as much as possible. The cause of the task processing exception can also be determined more finely based on the processing results of the abnormal subtasks, so that the terminal can correct errors intelligently and process other tasks in time after processing the abnormal tasks, thereby improving the processing efficiency of tasks.

[0057] In an embodiment of the present invention, a terminal receives at least one task, and generates a scheduling instance according to at least one task. The terminal allocates a corresponding work thread to each task in the at least one task based on the scheduling instance, and monitors the processing progress of each work thread on the task based on the scheduling instance to obtain the processing progress of each task; if it is determined that there is an abnormal task in at least one task based on the processing progress of each task, the terminal determines the load value of each work thread based on the scheduling instance, and determines the target processing strategy for the abnormal task according to the load value of each work thread; the terminal processes the abnormal task according to the target processing strategy to obtain the processing result for the abnormal task. The generated scheduling instance is used to realize the allocation and monitoring of tasks, and a strategy is formulated in time to process abnormal tasks, thereby improving the efficiency and fault tolerance of task processing.

[0058] Figure 2 is a flowchart of a task processing method in an embodiment of the present invention, such as Figure 2 As shown, the process of the task processing method in this embodiment may include:

[0059] S201. A terminal receives at least one task and generates a scheduling instance according to the at least one task.

[0060] In an embodiment of the present invention, a terminal can receive at least one task, each task can be generated based on an operation input by a user in the terminal, or can also be sent by other terminals. The terminal receives the task. Further, the terminal can generate a scheduling instance based on the at least one task, wherein the scheduling instance can occupy a working thread in the terminal, specifically for allocating the at least one task, so that each working thread in the terminal receives the corresponding task and processes the received task.

[0061] S202: The terminal allocates a corresponding work thread to each task in at least one task based on the scheduling instance, so that each work thread processes the at least one task.

[0062] In the embodiment of the present invention, after the terminal generates a scheduling instance according to at least one task, a corresponding working thread may be allocated to each task in the at least one task based on the scheduling instance, so that each working thread processes the at least one task.

[0063] In one implementation scenario, the terminal can start a work thread pool in the scheduling instance, extract the tasks that need to be processed from the database, put them into the work thread pool, and further assign corresponding work threads to the tasks in the work thread pool for processing. The terminal can filter out a corresponding number of work threads according to the number of tasks that need to be processed, and the remaining work threads are placed in the work thread pool in a waiting state without occupying CPU resources. For example, if the scheduling instance learns from the database that there are three tasks to be executed, it will take out three work threads to set the tasks. If the task has not reached the execution time, it will enter the waiting state, otherwise it will assign the corresponding work thread to execute the task. The scheduling instance can occupy a work thread in the terminal. When the terminal detects that there are tasks stored in the database, it can create the scheduling instance.

[0064] In one implementation scenario, the scheduling instance determines the allocation method for tasks in the database based on the current running state of the terminal, wherein the running state may include the number of currently running work threads. Specifically, when the number of work threads running in the terminal is greater than a first preset number, that is, when it is relatively busy, the scheduling instance may detect whether there are tasks that can be merged in the database, and merge the tasks that can be merged, and when there is an idle work thread, assign the merged tasks to the idle work thread, so that one work thread can process multiple tasks, thereby improving the utilization rate of the work thread, wherein the merge rule may be based on merging based on the same task type, merging based on the same task source, etc. When the number of work threads running in the terminal is less than a second preset number, that is, when it is idle, the scheduling instance may detect whether there are tasks that can be split in the database, and split the tasks that can be split into multiple subtasks, and assign a work thread to each subtask, respectively, so that multiple work threads jointly process the task, thereby improving the processing efficiency of the task. When the number of work threads running in the terminal is between the first preset number and the second preset number, that is, under normal conditions, the running time can be configured separately for each task in the database, and the scheduling instance will assign a work thread to the task when the running time of the task is reached to process the task.

[0065] In one implementation scenario, there are differences in the work thread occupancy time (i.e., task processing time) corresponding to different types of tasks. Therefore, when the scheduling instance allocates work threads to tasks stored in the database, it can also allocate work threads to tasks based on the task type. For example, the average work thread occupancy time of query tasks is 1s, and the average work thread occupancy time of calculation tasks is 10s. When the scheduling instance detects that there are both query tasks and calculation tasks in the database, it will give priority to allocating work threads to query tasks, so that query tasks can get priority feedback and reduce the waiting time of query tasks. Among them, the task type can be determined by a special field in the task instruction. For example, if the instruction includes "retrieval", the task type is determined to be a query type, and if the instruction includes "calculate", the task type is determined to be a calculation type. The work thread occupancy time corresponding to each type can be determined by the work thread occupancy time for each type of task recorded in the historical records. Optionally, in order to make the occupied time of each work thread relatively balanced, for each task in the database, the scheduling instance can detect the task type of each task, and split the task corresponding to the task type of the work thread occupied time, and after obtaining multiple subtasks, assign a corresponding work thread to each subtask, and merge the processing results of each work thread as the processing result for the task. The above method can reduce the time that the terminal runs the work thread.

[0066] S203: The terminal monitors the processing progress of each working thread for at least one task based on the scheduling thread, and obtains the processing progress for each task.

[0067] In an embodiment of the present invention, after the terminal assigns a corresponding work thread to each task in at least one task based on a scheduling instance, the terminal can monitor the processing progress of each work thread for at least one task based on the scheduling thread to obtain the processing progress for each task. When the monitoring conditions are met, the terminal can call the scheduling instance to send a progress query instruction to each work thread, and the progress query instruction is used to obtain the processing progress of each work thread for at least one task. Further, the terminal calls the scheduling instance to receive the progress information returned by each work thread, and updates the work thread status table recorded in the scheduling instance based on the progress information. The work thread status table records the current processing progress of each work thread for the task. The terminal queries the processing progress of each work thread for at least one task from the updated work thread status table.

[0068] S204: If it is determined based on the processing progress of each task that there is an abnormal task in at least one task, the terminal determines the load value of each work thread based on the scheduling instance, and determines a target processing strategy for the abnormal task according to the load value of each work thread.

[0069] In one implementation, the specific method for determining an abnormal task may be that the terminal obtains the task type corresponding to the target task and determines the average processing time corresponding to the task type, the target task is any one of the at least one task, and the terminal calculates the difference between the target processing time for the target task indicated in the processing schedule and the average processing time, and if the difference is greater than a preset difference, the target task is determined to be an abnormal task. Alternatively, the terminal obtains the work thread status table at different time nodes of the history and records.

[0070] In one implementation, abnormal tasks can also be determined based on feedback from working threads. For example, when a working thread fails to process a task, the task is determined to be abnormal, or when multiple different working threads fail to process a task (i.e., the number of failures is greater than N times), the operation is determined to be abnormal. In other implementations, the CPU occupancy rate, hard disk index, memory change range, etc. of the working thread when processing the task can also be monitored to determine whether it is an abnormal task.

[0071] Further, the terminal can determine the target processing strategy for abnormal tasks based on the load values ​​of each work thread. In one implementation, the blockchain network stores the historical load values ​​of each work thread and the corresponding historical processing strategies of the historical records. The terminal can find the matching historical load values ​​from the blockchain based on the load values ​​of each work thread, and determine the historical processing strategy corresponding to the historical load value as the target processing strategy for the abnormal task. Among them, the target processing strategy includes re-calling the work thread to process the abnormal task, calling the work thread to process it after splitting the abnormal task, calling the work thread to process it after merging the abnormal task, etc. Optionally, if the terminal does not find a matching historical load value from the blockchain, the terminal can obtain a work thread with a load value less than the preset load value, and specify the target processing strategy as a work thread with a load value less than the preset load value after splitting the abnormal task into multiple abnormal subtasks, so that each work thread with a load value less than the preset load value processes the abnormal subtask.

[0072] S205: The terminal processes the abnormal task according to the target processing strategy to obtain a processing result for the abnormal task.

[0073] In one implementation, the terminal detects whether the abnormal task is splittable; if not, the abnormal processing result is fed back; if it is splittable, the abnormal task is split and processed to obtain at least one abnormal subtask, and a working thread is assigned to each abnormal subtask for processing; the scheduling instance receives the processing result of each working thread for the abnormal subtask, and if the processing result of each abnormal subtask indicates successful processing, the processing results of each abnormal subtask are merged to obtain the processing result for the abnormal task, if there is an abnormal subtask that is not successfully processed, the terminal determines the target abnormal subtask that has not obtained the processing result, and determines that the target abnormal subtask is the cause of the task processing exception. Through the above method, a feedback mechanism can be provided for the abnormal task, and the processing result corresponding to the abnormal task can be obtained as much as possible. The cause of the task processing exception can also be determined more finely based on the processing result of the abnormal subtask, so that the terminal can intelligently correct errors, and after processing the abnormal task, other tasks can be processed in time to improve the task processing efficiency.

[0074] S206. The terminal broadcasts the load value and target processing strategy of each working thread in the blockchain, so that each node in the blockchain performs consensus verification on the load value and target processing strategy of each working thread.

[0075] In an embodiment of the present invention, the terminal may be a node in a blockchain and has the ability to broadcast messages in the blockchain. After the terminal obtains the load value and target processing strategy of each work thread, it may establish a corresponding relationship between the load value and the target processing strategy of each work thread, and further broadcast the load value and the target processing strategy of each work thread in the blockchain, so that each node in the blockchain performs consensus verification on the load value and the target processing strategy of each work thread.

[0076] S207. If the result of consensus verification passing is received, the terminal packages the load value and target processing strategy of each working thread into a block.

[0077] In the embodiment of the present invention, after the terminal broadcasts the load value and target processing strategy of each work thread in the blockchain, each node in the blockchain can perform consensus verification on the received broadcast information and return the consensus verification result to the terminal. If the terminal receives the result of passing the consensus verification, the terminal packages the load value and target processing strategy of each work thread into a block. When the number of verifications indicated in the consensus verification results returned by each node is greater than the preset number, it is determined that the terminal has received the result of passing the consensus verification.

[0078] S208. The terminal stores the block in the blockchain, so that the nodes in the blockchain can consult the load value of each working thread and the target processing strategy.

[0079] In an embodiment of the present invention, after the terminal packages the load value and target processing strategy of each work thread into a block, the block can be stored in the blockchain, so that the nodes in the blockchain can consult the load value and target processing strategy of each work thread. In this way, other terminals can query the corresponding abnormal task processing strategy from the blockchain when encountering the same load situation, and process the abnormal task in time, thereby improving the processing efficiency of the abnormal task.

[0080] In an embodiment of the present invention, a terminal receives at least one task, and generates a scheduling instance according to at least one task. The terminal allocates a corresponding work thread to each task in the at least one task based on the scheduling instance, and monitors the processing progress of each work thread on the task based on the scheduling instance to obtain the processing progress of each task; if it is determined that there is an abnormal task in at least one task based on the processing progress of each task, the terminal determines the load value of each work thread based on the scheduling instance, and determines the target processing strategy for the abnormal task according to the load value of each work thread; the terminal processes the abnormal task according to the target processing strategy to obtain the processing result for the abnormal task. The generated scheduling instance is used to realize the allocation and monitoring of tasks, and a strategy is formulated in time to process abnormal tasks, thereby improving the efficiency and fault tolerance of task processing.

[0081] The following will be combined with the attached Figure 3 The task processing device provided by the embodiment of the present invention is introduced in detail. Figure 3 The task processing device shown is used to execute the present invention Figure 1-Figure 2 For the convenience of explanation, only the part related to the embodiment of the present invention is shown, and the specific technical details are not disclosed. Figure 1-Figure 2 The embodiment shown.

[0082] See also Figure 3 , which is a structural diagram of a task processing device provided by the present invention. The task processing device 30 may include: a receiving module 301, a generating module 302, an allocating module 303, a monitoring module 304, a determining module 305 and a processing module 306.

[0083] A receiving module, used for receiving at least one task;

[0084] A generating module, configured to generate a scheduling instance according to the at least one task;

[0085] an allocation module, configured to allocate a corresponding work thread to each task in the at least one task based on the scheduling instance, so that each work thread processes a corresponding task in the at least one task;

[0086] A monitoring module, used to monitor the processing progress of the tasks by the various working threads based on the scheduling instance, and obtain the processing progress for each task;

[0087] A determination module, configured to determine a load value of each work thread based on the scheduling instance if it is determined based on the processing progress of each task that there is an abnormal task in the at least one task, and determine a target processing strategy for the abnormal task according to the load value of each work thread;

[0088] A processing module is used to process the abnormal task according to the target processing strategy to obtain a processing result for the abnormal task.

[0089] In one implementation, the determination module 305 is further configured to:

[0090] Determining a type corresponding to each task in the at least one task;

[0091] Determine a storage area of ​​each task in a database based on the type of each task;

[0092] The tasks are stored in the database according to the storage area of ​​each task in the database, so that the scheduling instance obtains at least one task from the database and completes the allocation of the at least one task.

[0093] In one implementation, the allocation module 303 is specifically configured to:

[0094] Obtaining a remaining load value corresponding to each working thread in at least one working thread;

[0095] Preprocessing the at least one task according to the residual load value of each working thread to obtain a plurality of preprocessing tasks, wherein the task amount of each preprocessing task corresponds to the residual load value of each working thread, and the preprocessing method includes splitting processing or merging processing;

[0096] The working thread corresponding to each preprocessing task is determined based on the principle of matching the task amount with the remaining load value, and each preprocessing task in the plurality of preprocessing tasks is allocated to the corresponding working thread based on the scheduling instance.

[0097] In one implementation, the allocation module 303 is specifically configured to:

[0098] Determining a first number of idle working threads and a second number of the at least one task based on the scheduling instance, wherein a load value of the idle working threads is less than a preset load value;

[0099] If the first number is greater than the second number, M tasks are selected from the at least one task for splitting processing to obtain a first number of split tasks, and the first number of split tasks are allocated to corresponding idle working threads based on the scheduling instance, where M is a positive integer;

[0100] If the first number is less than the second number, K tasks are selected from the at least one task for merging to obtain a first number of merged tasks, and the first number of merged tasks are allocated to corresponding idle working threads based on the scheduling instance, where K is a positive integer;

[0101] In one implementation, the monitoring module 304 is specifically configured to:

[0102] When the monitoring condition is met, the scheduling instance is called to send a progress query instruction to each of the working threads, wherein the progress query instruction is used to obtain the processing progress of each of the working threads on the at least one task;

[0103] Calling the scheduling instance to receive progress information returned by each working thread;

[0104] Based on the progress information, the working thread status table recorded in the scheduling instance is updated, wherein the working thread status table records the current processing progress of each working thread on the task;

[0105] The terminal queries the updated working thread status table to obtain the processing progress of each working thread for the at least one task.

[0106] In one implementation, the processing progress indicates the processing time for each task, and the determination module 305 is specifically configured to:

[0107] Acquire a task type corresponding to a target task, and determine an average processing time corresponding to the task type, wherein the target task is any one of the at least one task;

[0108] Calculating a difference between a target processing duration for a target task indicated in the processing schedule and the average processing duration;

[0109] If the difference is greater than a preset difference, the target task is determined to be an abnormal task.

[0110] In one implementation, the processing module 306 is specifically configured to:

[0111] Broadcasting the load value of each working thread and the target processing strategy in the blockchain, so that each node in the blockchain performs consensus verification on the load value of each working thread and the target processing strategy;

[0112] If a consensus check result is received, the load value of each working thread and the target processing strategy are packaged into a block;

[0113] The block is stored in a blockchain so that nodes in the blockchain can refer to the load value of each working thread and the target processing strategy.

[0114] In the embodiment of the present invention, the receiving module 301 receives at least one task, the generating module 302 generates a scheduling instance according to at least one task, the allocating module 303 allocates a corresponding working thread to each task in at least one task based on the scheduling instance, and the monitoring module 304 monitors the processing progress of each working thread on the task based on the scheduling instance to obtain the processing progress for each task; if it is determined that there is an abnormal task in at least one task based on the processing progress of each task, the determining module 305 determines the load value of each working thread based on the scheduling instance, and determines the target processing strategy for the abnormal task according to the load value of each working thread; the processing module 306 processes the abnormal task according to the target processing strategy to obtain the processing result for the abnormal task. The generated scheduling instance is used to realize the allocation and monitoring of tasks, and a strategy is formulated in time to process the abnormal tasks, thereby improving the efficiency and fault tolerance of task processing.

[0115] See also Figure 4 , which is a schematic diagram of the structure of a terminal according to an embodiment of the present invention. Figure 4 As shown, the terminal includes: at least one processor 401, an input device 403, an output device 404, a memory 405, and at least one communication bus 402. The communication bus 402 is used to realize the connection and communication between these components. The input device 403 can be a control panel or a microphone, etc., and the output device 404 can be a display screen, etc. The memory 405 can be a high-speed RAM memory or a non-volatile memory, such as at least one disk memory. The memory 405 can optionally be at least one storage device located away from the aforementioned processor 401. The processor 401 can be combined with Figure 3 In the described apparatus, a set of program codes is stored in the memory 405, and the processor 401, the input device 403, and the output device 404 call the program codes stored in the memory 405 to perform the following operations:

[0116] The processor 401 is configured to receive at least one task and generate a scheduling instance according to the at least one task;

[0117] Processor 401, configured to allocate a corresponding work thread to each task in the at least one task based on the scheduling instance, so that each work thread processes the corresponding task in the at least one task;

[0118] The processor 401 is used to monitor the processing progress of the tasks by the respective work threads based on the scheduling instance, and obtain the processing progress for each task;

[0119] Processor 401 is configured to determine a load value of each work thread based on the scheduling instance if it is determined based on the processing progress of each task that there is an abnormal task in the at least one task, and determine a target processing strategy for the abnormal task according to the load value of each work thread;

[0120] The processor 401 is used to process the abnormal task according to the target processing strategy to obtain a processing result for the abnormal task.

[0121] In one implementation, the processor 401 is specifically configured to:

[0122] Determining a type corresponding to each task in the at least one task;

[0123] Determine a storage area of ​​each task in a database based on the type of each task;

[0124] The tasks are stored in the database according to the storage area of ​​each task in the database, so that the scheduling instance obtains at least one task from the database and completes the allocation of the at least one task.

[0125] In one implementation, the processor 401 is specifically configured to:

[0126] Obtaining a remaining load value corresponding to each working thread in at least one working thread;

[0127] Preprocessing the at least one task according to the residual load value of each working thread to obtain a plurality of preprocessing tasks, wherein the task amount of each preprocessing task corresponds to the residual load value of each working thread, and the preprocessing method includes splitting processing or merging processing;

[0128] The working thread corresponding to each preprocessing task is determined based on the principle of matching the task amount with the remaining load value, and each preprocessing task in the plurality of preprocessing tasks is allocated to the corresponding working thread based on the scheduling instance.

[0129] In one implementation, the processor 401 is specifically configured to:

[0130] Determine a first number of idle working threads and a second number of at least one task based on the scheduling instance, wherein a load value of the idle working threads is less than a preset load value;

[0131] If the first number is greater than the second number, M tasks are selected from the at least one task for splitting processing to obtain a first number of split tasks, and the first number of split tasks are allocated to corresponding idle working threads based on the scheduling instance, where M is a positive integer;

[0132] If the first number is less than the second number, K tasks are selected from the at least one task for merging to obtain a first number of merged tasks, and the first number of merged tasks are allocated to corresponding idle working threads based on the scheduling instance, where K is a positive integer;

[0133] In one implementation, the processor 401 is specifically configured to:

[0134] When the monitoring condition is met, the scheduling instance is called to send a progress query instruction to each of the working threads, wherein the progress query instruction is used to obtain the processing progress of each of the working threads on the at least one task;

[0135] Calling the scheduling instance to receive progress information returned by each working thread;

[0136] Based on the progress information, the working thread status table recorded in the scheduling instance is updated, wherein the working thread status table records the current processing progress of each working thread on the task;

[0137] The terminal queries the updated working thread status table to obtain the processing progress of each working thread for the at least one task.

[0138] In one implementation, the processor 401 is specifically configured to:

[0139] Acquire a task type corresponding to a target task, and determine an average processing time corresponding to the task type, wherein the target task is any one of the at least one task;

[0140] Calculating a difference between a target processing duration for a target task indicated in the processing schedule and the average processing duration;

[0141] If the difference is greater than a preset difference, the target task is determined to be an abnormal task.

[0142] In one implementation, the processor 401 is specifically configured to:

[0143] Broadcasting the load value of each working thread and the target processing strategy in the blockchain, so that each node in the blockchain performs consensus verification on the load value of each working thread and the target processing strategy;

[0144] If a consensus check result is received, the load value of each working thread and the target processing strategy are packaged into a block;

[0145] The block is stored in a blockchain so that nodes in the blockchain can refer to the load value of each working thread and the target processing strategy.

[0146] In an embodiment of the present invention, the processor 401 receives at least one task and generates a scheduling instance according to the at least one task. The processor 401 allocates a corresponding work thread to each task in the at least one task based on the scheduling instance, and monitors the processing progress of each work thread on the task based on the scheduling instance to obtain the processing progress for each task; if it is determined that there is an abnormal task in at least one task based on the processing progress of each task, the processor 401 determines the load value of each work thread based on the scheduling instance, and determines the target processing strategy for the abnormal task according to the load value of each work thread; and processes the abnormal task according to the target processing strategy to obtain the processing result for the abnormal task. The generated scheduling instance is used to realize the allocation and monitoring of tasks, and a strategy is formulated in time to process the abnormal tasks, which improves the efficiency and fault tolerance of task processing.

[0147] The modules described in the embodiments of the present invention may be implemented by a general integrated circuit, such as a CPU (Central Processing Unit), or by an ASIC (Application Specific Integrated Circuit).

[0148] It should be understood that in the embodiment of the present invention, the processor 401 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.

[0149] The bus 402 may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, or an Extended Industry Standard Architecture (EISA) bus. The bus 402 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 It is represented by only one thick line, but it does not mean that there is only one bus or one type of bus.

[0150] A person skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be implemented by instructing the relevant hardware through a computer program, and the program can be stored in a computer storage medium, and when the program is executed, it can include the processes of the embodiments of the above-mentioned methods. The computer storage medium can be a disk, an optical disk, a read-only memory (ROM) or a random access memory (RAM), etc.

[0151] The above disclosure is only the preferred embodiment of the present invention, which certainly cannot be used to limit the scope of the present invention. Therefore, equivalent changes made according to the claims of the present invention are still within the scope of the present invention.

Claims

1. A task processing method, characterized in that: The method comprises: receiving at least one task, and generating a scheduling instance according to the at least one task; Allocate a corresponding work thread to each task in the at least one task based on the scheduling instance, so that each work thread processes the corresponding task in the at least one task; Based on the scheduling instance, monitoring the processing progress of the tasks by the respective working threads, and obtaining the processing progress for each task; If it is determined based on the processing progress of each task that there is an abnormal task in the at least one task, then the load value of each work thread is determined based on the scheduling instance, and the target processing strategy for the abnormal task is determined according to the load value of each work thread; the processing progress indicates the processing time for each task; the determination based on the processing progress of each task that there is an abnormal task in the at least one task includes: obtaining the task type corresponding to the target task, and determining the average processing time corresponding to the task type, the target task is any one of the at least one task; calculating the difference between the target processing time for the target task indicated in the processing progress and the average processing time; if the difference is greater than a preset difference, determining that the target task is an abnormal task; The abnormal task is processed according to the target processing strategy to obtain a processing result for the abnormal task; the target processing strategy is to split the abnormal task into N abnormal subtasks, and assign the N abnormal subtasks to corresponding N target working threads, and the processing includes: assigning each abnormal subtask to the corresponding target working thread, so that each target working thread processes the assigned abnormal subtask, and returning the processing result for each abnormal subtask to the scheduling instance, so as to obtain the processing result for each abnormal subtask from the scheduling instance; detecting whether each abnormal subtask has a corresponding processing result, if so, merging the processing results of each abnormal subtask to obtain the processing result for the abnormal task, if not, determining the target abnormal subtask that has not returned the processing result, and determining the reason why the target abnormal subtask causes the task processing exception; there are multiple target working threads, and the multiple target working threads are working threads whose load values ​​are less than the preset load value.

2. The method according to claim 1, characterized in that: After receiving at least one task, the method further includes: Determining a type corresponding to each task in the at least one task; Determine a storage area of ​​each task in a database based on the type of each task; The tasks are stored in the database according to the storage area of ​​each task in the database, so that the scheduling instance obtains at least one task from the database and completes the allocation of the at least one task.

3. The method according to claim 1, characterized in that The allocating a corresponding working thread to each task in the at least one task based on the scheduling instance includes: Obtain a remaining load value corresponding to each working thread in at least one working thread; Preprocessing the at least one task according to the residual load value of each working thread to obtain a plurality of preprocessing tasks, wherein the task amount of each preprocessing task corresponds to the residual load value of each working thread, and the preprocessing method includes splitting processing or merging processing; The working thread corresponding to each preprocessing task is determined based on the principle of matching the task amount with the remaining load value, and each preprocessing task in the plurality of preprocessing tasks is allocated to the corresponding working thread based on the scheduling instance.

4. The method according to claim 1, characterized in that: The allocating a corresponding working thread to each task in the at least one task based on the scheduling instance includes: Determining a first number of idle working threads and a second number of the at least one task based on the scheduling instance, wherein a load value of the idle working threads is less than a preset load value; If the first number is greater than the second number, M tasks are selected from the at least one task for splitting processing to obtain a first number of split tasks, and the first number of split tasks are allocated to corresponding idle working threads based on the scheduling instance, where M is a positive integer; If the first number is less than the second number, K tasks are selected from the at least one task for merging to obtain a first number of merged tasks, and the first number of merged tasks are allocated to corresponding idle working threads based on the scheduling instance, where K is a positive integer.

5. The method according to claim 1, characterized in that The monitoring of the processing progress of the tasks by the respective work threads based on the scheduling instance to obtain the processing progress for each task includes: When the monitoring condition is met, the scheduling instance is called to send a progress query instruction to each of the working threads, wherein the progress query instruction is used to obtain the processing progress of each of the working threads on the at least one task; Calling the scheduling instance to receive progress information returned by each working thread; Based on the progress information, the working thread status table recorded in the scheduling instance is updated, wherein the working thread status table records the current processing progress of each working thread on the task; The processing progress of each working thread for the at least one task is queried from the updated working thread status table.

6. The method according to claim 1, characterized in that After determining the target processing strategy for the abnormal task according to the load value of each working thread, the method further includes: Broadcasting the load value of each working thread and the target processing strategy in the blockchain, so that each node in the blockchain performs consensus verification on the load value of each working thread and the target processing strategy; If a consensus check result is received, the load value of each working thread and the target processing strategy are packaged into a block; The block is stored in a blockchain so that nodes in the blockchain can refer to the load value of each working thread and the target processing strategy.

7. A task processing device, characterized in that: The device comprises: A receiving module, used for receiving at least one task; A generating module, configured to generate a scheduling instance according to the at least one task; An allocation module, configured to allocate a corresponding work thread to each task in the at least one task based on the scheduling instance, so that each work thread processes a corresponding task in the at least one task; A monitoring module, used to monitor the processing progress of the tasks by the various working threads based on the scheduling instance, and obtain the processing progress for each task; A determination module, for determining the load value of each work thread based on the scheduling instance, and determining a target processing strategy for the abnormal task according to the load value of each work thread, if it is determined that there is an abnormal task in the at least one task based on the processing progress of each task; the processing progress indicates the processing time for each task; the determination that there is an abnormal task in the at least one task based on the processing progress of each task includes: obtaining a task type corresponding to the target task, and determining an average processing time corresponding to the task type, the target task being any one of the at least one task; calculating the difference between the target processing time for the target task indicated in the processing progress and the average processing time; if the difference is greater than a preset difference, determining that the target task is an abnormal task; A processing module is used to process the abnormal task according to the target processing strategy to obtain a processing result for the abnormal task; the target processing strategy is to split the abnormal task into N abnormal subtasks, and assign the N abnormal subtasks to corresponding N target working threads, and the processing includes: assigning each abnormal subtask to a corresponding target working thread, so that each target working thread processes the assigned abnormal subtask, and returning the processing result for each abnormal subtask to the scheduling instance, so as to obtain the processing result for each abnormal subtask from the scheduling instance; detecting whether each abnormal subtask has a corresponding processing result, if so, merging the processing results of each abnormal subtask to obtain the processing result for the abnormal task, if not, determining the target abnormal subtask that does not return a processing result, and determining the reason why the target abnormal subtask causes the task processing exception; there are multiple target working threads, and the multiple target working threads are working threads with load values ​​less than a preset load value.

8. A terminal, characterized in that: The method comprises a processor, an input interface, an output interface and a memory, wherein the processor, the input interface, the output interface and the memory are interconnected, wherein the memory is used to store a computer program, the computer program comprises program instructions, and the processor is configured to call the program instructions to execute the method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by a processor, the processor is caused to perform the method according to any one of claims 1 to 6.