A method, device and storage medium for scheduling tasks

By creating main threads and sub-threads, managing task queues and flags in mobile terminal development, the problem of uneven task scheduling with dependencies is solved, and efficient execution and balanced scheduling of tasks are achieved.

CN113268325BActive Publication Date: 2024-09-06BEIJING DAJIA INTERNET INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110556683.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-21
Publication Date
2024-09-06
Estimated Expiration
2041-05-21

AI Technical Summary

Technical Problem

In mobile terminal development, existing technology is difficult to effectively handle tasks with dependencies and tasks that must be run on specific threads, resulting in low task execution efficiency and uneven scheduling.

Method used

By creating the main thread and sub-threads, we manage the tasks running in the main thread and the tasks running outside the main thread respectively, and use the task queue and flag mechanism to achieve balanced scheduling of tasks to ensure that dependent tasks are executed in order, and through Parallel execution of the main thread and sub-threads improves efficiency.

Benefits of technology

It achieves balanced scheduling of tasks and improves execution efficiency, ensures that dependent tasks are executed in order, solves the problem that tasks must run on designated threads, and improves overall task execution efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113268325B
    Figure CN113268325B
Patent Text Reader

Abstract

The present disclosure relates to the field of computers, and discloses a method, device and storage medium for scheduling tasks. The method comprises the following steps: based on the dependency relationship between target tasks, an intelligent terminal creates a first task queue and a second task queue to store a plurality of target tasks running in a main thread and a plurality of target tasks running outside the main thread, respectively, thereby solving the requirement that target tasks must be run in a designated thread; and the intelligent terminal creates a main thread and at least one sub-thread based on the main thread, and the main thread sequentially obtains and executes each target task in the first task queue, and each sub-thread respectively obtains and executes each target task in the second task queue, thereby ensuring balanced scheduling of target tasks. While the main thread runs the target task, the sub-thread runs other target tasks, thereby realizing parallel execution of the main thread and a plurality of sub-threads, achieving the purpose of balanced operation of each thread, and improving the execution efficiency of the target task.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to computer technology, and in particular to a method, device and storage medium for scheduling tasks. Background Art

[0002] In mobile terminal development, threads are divided into two types: one is the main thread and the other is other threads. Usually, the other threads are collectively referred to as sub-threads. During the running process, the main thread has a higher priority, that is, the main thread can obtain more execution opportunities of the central processing unit (CPU); moreover, the main thread can update the user interface (UI), but the sub-thread cannot update the UI. Therefore, see Figure 1 As shown, the task execution is often completed by executing each task in sequence through a thread. Obviously, this method is time-consuming and has poor execution efficiency.

[0003] At present, thread pool technology can also be used when executing a large number of tasks. However, the disadvantage of thread pool is that it cannot handle tasks that are dependent on each other (the dependency of tasks here means that the execution of task N depends on task N-1, and task N must wait for task N-1 to finish running before it can be executed), and it cannot handle tasks that must be run on the main thread. Obviously, throwing all tasks into the thread pool and using the thread pool directly to complete them cannot meet the requirement that some tasks must be run on a specific thread, such as the main thread; in addition, the thread pool cannot handle tasks that have dependencies.

[0004] Of course, you can also use locking in multithreading to handle a large number of tasks. For example, when two threads execute the same task, locking can ensure that only one thread can obtain the task at a time. In this way, after starting multiple threads, multiple threads compete for a lock. The thread that obtains the lock obtains a task from the task list to execute, and releases the lock after the task is completed. Other idle threads continue to compete for the lock, and the thread that obtains the lock obtains another task from the task list to execute, and so on, until all tasks are completed. However, using the locking method will inevitably affect the operating efficiency, because multiple threads need to compete to obtain the tasks to be executed. If the lock is not obtained, the task list cannot be accessed, and the next task to be executed cannot be obtained. The above process cannot achieve balanced task scheduling. Summary of the invention

[0005] The embodiments of the present disclosure provide a method, device and storage medium for scheduling tasks, so as to improve the execution efficiency of target tasks and make task scheduling between threads more balanced.

[0006] The specific technical solutions provided by this disclosure are as follows:

[0007] In a first aspect, a method for scheduling tasks includes:

[0008] Based on the dependency relationship between the target tasks, a first task queue and a second task queue are created, wherein the first task queue is used to store multiple target tasks running in the main thread, and the second task queue is used to store multiple target tasks running outside the main thread;

[0009] Create a main thread and create at least one child thread based on the main thread;

[0010] Each target task in the first task queue is sequentially acquired and executed through the main thread, and each target task in the second task queue is acquired and executed respectively through at least one sub-thread.

[0011] Optionally, based on the dependency relationship between the target tasks, creating a first task queue and a second task queue includes:

[0012] Sort multiple target tasks according to the order of their dependencies;

[0013] Create a first task queue and a second task queue;

[0014] Multiple target tasks are obtained in sequence, wherein for each target task obtained, the following operations are performed:

[0015] Determine whether a target task currently obtained is a target task running in the main thread;

[0016] If so, based on the sorting result, put the target task into the first task queue;

[0017] Otherwise, based on the sorting result, the target task is placed in the second task queue.

[0018] Optionally, sequentially acquiring and executing each target task in the first task queue through a main thread, and acquiring and executing each target task in the second task queue through at least one sub-thread, include:

[0019] When the main thread obtains the first target task in the first task queue, the target tasks in the second task queue are obtained respectively through at least one sub-thread.

[0020] Optionally, before acquiring and executing each target task in the second task queue by at least one sub-thread, the method further includes:

[0021] A flag is set for the second task queue, where the flag indicates the total number of target tasks that have been acquired in the second task queue.

[0022] Optionally, it also includes:

[0023] If it is determined that the first task queue is empty, but the second task queue is not empty, the remaining target tasks are obtained and executed from the second task queue through the main thread.

[0024] Optionally, obtaining and executing each target task in the second task queue by at least one sub-thread respectively includes:

[0025] When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value of the flag bit is increased by one, so that any other sub-thread in the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

[0026] Optionally, if it is determined that the first task queue is empty and the second task queue is not empty, the method further includes:

[0027] When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value of the flag bit is increased by one, so that the main thread or any other sub-thread of the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

[0028] Optionally, if it is determined that the first task queue is empty and the second task queue is not empty, the method further includes:

[0029] If the same target task in the second task queue is obtained by two threads at the same time, it is determined whether the value assigned to the flag bit is consistent with the total number of tasks obtained in the second task queue;

[0030] If so, executing the target task currently to be executed in the second task queue through one of the two threads;

[0031] Otherwise, the assigned value is increased by one, and the next target task to be executed in the second task queue is obtained through one of the two threads.

[0032] Optionally, the two threads include a main thread and one sub-thread, or include two sub-threads.

[0033] In a second aspect, a device for scheduling tasks includes:

[0034] A queue creation unit, used to create a first task queue and a second task queue based on the dependency relationship between the target tasks, wherein the first task queue is used to store multiple target tasks running in the main thread, and the second task queue is used to store multiple target tasks running outside the main thread;

[0035] A thread creation unit, used to create a main thread and create at least one child thread based on the main thread;

[0036] The execution unit is used to sequentially obtain and execute each target task in the first task queue through a main thread, and to respectively obtain and execute each target task in the second task queue through each sub-thread of at least one sub-thread.

[0037] Optionally, based on the dependency relationship between the target tasks, a first task queue and a second task queue are created, and the queue creation unit is used to:

[0038] Sort multiple target tasks according to the order of their dependencies;

[0039] Create a first task queue and a second task queue;

[0040] Multiple target tasks are obtained in sequence, wherein for each target task obtained, the following operations are performed:

[0041] Determine whether a target task currently obtained is a target task running in the main thread;

[0042] If so, based on the sorting result, put the target task into the first task queue;

[0043] Otherwise, based on the sorting result, the target task is placed in the second task queue.

[0044] Optionally, each target task in the first task queue is sequentially acquired and executed by the main thread, and each target task in the second task queue is acquired and executed by each sub-thread of at least one sub-thread, and the execution unit is used to:

[0045] When the main thread obtains the first target task in the first task queue, the target tasks in the second task queue are obtained respectively through at least one sub-thread.

[0046] Optionally, it also includes:

[0047] A flag is set for the second task queue, where the flag indicates the total number of target tasks that have been acquired in the second task queue.

[0048] Optionally, it also includes:

[0049] If it is determined that the first task queue is empty, but the second task queue is not empty, the remaining target tasks are obtained and executed from the second task queue through the main thread.

[0050] Optionally, each target task in the second task queue is acquired and executed respectively by at least one sub-thread, and the execution unit is used to:

[0051] When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value of the flag bit is increased by one, so that any other sub-thread in the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

[0052] Optionally, if it is determined that the first task queue is empty and the second task queue is not empty, the execution unit is further configured to:

[0053] When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value of the flag bit is increased by one, so that the main thread or any other sub-thread of the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

[0054] Optionally, if it is determined that the first task queue is empty and the second task queue is not empty, the execution unit is further configured to:

[0055] If the same target task in the second task queue is obtained by two threads at the same time, it is determined whether the value assigned to the flag bit is consistent with the total number of tasks obtained in the second task queue;

[0056] If so, executing the target task currently to be executed in the second task queue through one of the two threads;

[0057] Otherwise, the assigned value is increased by one, and the next target task to be executed in the second task queue is obtained through one of the two threads.

[0058] Optionally, the two threads include a main thread and one sub-thread, or include two sub-threads.

[0059] In a third aspect, a smart terminal includes:

[0060] A memory for storing executable instructions;

[0061] A processor is used to read and execute executable instructions stored in a memory to implement any method as described in the first aspect.

[0062] In a fourth aspect, a computer-readable storage medium is provided. When instructions in the storage medium are executed by a processor, the processor is enabled to execute any method described in the first aspect.

[0063] In a fifth aspect, a computer program product comprises executable instructions, and when the executable instructions of the computer program product are executed by a processor, the method as described in any one of the above-mentioned first aspects can be implemented.

[0064] In summary, in the embodiment of the present disclosure, the intelligent terminal creates a first task queue and a second task queue based on the dependency relationship between the target tasks, so as to respectively store multiple target tasks running in the main thread and multiple target tasks running outside the main thread, thereby solving the requirement that the target tasks must be run in the specified thread; and the intelligent terminal creates a main thread and creates at least one sub-thread based on the main thread, so that in the implementation process, the intelligent terminal sequentially obtains and executes each target task in the first task queue through the main thread, and obtains and executes each target task in the second task queue through each sub-thread of at least one sub-thread. Since the above-mentioned first task queue and the second task queue are created based on the dependency relationship between the target tasks, under the premise of processing target tasks with dependencies, the balanced scheduling of the target tasks can be guaranteed, so that while the target tasks can be run through the main thread, other target tasks can also be run through the above-mentioned at least one sub-thread, realizing the parallel execution of the main thread and multiple sub-threads, achieving the purpose of balanced operation of each thread, further improving the execution efficiency of the target tasks, and thus making the scheduling of the target tasks between threads more balanced. BRIEF DESCRIPTION OF THE DRAWINGS

[0065] Figure 1 A schematic diagram of a smart terminal performing tasks in the prior art;

[0066] Figure 2 This is a flowchart of a smart terminal scheduling task in an embodiment of the present application;

[0067] Figure 3 A schematic diagram of a process for creating a task queue for an intelligent terminal in an embodiment of the present application;

[0068] Figure 4 This is a schematic diagram of an intelligent terminal executing a target task through multiple threads in an embodiment of the present application;

[0069] Figure 5 This is a flow chart of the intelligent terminal in the embodiment of the present application acquiring the same target task through two threads;

[0070] Figure 6 This is a schematic diagram of an intelligent terminal executing a target task through main thread 1, sub-thread 1 and sub-thread 2 in application scenario 1 of an embodiment of the present application;

[0071] Figure 7 It is a directed acyclic graph between various target tasks in application scenario 1 of the embodiment of the present application;

[0072] Figure 8 A schematic diagram of the logical architecture of the intelligent terminal in the embodiment of the present disclosure;

[0073] Fig. 9Schematic diagram of the physical architecture of the smart terminal in the embodiment of the present disclosure. DETAILED DESCRIPTION

[0074] In order to improve the execution efficiency of the target tasks and make the scheduling of the target tasks between threads more balanced, in an embodiment of the present application, the intelligent terminal creates a first task queue and a second task queue based on the dependency relationship between the target tasks, wherein the first task queue is used to store multiple target tasks running in the main thread, and the second task queue is used to store multiple target tasks running outside the main thread. During the execution process, the intelligent terminal creates a main thread and creates at least one sub-thread based on the main thread. The intelligent terminal obtains and executes each target task in the first task queue in sequence through the main thread, and obtains and executes each target task in the second task queue through each sub-thread of at least one sub-thread. In this way, while the main thread is running the target task, the above-mentioned at least one sub-thread is also running another batch of target tasks, thereby realizing the parallel execution of the main thread and at least one sub-thread, thereby realizing the balanced scheduling of each target task in the main thread and at least one sub-thread.

[0075] The following is a detailed description of the preferred implementation of the present application in conjunction with the accompanying drawings. In the embodiment of the present disclosure, the implementation of the method for scheduling tasks is mainly performed on the smart terminal side, see Figure 2 As shown, in the embodiment of the present disclosure, the specific process of the intelligent terminal scheduling task is as follows:

[0076] Step 200: The intelligent terminal creates a first task queue and a second task queue based on the dependency relationship between target tasks, wherein the first task queue is used to store multiple target tasks running in the main thread, and the second task queue is used to store multiple target tasks running outside the main thread.

[0077] During the operation, some target tasks must be executed in the main thread, for example, the target task for updating the UI. Therefore, in order to improve the operation efficiency, the smart terminal needs to classify and store the target tasks. For details, see Figure 3 As shown, the above classification storage process includes the following steps:

[0078] Step 2000: The intelligent terminal sorts the multiple target tasks according to the order of their dependencies.

[0079] Considering the dependency between target tasks, that is, the execution of target task N depends on target task N-1, during the operation, the intelligent terminal must wait for the target task N-1 to finish running before executing target task N.

[0080] During the implementation process, the intelligent terminal sorts the target tasks, and puts the target tasks with an earlier dependency order in front, and the target tasks with a later dependency order in the back. Take the above-mentioned target task N and target task N-1 as an example, that is, the above-mentioned target task N-1 is put in front, and the above-mentioned target task N is put in the back.

[0081] After the intelligent terminal sorts the multiple target tasks to be executed, each target task is obtained, which is arranged in the order of dependency from first to last.

[0082] Step 2001: The intelligent terminal creates a first task queue and a second task queue.

[0083] After sorting multiple target tasks, the intelligent terminal creates a first task queue and a second task queue for placing the sorted target tasks. It should be noted that the initial states of the first task queue and the second task queue created by the intelligent terminal are both empty.

[0084] The purpose of creating the above two queues is to classify and store target tasks. Specifically, the first task queue is used to store multiple target tasks running in the main thread, and the second task queue is used to store multiple target tasks running outside the main thread.

[0085] The first task queue and the second task queue are created based on the dependency relationship between the target tasks. In this way, balanced scheduling of the target tasks can be guaranteed under the premise of processing the target tasks with dependencies.

[0086] Step 2002: In order to accurately place each target task into the corresponding first task queue or second task queue, the intelligent terminal sequentially acquires multiple target tasks, wherein for each acquired target task, the following operations are performed: the intelligent terminal determines whether a target task currently acquired is a target task running in the main thread, and if so, executes step 2003, otherwise, executes step 2004.

[0087] By using the step of determining whether the target task is the target task to be executed in the main thread through the intelligent terminal, the target tasks that must be executed in the main thread can be effectively screened out, while the target tasks that do not have to be executed in the main thread can be executed by the child thread, thereby solving the requirement that the target task must be executed in the specified thread.

[0088] Considering that the main thread is executed at the beginning of the program and is the thread that generates other sub-threads; and the main thread is usually the last to complete execution (for example, various closing actions, etc.), therefore, during the implementation process, after the smart terminal obtains the current target task, it determines whether the target thread is the target task running in the main thread, thereby filtering out the target tasks that must be run in the main thread.

[0089] Step 2003: The intelligent terminal puts the target task into the first task queue based on the sorting result.

[0090] During implementation, when the intelligent terminal determines that the target task is a target task running in the main thread, that is, the target task must be run in the main thread, the intelligent terminal puts the target task into the first task queue.

[0091] It should be noted that after sorting the target tasks according to the order of dependencies, the sorting results are put into the first task queue in sequence. In this way, the target tasks in the first task queue are also arranged in order from first to last according to the dependency relationship. The above-mentioned target task N and target task N-1 are both put into the first task queue for explanation, that is, the above-mentioned target task N-1 is placed in front, and the above-mentioned target task N is placed in the back.

[0092] Step 2004: The intelligent terminal puts the target task into the second task queue based on the sorting result.

[0093] During implementation, when the intelligent terminal determines that the target task is not a target task running in the main thread, that is, the target task is not a target task that must be run in the main thread, the intelligent terminal puts the target task into the second task queue.

[0094] It should be noted that after sorting the target tasks according to the order of dependencies, the sorting results are put into the second task queue in sequence. In this way, the target tasks in the second task queue are also arranged in order from first to last according to the dependencies. The above-mentioned target task N and target task N-1 are both put into the second task queue for explanation, that is, the above-mentioned target task N-1 is placed in front, and the above-mentioned target task N is placed in the back.

[0095] Step 201: The intelligent terminal creates a main thread and creates at least one sub-thread based on the main thread.

[0096] During the implementation, the intelligent terminal creates a main thread. Then, in order to enable the main thread to obtain the target task to be executed from the first task queue, the main thread obtains and first executes the target task with the least number of dependencies in the first task queue.

[0097] Meanwhile, during the implementation process, on this basis, the intelligent terminal creates at least one sub-thread based on the main thread. Here, the specific number of sub-threads created can be flexibly adjusted according to the situation.

[0098] For example, when there are many target tasks to be executed in the child thread, the number of created child threads is relatively large. Assume that there are 100 target tasks, only 3 of which must be run in the main thread, and the remaining target tasks can be run in the child thread. In this case, the number of child threads can be set larger.

[0099] For another example, suppose there are 100 target tasks, and 50 of them must be run on the main thread. Then, the number of sub-threads should not be too many. In this case, too many sub-threads will not speed up the process, but will also occupy system resources.

[0100] Similarly, in order to enable the child thread to obtain the target task to be executed from the second task queue, the intelligent terminal will obtain and first execute the target task with the least number of dependencies in the second task queue through the child thread.

[0101] Step 202: The intelligent terminal sequentially obtains and executes each target task in the first task queue through the main thread, and obtains and executes each target task in the second task queue through each sub-thread of at least one sub-thread.

[0102] During implementation, see Figure 4 As shown, the intelligent terminal executes the target task in parallel through the main thread and at least one sub-thread, that is, while the main thread sequentially obtains and executes each target task in the first task queue, each sub-thread respectively obtains and executes each target task in the second task queue.

[0103] During the above-mentioned parallel execution of target tasks, the intelligent terminal obtains a target task in the first task queue through the main thread, so that the main thread executes the obtained target task. After one target task is executed, the main thread continues to obtain and execute the next target task in the first task queue until the first task queue is empty.

[0104] Specifically, the process implemented by the smart terminal through the main thread is: obtain the target tasks in the first task queue in turn, and after one target task is executed, continue to obtain the next target task in the first task queue and execute it until all target tasks in the first task queue are executed, that is, until the first task queue is empty.

[0105] It should be noted that the execution of the next target task (or the next next target task) depends on one target task, so the intelligent terminal first executes the one target task through the main thread.

[0106] During the implementation process, when the main thread of the intelligent terminal obtains the first target task in the first task queue, the target tasks of the second task queue are obtained through at least one sub-thread respectively, so that each sub-thread executes the different obtained target tasks in parallel. After the different target tasks are executed, each sub-thread continues to obtain and execute the next target task in the second task queue until the second task queue is empty.

[0107] The process implemented by the intelligent terminal through each sub-thread in at least one sub-thread is: obtaining the target tasks in the second task queue in turn, and after one target task is executed, continuing to obtain the next target task in the first task queue and execute it until all target tasks in the second task queue are executed, that is, until the second task queue is empty.

[0108] It should be noted that the execution of the next target task (or the next next target task) depends on one target task, so the intelligent terminal first executes the one target task through the child thread.

[0109] For example, assuming that in the second task queue, the order of target tasks from first to last is target task 1, target task 2, target task 3…, the implementation process is: child thread 1 first obtains the target task 1 in the second task queue and executes target task 1, child thread 2 obtains the target task 2 in the second task queue and executes target task 2, child thread 3 obtains the target task 3 in the second task queue and executes target task 3,… After child thread 2 executes target task 2, it obtains target task 4 in the second task queue and executes target task 4, after child thread 3 executes target task 3, it obtains target task 5 in the second task queue and executes target task 5, after child thread 1 executes target task 1, it obtains target task 6 in the second task queue and executes target task 6.

[0110] In addition, in the embodiment of the present application, on the other hand, the main thread can also execute the target task in the second task queue, and the process specifically includes:

[0111] If the smart terminal determines that the first task queue is empty and the second task queue is not empty, the smart terminal obtains and executes the remaining target tasks from the second task queue through the main thread, that is, the target task that the main thread must execute has been completed, and the target task that needs to be executed by the child thread has not been completed. In this case, the main thread acts as the child thread and, together with other child threads, obtains and executes the remaining target tasks from the second task queue.

[0112] In summary, the following situations may occur during the task scheduling process:

[0113] Case 1: the intelligent terminal obtains and executes the target task from the second task queue through each sub-thread in at least one sub-thread;

[0114] Case 2: The intelligent terminal obtains and executes the target task from the second task queue through the main thread and each of the at least one sub-thread;

[0115] In the above two situations, in the process of sequentially acquiring the target tasks, it is inevitable that a target task in the second task queue is omitted. In this case, the intelligent terminal increases the visibility of the target task.

[0116] During the implementation process, a flag can be set to represent the total number of target tasks that have been acquired. The specific process is that after the smart terminal puts the target task into the second task queue, the smart terminal also sets a flag for each target task in the second task queue, and the flag indicates the total number of target tasks that have been acquired.

[0117] During the specific implementation process, the intelligent terminal sets a flag for each target task in the second task queue. When a target task is obtained, the value of the flag is increased by one, and so on until the last target task is obtained. In this way, the flag can be used to indicate the total number of target tasks that have been obtained. This setting avoids the phenomenon of target tasks being missed, thereby effectively ensuring the integrity of the execution of target tasks. Further, by setting a global flag, the introduction of a locking mechanism in multi-threaded execution is avoided. The main thread and each sub-thread can obtain and execute the target tasks in an orderly manner from the second task queue under the guidance of the flag, thereby ensuring the operating performance.

[0118] Corresponding to the above situation 1, the process of the intelligent terminal acquiring and executing each target task in the second task queue through each sub-thread in at least one sub-thread specifically includes:

[0119] When a target task in the second task queue is acquired by any one of the at least one sub-threads, the intelligent terminal increases the value of the flag by one, so that any other sub-thread of the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

[0120] For example, assuming that the initial value of the flag is 0, and in the second task queue, the target tasks are in the order of target task 1, target task 2, target task 3..., when target task 1 is acquired by child thread 1, the value of the flag is increased by one, that is, the value of the flag is 1, indicating that target task 1 in the second task queue has been acquired by a child thread. In this case, any other child thread acquires and executes the next target task to be executed in the second task queue, that is, target task 2.

[0121] Corresponding to the above situation 2, if the smart terminal determines that the first task queue is empty, and the second task queue is not empty, the process further includes:

[0122] When a target task in the second task queue is acquired by any one of the at least one sub-threads, the intelligent terminal increases the value of the flag by one, so that the main thread or any other sub-thread of the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

[0123] For example, assuming that the initial value of the flag is 0, and in the second task queue, the target tasks are in the order of target task 1, target task 2, target task 3..., when target task 1 is acquired by child thread 1, the value of the flag is increased by one, that is, the value of the flag is 1, indicating that target task 1 in the second task queue has been acquired by a child thread. In this case, the main thread or any other child thread acquires and executes the next target task to be executed in the second task queue, that is, target task 2.

[0124] In addition, in the above two situations, it is inevitable that the same target task in the second task queue is obtained by multiple threads at the same time, that is, concurrent access to the second task queue occurs. In this case, the intelligent terminal adds atomicity to the target task to ensure the uniqueness of the target task being executed.

[0125] During the implementation process, if the smart terminal determines that the first task queue is empty and the second task queue is not empty, for the same target task, the smart terminal can also limit the acquisition and execution through one of the two threads. For details, see Figure 5 As shown, the process of acquiring and executing a target task through one of the two threads includes the following steps:

[0126] Step a: If the same target task in the second task queue is obtained by two threads at the same time, the intelligent terminal determines whether the value assigned to the flag bit is consistent with the total number of tasks obtained in the second task queue. If so, execute step b, otherwise, execute step c; wherein the two threads include a main thread and a sub-thread, or include two sub-threads.

[0127] In the process of the smart terminal jointly executing the target task in the second task queue through the main thread and at least one child thread, if the same target task is obtained by two threads at the same time, the smart terminal needs to determine whether the value assigned to the flag bit is consistent with the total number of tasks obtained in the second task queue, that is, the smart terminal determines whether the same target task has been obtained by one of the two threads.

[0128] Step b: The intelligent terminal executes the target task to be executed currently in the second task queue through one of the two threads.

[0129] That is, the intelligent terminal determines that the same target task has been acquired by one of the two threads. In this case, the intelligent terminal executes the current target task to be executed in the second task queue, that is, the same target task that has been acquired, through one of the two threads.

[0130] For example, assuming that the initial value of the flag is 0, and in the second task queue, the target tasks are in the order of target task 1, target task 2, target task 3..., when target task 1 is acquired by the main thread of the two threads, the value of the flag is increased by one, that is, the value of the flag is 1, indicating that the target task 1 in the second task queue has been acquired. In this case, the value 1 of the flag is consistent with the total number of tasks acquired in the second task queue, which is 1, and the main thread can execute the target task 1.

[0131] Step c: the intelligent terminal increases the assigned value by one, and obtains the next target task to be executed in the second task queue through one of the two threads.

[0132] That is, the intelligent terminal determines that the same target task has not been acquired by one of the two threads. In this case, the intelligent terminal acquires the next target task to be executed in the second task queue through one of the two threads.

[0133] For example, assuming that the initial value of the flag is 0, and the target tasks in the second task queue are in the order of target task 1, target task 2, target task 3..., when target task 1 is obtained, the value of the flag is increased by one, that is, the value of the flag is 1, and the smart terminal obtains the current target task 2 to be executed in the second task queue through one of the two threads, but the value of the flag has not been updated in time. In this case, the value 1 of the flag is inconsistent with the total number of tasks 2 obtained in the second task queue. The smart terminal increases the value by one, obtains the value of the flag as 2, and obtains the next target task to be executed in the second task queue, that is, target task 3, through one of the two threads.

[0134] The above embodiment is further described in detail below using several specific application scenarios.

[0135] Application scenario 1:

[0136] See also Figure 6As shown, it is assumed that there are 9 target tasks to be executed on the smart terminal, namely target task 1, target task 2, target task 3, target task 4, target task 5, target task 6, target task 7, target task 8 and target task 9. Among them, the target tasks that must be run through the main thread are target task 1, target task 2 and target task 3, and the target tasks that can be run outside the main thread are target task 4, target task 5, target task 6, target task 7, target task 8 and target task 9. In addition, it is assumed that the dependency relationship of the above 9 target tasks is that the latter target task depends on the previous target task. For details, refer to Figure 7 As shown, target task 2 depends on target task 1, target task 3 depends on target task 2; target task 5 depends on target task 4, target task 6 depends on target task 5, target task 7 depends on target task 6, target task 8 depends on target task 7, and target task 9 depends on target task 8.

[0137] During the implementation process, the intelligent terminal sorts the above 9 target tasks in the order of dependency of the target tasks, and the sorting results are: target task 1, target task 2, target task 3; and target task 4, target task 5, target task 6, target task 7, target task 8, and target task 9.

[0138] First, the intelligent terminal creates two empty first task queues a and second task queues b, where the first task queue a is used to store target tasks 1, 2 and 3 running in the main thread, and the second task queue b is used to store target tasks 4, 5, 6, 7, 8 and 9 running outside the main thread.

[0139] Secondly, the intelligent terminal creates a main thread 1 and two sub-threads based on the main thread 1, wherein the two sub-threads are sub-thread 1 and sub-thread 2. During the execution process, the intelligent terminal obtains a target task, namely, target task 1, in the first task queue a through the main thread 1, so that the main thread 1 executes the obtained target task 1. After the target task 1 is executed, the intelligent terminal continues to obtain and execute the next target task, namely, target task 2, in the first task queue a through the main thread 1 until the first task queue a is empty, namely, the target task 3 is executed.

[0140] While the smart terminal obtains the target task 1 (i.e., the first target task) in the first task queue a through the main thread 1, the smart terminal obtains the target task of the second task queue b through the sub-thread 1 and the sub-thread 2, so that the sub-thread 1 and the sub-thread 2 execute the different acquired target tasks in parallel. Assume that the sub-thread 1 executes the acquired target task 4, and the sub-thread 2 executes the acquired target task 5. After the target task 4 is executed, the smart terminal continues to obtain and execute the next target task in the second task queue b through the sub-thread 1, and after the target task 5 is executed, the smart terminal continues to obtain and execute the next target task in the second task queue b through the sub-thread 2 until the second task queue is empty.

[0141] Assume that, during the execution process, target tasks 1, 2 and 3 on the main thread 1 take a shorter time, and the smart terminal has completed executing the first task queue a through the main thread 1, while there are still target tasks 8 and 9 to be executed in the second task queue b, then the smart terminal obtains and executes the remaining target tasks from the second task queue b through the main thread 1.

[0142] In addition, the intelligent terminal sets a flag w for each target task in the second task queue b, where w represents the total number of target tasks that have been acquired in the second task queue b. Since the initial value of w is 0, when target tasks 4, 5, 6 and 7 in the second task queue b are all acquired, the value of w is 4 after being added by one four times in a row.

[0143] In the above case, if the intelligent terminal obtains target task 8 from the second task queue b through main thread 1 and sub-thread 1 at the same time, the intelligent terminal determines whether the value of w is consistent with the total number of tasks that have been obtained in the second task queue b. By comparing the value of w, which is 4, and the number of target tasks that have been obtained (target task 4, target task 5, target task 6, and target task 7), the result is consistent, indicating that target task 8 has not been obtained. At this time, the intelligent terminal obtains target task 8 through main thread 1 or sub-thread 1. Here, it is assumed that the main thread 1 obtains target task 8, and the value of w is not added in time, and the value of w is still 4.

[0144] During the continued execution, the intelligent terminal obtains target task 9 from the second task queue b through subthread 1 and subthread 2 at the same time. The intelligent terminal determines whether the value of w is consistent with the total number of tasks that have been obtained in the second task queue b. By comparing the value of w, which is 4, and the number of target tasks that have been obtained, which is 5 (target task 4, target task 5, target task 6, target task 7, and target task 8), if the result is inconsistent, the intelligent terminal adds one to the value of w, and obtains the value of w as 5, and obtains the next target task 9 to be executed in the second task queue through subthread 1 or subthread 2. Here, it is assumed that subthread 1 obtains target task 9. So far, each target task in the first task queue a and the second task queue b has been executed.

[0145] Based on the same inventive concept, refer to Figure 8 As shown, an embodiment of the present application provides a device for scheduling tasks, including:

[0146] The queue creation unit 810 is used to create a first task queue and a second task queue based on the dependency relationship between the target tasks, wherein the first task queue is used to store multiple target tasks running in the main thread, and the second task queue is used to store multiple target tasks running outside the main thread;

[0147] A thread creation unit 820, configured to create a main thread and at least one sub-thread based on the main thread;

[0148] The execution unit 830 is used to sequentially obtain and execute each target task in the first task queue through the main thread, and to obtain and execute each target task in the second task queue through each sub-thread of at least one sub-thread.

[0149] Optionally, based on the dependency relationship between the target tasks, a first task queue and a second task queue are created, and the queue creation unit 810 is used to:

[0150] Sort multiple target tasks according to the order of their dependencies;

[0151] Create a first task queue and a second task queue;

[0152] Multiple target tasks are obtained in sequence, wherein for each target task obtained, the following operations are performed:

[0153] Determine whether a target task currently obtained is a target task running in the main thread;

[0154] If so, based on the sorting result, put the target task into the first task queue;

[0155] Otherwise, based on the sorting result, the target task is placed in the second task queue.

[0156] Optionally, each target task in the first task queue is sequentially acquired and executed by the main thread, and each target task in the second task queue is acquired and executed by each sub-thread of at least one sub-thread, and the execution unit 830 is used to:

[0157] When the main thread obtains the first target task in the first task queue, the target tasks in the second task queue are obtained respectively through at least one sub-thread.

[0158] Optionally, it also includes:

[0159] A flag is set for the second task queue, where the flag indicates the total number of target tasks that have been acquired in the second task queue.

[0160] Optionally, it also includes:

[0161] If it is determined that the first task queue is empty, but the second task queue is not empty, the remaining target tasks are obtained and executed from the second task queue through the main thread.

[0162] Optionally, each target task in the second task queue is acquired and executed respectively by at least one sub-thread, and the execution unit 830 is used to:

[0163] When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value of the flag bit is increased by one, so that any other sub-thread in the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

[0164] Optionally, if it is determined that the first task queue is empty and the second task queue is not empty, the execution unit 830 is further configured to:

[0165] When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value of the flag bit is increased by one, so that the main thread or any other sub-thread of the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

[0166] Optionally, if it is determined that the first task queue is empty and the second task queue is not empty, the execution unit 830 is further configured to:

[0167] If the same target task in the second task queue is obtained by two threads at the same time, it is determined whether the value assigned to the flag bit is consistent with the total number of tasks obtained in the second task queue;

[0168] If so, executing the target task currently to be executed in the second task queue through one of the two threads;

[0169] Otherwise, the assigned value is increased by one, and the next target task to be executed in the second task queue is obtained through one of the two threads.

[0170] Optionally, the two threads include a main thread and one sub-thread, or include two sub-threads.

[0171] Based on the same inventive concept, see Fig. 9 As shown, an embodiment of the present disclosure provides a smart terminal 900. For example, the smart terminal 900 can be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.

[0172] Reference Fig. 9 The smart terminal 900 may include one or more of the following components: a processing component 902 , a memory 904 , a power component 906 , a multimedia component 9012 , an audio component 912 , an input / output (I / O) interface 912 , a sensor component 914 , and a communication component 916 .

[0173] The processing component 902 generally controls the overall operation of the intelligent terminal 900, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 902 may include one or more processors 920 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 902 may include one or more modules to facilitate the interaction between the processing component 902 and other components. For example, the processing component 902 may include a multimedia module to facilitate the interaction between the multimedia component 9012 and the processing component 902.

[0174] The memory 909 is configured to store various types of data to support operations on the smart terminal 900. Examples of such data include instructions for any application or method operating on the smart terminal 900, contact data, phone book data, messages, pictures, videos, etc. The memory 904 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0175] The power supply component 906 provides power to various components of the intelligent terminal 900. The power supply component 906 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the intelligent terminal 900.

[0176] The multimedia component 9012 includes a screen that provides an output interface between the smart terminal 900 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 9012 includes a front camera and / or a rear camera. When the smart terminal 900 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0177] The audio component 912 is configured to output and / or input audio signals. For example, the audio component 912 includes a microphone (MIC), and when the intelligent terminal 900 is in an operation mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 904 or sent via the communication component 916. In some embodiments, the audio component 912 also includes a speaker for outputting audio signals.

[0178] I / O interface 912 provides an interface between processing component 902 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0179] The sensor assembly 914 includes one or more sensors for providing various aspects of status assessment for the smart terminal 900. For example, the sensor assembly 914 can detect the open / closed state of the smart terminal 900, the relative positioning of the components, such as the display and keypad of the smart terminal 900, and the sensor assembly 914 can also detect the position change of the smart terminal 900 or a component of the smart terminal 900, the presence or absence of contact between the user and the smart terminal 900, the orientation or acceleration / deceleration of the smart terminal 900, and the temperature change of the smart terminal 900. The sensor assembly 914 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 914 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 914 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.

[0180] The communication component 916 is configured to facilitate wired or wireless communication between the smart terminal 900 and other devices. The smart terminal 900 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 4G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 916 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 916 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0181] In an exemplary embodiment, the intelligent terminal 900 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute any one of the methods of the first aspect described above.

[0182] Based on the same inventive concept, an embodiment of the present application provides a computer-readable storage medium. When instructions in the storage medium are executed by a processor, the processor is enabled to execute the method described in any one of the first aspects above.

[0183] Based on the same inventive concept, an embodiment of the present application provides a computer program product, comprising executable instructions. When the executable instructions of the computer program product are executed by a processor, the method described in any one of the first aspects above can be implemented.

[0184] To sum up, in the embodiment of the present application, the intelligent terminal creates a first task queue and a second task queue based on the dependency relationship between the target tasks, which are used to store multiple target tasks running in the main thread and multiple target tasks running outside the main thread, respectively, thereby solving the requirement that the target tasks must be run in the specified thread; and the intelligent terminal creates a main thread and creates at least one sub-thread based on the main thread, so that during the implementation process, the intelligent terminal sequentially obtains and executes each target task in the first task queue through the main thread, and obtains and executes each target task in the second task queue through each sub-thread of at least one sub-thread. Since the above-mentioned first task queue and the second task queue are created based on the dependency relationship between the target tasks, under the premise of processing target tasks with dependencies, the balanced scheduling of the target tasks can be guaranteed, so that while the target tasks can be run through the main thread, other target tasks can also be run through the above-mentioned at least one sub-thread, realizing the parallel execution of the main thread and multiple sub-threads, achieving the purpose of balanced operation of each thread, further improving the execution efficiency of the target tasks, and thus making the scheduling of the target tasks between threads more balanced.

[0185] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program product systems. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product system implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.

[0186] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program product systems according to the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0187] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0188] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process in the computer or other programmable device. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0189] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A method for scheduling tasks, characterized in that: The method includes: Based on the dependency relationship between the target tasks, a first task queue and a second task queue are created, wherein the first task queue is used to store multiple target tasks running in the main thread, and the second task queue is used to store multiple target tasks running outside the main thread; Create a main thread and create at least one child thread based on the main thread; Setting a flag bit for the second task queue, wherein the flag bit indicates the total number of target tasks that have been acquired in the second task queue; Sequentially acquiring and executing each target task in the first task queue through the main thread, and acquiring and executing each target task in the second task queue through the at least one sub-thread; If the same target task in the second task queue is obtained by two threads at the same time, determining whether the value assigned to the flag bit is consistent with the total number of tasks obtained in the second task queue; If so, executing the target task currently to be executed in the second task queue through one of the two threads; Otherwise, the assigned value is increased by one, and the next target task to be executed in the second task queue is obtained through one of the two threads.

2. The method according to claim 1, characterized in that The creating of the first task queue and the second task queue based on the dependency relationship between the target tasks includes: Sorting the multiple target tasks according to the order of their dependencies; Creating the first task queue and the second task queue; The multiple target tasks are acquired in sequence, wherein for each acquired target task, the following operations are performed: Determine whether a target task currently obtained is a target task running in the main thread; If so, based on the sorting result, put the target task into the first task queue; Otherwise, based on the sorting result, the target task is placed in the second task queue.

3. The method according to claim 1 or 2, characterized in that The method of sequentially acquiring and executing each target task in the first task queue through the main thread, and acquiring and executing each target task in the second task queue through the at least one sub-thread, includes: When the main thread obtains the first target task in the first task queue, the target tasks in the second task queue are respectively obtained through the at least one sub-thread.

4. The method according to claim 3, characterized in that Also includes: If it is determined that the first task queue is empty, but the second task queue is not empty, the remaining target tasks are obtained and executed from the second task queue through the main thread.

5. The method according to claim 3, characterized in that The acquiring and executing each target task in the second task queue respectively by the at least one sub-thread includes: When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value of the flag bit is increased by one, so that any other sub-thread in the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

6. The method according to claim 3, characterized in that If it is determined that the first task queue is empty and the second task queue is not empty, the method further includes: When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value assigned to the flag bit is increased by one, so that the main thread or any other sub-thread of the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

7. The method according to claim 3, characterized in that The two threads include the main thread and one sub-thread, or include two sub-threads.

8. A device for scheduling tasks, characterized in that: include: A queue creation unit, configured to create a first task queue and a second task queue based on the dependency relationship between the target tasks, wherein the first task queue is used to store multiple target tasks running in the main thread, and the second task queue is used to store multiple target tasks running outside the main thread; A thread creation unit, used to create a main thread and create at least one sub-thread based on the main thread; an execution unit, configured to set a flag bit for the second task queue, wherein the flag bit indicates a total number of target tasks that have been acquired in the second task queue; Sequentially acquiring and executing each target task in the first task queue through the main thread, and acquiring and executing each target task in the second task queue through each sub-thread of the at least one sub-thread; If the same target task in the second task queue is obtained by two threads at the same time, determining whether the value assigned to the flag bit is consistent with the total number of tasks obtained in the second task queue; If so, executing the target task currently to be executed in the second task queue through one of the two threads; Otherwise, the assigned value is increased by one, and the next target task to be executed in the second task queue is obtained through one of the two threads.

9. The device according to claim 8, characterized in that The first task queue and the second task queue are created based on the dependency relationship between the target tasks, and the queue creation unit is used to: Sorting the multiple target tasks according to the order of their dependencies; Creating the first task queue and the second task queue; The multiple target tasks are acquired in sequence, wherein for each acquired target task, the following operations are performed: Determine whether a target task currently obtained is a target task running in the main thread; If so, based on the sorting result, put the target task into the first task queue; Otherwise, based on the sorting result, the target task is placed in the second task queue.

10. The device according to claim 8 or 9, characterized in that The main thread is used to sequentially obtain and execute each target task in the first task queue, and each sub-thread in the at least one sub-thread is used to obtain and execute each target task in the second task queue, wherein the execution unit is used to: When the main thread obtains the first target task in the first task queue, the target tasks in the second task queue are respectively obtained through the at least one sub-thread.

11. The device according to claim 10, characterized in that Also includes: If it is determined that the first task queue is empty, but the second task queue is not empty, the remaining target tasks are obtained and executed from the second task queue through the main thread.

12. The device according to claim 10, characterized in that The at least one sub-thread is used to respectively obtain and execute each target task in the second task queue, and the execution unit is used to: When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value of the flag bit is increased by one, so that any other sub-thread in the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

13. The device according to claim 10, characterized in that If it is determined that the first task queue is empty and the second task queue is not empty, the execution unit is further configured to: When a target task in the second task queue is acquired by any one of the at least one sub-threads, the value assigned to the flag bit is increased by one, so that the main thread or any other sub-thread of the at least one sub-thread acquires and executes the next target task to be executed in the second task queue.

14. The device according to claim 10, characterized in that The two threads include the main thread and one sub-thread, or include two sub-threads.

15. An intelligent terminal, characterized in that: include: A memory for storing executable instructions; A processor, configured to read and execute the executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.

16. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor, the processor is enabled to perform the method according to any one of claims 1 to 7.

17. A computer program product, characterized in that The computer program product comprises executable instructions. When the executable instructions of the computer program product are executed by a processor, the method according to any one of claims 1 to 7 can be implemented.