Multi-task parallel execution method and device, equipment and storage medium

By adopting a multi-task parallel execution method in the experimental workstation and using the global lock mechanism to process other tasks in a timely manner after the long-term task unit is completed, the problem of low processing efficiency of experimental tasks is solved and efficient parallel execution of tasks is achieved.

CN120448046APending Publication Date: 2025-08-08SHENZHEN JINGTAI TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410177021.4
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-02-08
Publication Date
2025-08-08

AI Technical Summary

Technical Problem

In the prior art, when an experimental workstation performs multiple experimental tasks, long-term steps will cause other tasks to be unable to be processed, resulting in inefficient processing.

Method used

The multi-task parallel execution method is adopted. By performing other tasks at the same time when executing long-term task units, the remaining task units continue to be executed when conditions allow, and the global lock mechanism is used to ensure safe parallelism of tasks.

Benefits of technology

It improves the processing efficiency of experimental tasks, ensures that other tasks are processed in a timely manner after long-term tasks are completed, and improves the utilization rate of workstations.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120448046A_ABST
    Figure CN120448046A_ABST
Patent Text Reader

Abstract

The invention provides a multi-task parallel execution method and device, equipment and a storage medium, and the method comprises the steps: executing a second task while executing a specific task unit in a first task; wherein one task comprises at least one task unit; the specific task unit represents a task unit of which the time required for executing the operation exceeds a preset time threshold value; and under the condition that the specific task unit in the first task is executed and the second task is not in the task locking state, continuing to execute the remaining task units in the first task. According to the technical scheme, the processing efficiency of the experiment task can be effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of automation technology, and in particular to a method, apparatus, device, and storage medium for parallel execution of multiple tasks. Background Art

[0002] Currently, experimental workstations are used to perform various tasks, and one task can include multiple experiments.

[0003] In related technologies, when executing a task that includes multiple experiments, it is necessary to execute multiple steps in each experiment in sequence. If the processing time of any step is as long as several hours or even days, other experimental tasks cannot be processed before the step is completed, resulting in low processing efficiency of experimental tasks in the workstation. Summary of the Invention

[0004] In order to solve the above problems, the present application proposes a multi-task parallel execution method, device, equipment and storage medium, which can significantly improve the processing efficiency of experimental tasks.

[0005] According to a first aspect of an embodiment of the present application, a method for executing multiple tasks in parallel is provided, comprising:

[0006] While executing a specific task unit in the first task, executing the second task simultaneously; wherein a task includes at least one task unit; the specific task unit refers to a task unit whose execution time exceeds a preset time threshold;

[0007] When a specific task unit in the first task is completed and the second task is not in a task-locked state, the remaining task units in the first task continue to be executed.

[0008] According to a second aspect of an embodiment of the present application, a multi-task parallel execution apparatus is provided, comprising:

[0009] A first execution module is configured to simultaneously execute a second task while executing a specific task unit in the first task; wherein a task includes at least one task unit; the specific task unit is a task unit whose execution time exceeds a preset time threshold;

[0010] The second execution module is configured to continue executing the remaining task units in the first task when a specific task unit in the first task is completed and the second task is not in a task-locked state.

[0011] A third aspect of the present application provides an electronic device, including:

[0012] memory and processor;

[0013] The memory is connected to the processor and is used to store programs;

[0014] The processor implements the above-mentioned multi-task parallel execution method by running the program in the memory.

[0015] A fourth aspect of the present application provides a storage medium having a computer program stored thereon. When the computer program is executed by a processor, the multi-task parallel execution method described above is implemented.

[0016] A fifth aspect of the present application provides a computer program product, comprising a computer program, which implements the above-mentioned multi-task parallel execution method when executed by a processor.

[0017] One embodiment of the above application has the following advantages or beneficial effects:

[0018] Since the time taken to execute the operation of the specific task unit exceeds the preset time threshold, when the specific task unit of the first task is executed, the specific task unit of the first task and the second task are executed at the same time. If the specific task unit in the first task is completed, it is determined whether the second task is in the task lock state. If the second task is not in the task lock state, that is, it is not only the second task that is executed, then the remaining task units of the first task are continued to be executed. In this way, when the processing time of any step in the current experimental task is too long, other experimental tasks can be processed in parallel in a timely manner, while ensuring that the current experimental task can be completed in time, thereby improving the processing efficiency of the experimental task. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are merely embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without any creative work.

[0020] Figure 1 A flowchart of a multi-task parallel execution method provided in an embodiment of the present application;

[0021] Figure 2 A flowchart of another multi-task parallel execution method provided in an embodiment of the present application;

[0022] Figure 3 A schematic diagram of a specific flow chart of a method for executing multiple tasks in parallel provided in an embodiment of the present application;

[0023] Figure 4 A schematic diagram of the structure of a multi-task parallel execution device provided in an embodiment of the present application;

[0024] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

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

[0026] Exemplary Methods

[0027] Figure 1 1 is a flow chart of a method for executing multiple tasks in parallel according to an embodiment of the present application. In an exemplary embodiment, a method for executing multiple tasks in parallel is provided, comprising:

[0028] S110. While executing a specific task unit in the first task, simultaneously execute the second task; wherein a task includes at least one task unit; the specific task unit is a task unit whose execution time exceeds a preset time threshold;

[0029] S120: When a specific task unit in the first task is completed and the second task is not in a task-locked state, continue to execute the remaining task units in the first task.

[0030] In step S110, illustratively, the task may represent an experimental task in an automated device. The automated device may be regarded as a large device comprising multiple functional modules, such as an automated workstation. For example, the automated device may include, but is not limited to: a handling module for realizing material transfer (such as a multi-degree-of-freedom robotic arm, an XYZ three-axis translation mechanism, etc.), a powder adding module for realizing a powder adding function, a liquid adding module for realizing a liquid adding function, a stirring module / oscillation module for realizing a mixing function, a detection module for realizing a detection function (such as a UPLC / LCMS detection module, etc.), and the like. Optionally, the experimental task may be a chemical experimental task, or other types of experimental tasks, such as a biological experimental task, which is not limited here.

[0031] Different functional modules can be used individually or in combination to complete different experiments. An experiment can be viewed as a single or series of experimental steps centered around a specific entity, such as preparing or testing a substance. This specific entity can be viewed as a container for the substance. One or more experiments can constitute a task, an experiment can be viewed as a subtask within the task, and the steps within the experiment can be viewed as task units. In other words, a task can include one or more experiments (i.e., subtasks), an experiment can include one or more experimental steps (i.e., task units), and a task can contain one or more task units. A task unit can be viewed as the smallest execution unit of a task, and a task unit can include one or more operations. An operation can be viewed as an abstract, hardware-independent, and specific action flow. For example, a task might include a preparation experiment, which includes task units such as adding powder, adding liquid, shaking, centrifuging, and filtering. The centrifugation task unit might be implemented by moving the tray (test tubes are on the tray), closing the test tube cap (if the test tubes are not closed), moving the test tubes (to the centrifuge), centrifuging (starting the centrifuge), and moving the test tubes (after centrifugation, moving them to their destination).

[0032] Exemplarily, a task includes multiple task units, and the time required for the execution of each task unit can be judged against a preset time threshold. If the preset time threshold is exceeded, the task unit is determined to be a specific task unit. Specifically, when executing the first task, each task unit in the first task is executed in sequence according to the task execution logic. In the case of executing a specific task unit, other tasks cannot be executed due to the longer task unit time, which will affect the work efficiency of the entire workstation. Therefore, the second task after the first task is obtained in the task execution logic, and the execution of the second task is controlled. The second task can be a task that is adjacent to the first task in the task execution logic, or it can be a non-adjacent task, and there is no resource conflict between the first task and the second task in the task units that are executed simultaneously. The preset time threshold can be set according to the experimental requirements, such as 10min, 20min, 30min, 60min or other values.

[0033] Preferably, the method for determining the task lock state includes: determining that the task is in the task lock state when a task occupies the lock identifier; and determining that the task is not in the task lock state when the task releases the lock identifier.

[0034] Exemplarily, the lock identifier can be a pre-introduced global lock, which is a heavyweight lock, also known as a mutex lock. It is an exclusive lock, that is, only one thread (task) can obtain the lock at the same time. The thread that obtains the global lock can safely access shared resources, and other threads must wait for the lock to be released before continuing to execute. Specifically, if task A occupies the global lock, task A is in the task lock state, task A can be executed, and other tasks will be blocked and cannot be executed when they are started. If task A releases the global lock, task A is no longer in the task lock state, and other tasks can be executed after obtaining the global lock.

[0035] Furthermore, the task releases the lock identifier, including: releasing the lock identifier occupied by the task when the task meets preset conditions; wherein the preset conditions include: all task units in the task are executed; and / or the task executes a specific task unit.

[0036] Specifically, the completion of all task units in a task indicates that the operations corresponding to each task unit in the task have been completed. Taking the first task as an example, a determination is made as to whether all task units in the first task have been completed. If so, the global lock is released; otherwise, the first task still occupies the global lock. Alternatively, a determination is made as to whether the currently executing or next executing task unit is a specific task unit. If so, the global lock is released; otherwise, the first task still occupies the global lock.

[0037] Alternatively, first determine whether all task units in the first task have been completed. If not, determine whether the currently executed or next executed task unit is a specific task unit. If so, release the global lock; if not, the first task still holds the global lock. In this way, the lock flag (i.e., the global lock) is used to determine the task status and control the safe parallel execution of multiple tasks.

[0038] Specifically, after the first task obtains the global lock, the first task begins to execute. When the specific task unit in the first task enters execution or is about to be executed, the global lock is released. At this time, the specific task unit in the first task is still executing normally. After the second task obtains the global lock, the second task also begins to execute. At this time, the second task and the first task are in a parallel execution state. Furthermore, after the specific task unit in the first task is executed, it is determined whether the second task meets the preset conditions. If so, the global lock occupied by the second task is released. At this time, the second task is not in a task locked state, indicating that it can be executed in parallel with other tasks. After regaining the global lock, the first task continues to execute the remaining task units in the first task.

[0039] In the technical solution of the present application, since the time for the operation executed by the specific task unit exceeds the preset time threshold, when the first task executes the specific task unit, the specific task unit of the first task and the second task are executed at the same time. If the specific task unit in the first task is completed, it is determined whether the second task is in a task-locked state. If the second task is not in a task-locked state, that is, not only the second task is executed, then the remaining task units of the first task continue to be executed. In this way, when the processing time of any step in the current experimental task is too long, other experimental tasks can be processed in parallel in a timely manner, while ensuring that the current experimental task can be completed in time, thereby improving the processing efficiency of experimental tasks in the workstation.

[0040] Furthermore, if Figure 2 As shown, the method further includes:

[0041] S120′: When the specific task unit in the first task is completed and the second task is in the task-locked state, continue to execute the second task.

[0042] For example, after a specific task unit in the first task is executed, it is determined whether the second task meets the preset conditions (i.e., all task units in the second task are executed; or, the second task executes a specific task unit). If not, the second task still occupies the lock flag, that is, the second task is in the task lock state, and other tasks cannot obtain the lock flag to start execution. Therefore, the task units in the second task continue to execute until the second task meets the preset conditions. In this way, based on the task lock state, it is possible to effectively determine whether tasks can be safely run in parallel.

[0043] In one embodiment, the step S120′ of continuing to execute the second task when the specific task unit in the first task is completed and the second task is in a task-locked state includes:

[0044] determining whether a specific task unit in the first task is the last task unit in the first task;

[0045] If not, when the specific task unit in the first task is completed and the second task is in the task-locked state, the second task continues to be executed and the first task is controlled to enter the waiting state.

[0046] Specifically, when it is determined that a specific task unit in the first task is not the last task unit in the first task, it means that there are still unexecuted task units in the first task. Therefore, it is necessary to determine whether the task can be executed in parallel with the second task. If the second task does not meet the preset conditions (i.e., the second task occupies the lock mark), the second task is in the task lock state and continues to execute the second task. It can be seen that the second task cannot be executed in parallel with other tasks, and the first task is controlled to enter the waiting state until the second task is no longer in the task lock state (i.e., the lock mark is released), and then the remaining task units in the first task are executed.

[0047] Furthermore, if it is determined that the specific task unit in the first task is the last task unit in the first task, the first task is terminated. If the second task is in the task lock state, other tasks in the task execution logic are controlled to enter a waiting state.

[0048] In one embodiment, step S110, while executing a specific task unit in the first task, simultaneously executing the second task, includes:

[0049] When a specific task unit in the first task is executed and the first task is not in a task-locked state, if the second task is in a task-locked state, the second task is executed simultaneously.

[0050] For example, when a first task executes a specific task unit, since the specific task unit is a long-term operation, the first task is set to not be in a task lock state (i.e., the lock flag occupied by the first task is released), that is, the first task can be executed in parallel with other tasks. Then, a second task in the task execution logic is obtained and its state is set to a task lock state (i.e., a lock flag is assigned to the second task), thereby starting the second task, so that the specific task unit of the first task can be executed in parallel with the second task.

[0051] Furthermore, when executing a specific task unit in the first task and the first task is not in a task-locked state, if the second task is in a task-locked state, executing the second task simultaneously includes:

[0052] Allocating a lock identifier to a first task according to task execution logic, and executing task units in the first task;

[0053] When a specific task unit in the first task is executed, the lock identifier is released from the first task, and the lock identifier is allocated to a second task, and the second task is executed in parallel.

[0054] Specifically, when execution begins according to the task execution logic, in order to ensure the sequential execution of tasks, the first unexecuted task in the task execution logic (i.e., the first task) acquires a global lock, and the first task begins to execute the task units therein. Before each task unit is executed, it is necessary to determine whether it is a specific task unit. If so, it means that the first task requires a long operation, and the global lock is released. The global lock is then assigned to the next task after the first task (i.e., the second task) according to the task execution logic. At this time, the specific task unit of the first task can be executed in parallel with the second task.

[0055] Furthermore, the step S120 of continuing to execute the remaining task units in the first task when the specific task unit in the first task is completed and the second task is not in the task-locked state includes:

[0056] When the second task is completed or a specific task unit in the second task is executed, releasing the locking identifier from the second task;

[0057] After the specific task unit in the first task is executed, the locking identifier is reallocated to the first task, and the remaining task units in the first task continue to be executed.

[0058] Specifically, if the second task has been completed or has entered the specific task unit of the second task, the second task releases the global lock. Then determine whether the specific task unit in the first task has been executed. If it has been executed, assign the global lock to the first task so that the first task can continue to execute the remaining task units in the first task. Furthermore, after determining that the specific task unit of the first task has been executed, it is also necessary to determine whether the specific task unit is the last task unit of the first task. If not, assign the global lock to the first task so that the first task can continue to execute the remaining task units in the first task. If so, end the first task. Then, according to the task execution logic, assign the global lock to the third task after the second task, and execute the third task.

[0059] Furthermore, after releasing the lock identifier from the second task, the method further includes:

[0060] If the specific task unit in the first task has not been completed, assigning the lock identifier to a third task and executing the third task in parallel;

[0061] When the third task is completed or a specific task unit in the third task is executed, the locking identifier is released from the third task.

[0062] Specifically, if the second task has completed or entered a specific task unit of the second task, the second task releases the global lock. It is determined whether the specific task unit in the first task has been completed. If not, the global lock is assigned to a third task following the second task according to the task execution logic, so that the third task and the specific task unit in the first task are executed in parallel.

[0063] If the third task has not released the global lock and the specific task unit of the first task has been executed, the first task is controlled to enter a waiting state. If the third task has been completed or has entered the specific task unit of the third task, the third task releases the global lock. When the specific task unit of the first task has been executed, the global lock is assigned to the first task, so that the remaining task units in the first task can continue to be executed. Alternatively, if the specific task unit of the first task has not been executed but the specific task unit of the second task has been executed, the global lock is assigned to the second task, so that the remaining task units in the second task can continue to be executed. In this way, safe parallelism between tasks can be achieved efficiently.

[0064] In one embodiment, when executing a specific task unit in the first task, releasing the lock identifier from the first task, assigning the lock identifier to a second task, and executing the second task in parallel includes:

[0065] When executing a specific operation in a specific task unit of the first task, releasing the lock identifier from the first task, assigning the lock identifier to a second task, and executing the second task in parallel; wherein a task unit includes at least one operation, and the specific operation represents an operation whose execution time exceeds a preset time threshold;

[0066] The step S120, when a specific task unit in the first task is completed and the second task is not in a task-locked state, continues to execute the remaining task units in the first task, including:

[0067] When the specific operation in the specific task unit of the first task is completed and the second task is not in the task-locked state, the remaining operations in the specific task unit of the first task continue to be executed until all task units in the first task are completed.

[0068] Specifically, before or at the start of a specific operation, the first task releases the global lock and assigns the global lock to the second task according to the task execution logic. At this time, the specific task unit of the first task can be executed in parallel with the task unit in the second task.

[0069] After the specific operation of a specific task unit in the first task is completed, if the second task has completed or entered the specific operation of the second task, the second task releases the global lock. The first task can acquire the global lock again to enable the first task to execute the remaining operations in the specific task unit until all task units in the first task are completed. It is understood that if the specific operation is the last operation of the specific task unit in the first task, the next task unit of the specific task unit in the first task will continue to be executed until all task units are completed.

[0070] In one embodiment, after executing the second task while executing the specific task unit in the first task, the method further includes:

[0071] When the specific task unit in the first task is not completely executed, if the second task needs to use the resources used by the specific task unit in the first task during execution, execution of the second task is stopped.

[0072] For example, when executing a specific task unit in the first task, the first task releases the global lock and assigns the global lock to the second task, and the second task is executed at this time. If the resources (such as functional modules, containers, etc.) required for the execution of the second task are occupied by the specific task unit, it means that there is a conflict between the first task and the second task, and the execution of the second task is stopped. In this way, the safe execution of the first task is guaranteed, and the conflict between the first task and the second task is avoided during execution. At this time, the global lock occupied by the second task can be released and assigned to the subsequent task so that the subsequent task is executed in parallel with the first task. It is understandable that before assigning a global lock to the next task of the first task, it is also possible to first determine whether the resources required by the next task conflict with the resources currently occupied by the first task. If there is no conflict, the next task is determined as the second task and assigned a global lock; if there is a conflict, it is further determined whether the resources required by the next task conflict with the resources currently occupied by the first task. If there is no conflict, the next task is determined as the second task and assigned a global lock.

[0073] In order to facilitate the understanding of the above technical solution, the following examples are given:

[0074] Because the order of experimental steps cannot be changed, tasks must be executed sequentially to ensure sequential order, resulting in low utilization of execution equipment. For example, if a batch of experimental tasks includes a oscillation step (task unit) that lasts for hours or even days, other tasks cannot be executed until the oscillation is complete. If a batch of experimental tasks does not require oscillation, then theoretically, the non-oscillation-requiring tasks should be able to safely run in parallel with the oscillation task. This requirement can be met through the aforementioned task parallelization method. The user can manually or automatically split the two batches of experiments (oscillation and non-oscillation) into two tasks, parallelizing them at the task level and ensuring parallel safety using a "task reentrant global lock" mechanism. "Task reentrant global lock" means that if a task has already acquired the lock, reacquiring the same lock by other logic within the task (other task units) will not affect the task. However, acquiring the lock by other tasks will block the other tasks. If the lock has already been released by the task, reacquiring the same lock by other logic within the task (other task units) will not affect the task.

[0075] like Figure 3 As shown, Task A and Task B are retrieved from the task queue. Task A executes slightly before Task B (in multithreaded parallelism, Task A and Task B execute in different threads). Task A first acquires the global lock and enters the normal task execution process. However, because the global lock is already held, Task B is blocked upon startup. Before executing a long operation, Task A releases the global lock (while the long operation is still in progress), allowing Task B to execute. After Task A completes its long operation, if Task B has already completed or entered a long operation and released the global lock, Task A can acquire the global lock and continue execution. Otherwise, Task A will wait until it acquires the global lock before continuing. The global lock ensures that only the current task can execute a long operation. If other tasks also use the same device (i.e., hardware resources) as the long operation, this indicates a conflict and cannot be safely executed in parallel. In this case, resource status can be determined during resource allocation, and if the device is unavailable, the task can exit parallelism or block. Alternatively, the device status can be determined within the task unit, leading to blocking or exiting the task. This ensures the safety of task parallelism. It is understood that multiple task units within a task can be executed serially, in parallel, or in a combination of serial and parallel execution, without limitation here. There can be one or more specific task units (long-term operations) within a task. If there are multiple, the global lock can be released each time a long-term operation is entered.

[0076] Compared to single-task serial logic, this embodiment introduces a queue to receive multiple tasks. Tasks are executed by executors, and two tasks executed in parallel correspond to different executors. For executors, this embodiment only adds the steps of acquiring and releasing the global lock before and after task execution. For task units, they only need to release the global lock before executing a long operation and acquire the lock after the long operation ends, without adding much additional burden to task unit development.

[0077] Exemplary devices

[0078] Accordingly, Figure 4 FIG. 1 is a schematic diagram of a multi-task parallel execution apparatus according to an embodiment of the present application. In an exemplary embodiment, a multi-task parallel execution apparatus is provided, comprising:

[0079] A first execution module 410 is configured to execute a second task simultaneously with executing a specific task unit in the first task; wherein a task includes at least one task unit; the specific task unit is a task unit whose execution time exceeds a preset time threshold;

[0080] The second execution module 420 is configured to continue executing the remaining task units in the first task when a specific task unit in the first task is completed and the second task is not in a task-locked state.

[0081] In one embodiment, the apparatus further comprises:

[0082] The third execution module is configured to continue executing the second task when a specific task unit in the first task is completed and the second task is in a task-locked state.

[0083] In one embodiment, the third execution module is specifically configured to:

[0084] determining whether a specific task unit in the first task is the last task unit in the first task;

[0085] If not, when the specific task unit in the first task is completed and the second task is in the task-locked state, the second task continues to be executed and the first task is controlled to enter the waiting state.

[0086] In one embodiment, the method for determining the task lock state includes:

[0087] If there is a task occupying a lock flag, determine that the task is in a task lock state;

[0088] When the task releases the lock flag, it is determined that the task is not in the task lock state.

[0089] In one embodiment, the task releasing the lock flag includes:

[0090] When the task meets the preset conditions, the lock identifier occupied by the task is released;

[0091] The preset conditions include: all task units in the task are completed; and / or the task executes a specific task unit.

[0092] In one embodiment, the first execution module 410 is specifically configured to:

[0093] When a specific task unit in the first task is executed and the first task is not in a task-locked state, if the second task is in a task-locked state, the second task is executed simultaneously.

[0094] In one embodiment, when the first execution module 410 executes a specific task unit in the first task and the first task is not in a task-locked state, if the second task is in a task-locked state, executing the second task simultaneously includes:

[0095] Allocating a lock identifier to a first task according to task execution logic, and executing task units in the first task;

[0096] When a specific task unit in the first task is executed, the lock identifier is released from the first task, and the lock identifier is allocated to a second task, and the second task is executed in parallel.

[0097] In one embodiment, the first execution module 410 releases the lock identifier from the first task when executing a specific task unit in the first task, assigns the lock identifier to a second task, and executes the second task in parallel, including:

[0098] When executing a specific operation in a specific task unit of the first task, releasing the lock identifier from the first task, assigning the lock identifier to a second task, and executing the second task in parallel; wherein a task unit includes at least one operation, and the specific operation represents an operation whose execution time exceeds a preset time threshold;

[0099] When a specific task unit in the first task is completed and the second task is not in a task-locked state, the second execution module 420 continues to execute the remaining task units in the first task, including:

[0100] When the specific operation in the specific task unit of the first task is completed and the second task is not in the task-locked state, the remaining operations in the specific task unit of the first task continue to be executed until all task units in the first task are completed.

[0101] In one embodiment, when a specific task unit in the first task is completed and the second task is not in a task-locked state, the second execution module 420 continues to execute the remaining task units in the first task, including:

[0102] When the second task is completed or a specific task unit in the second task is executed, releasing the locking identifier from the second task;

[0103] After the specific task unit in the first task is executed, the locking identifier is reallocated to the first task, and the remaining task units in the first task continue to be executed.

[0104] In one embodiment, after releasing the lock identifier from the second task, the second execution module 420 is further configured to:

[0105] If the specific task unit in the first task has not been completed, assigning the lock identifier to a third task and executing the third task in parallel;

[0106] When the third task is completed or a specific task unit in the third task is executed, the locking identifier is released from the third task.

[0107] In one embodiment, the apparatus further comprises:

[0108] The fourth execution module is configured to stop executing the second task if the specific task unit in the first task is not completely executed and if the second task needs to use resources used by the specific task unit in the first task.

[0109] The multi-task parallel execution device provided in this embodiment is based on the same application concept as the multi-task parallel execution method provided in the above-mentioned embodiments of this application. It can execute the multi-task parallel execution method provided in any of the above-mentioned embodiments of this application and has the corresponding functional modules and beneficial effects of executing the multi-task parallel execution method. For technical details not fully described in this embodiment, please refer to the specific processing content of the multi-task parallel execution method provided in the above-mentioned embodiments of this application, and will not be repeated here.

[0110] Exemplary electronic devices

[0111] Another embodiment of the present application further provides an electronic device, see Figure 5 As shown, the electronic equipment includes:

[0112] Memory 500 and processor 510;

[0113] The memory 500 is connected to the processor 510 and is used to store programs;

[0114] The processor 510 is configured to implement the multi-task parallel execution method disclosed in any of the above embodiments by running the program stored in the memory 500 .

[0115] Specifically, the electronic device may further include: a bus, a communication interface 520 , an input device 530 and an output device 540 .

[0116] The processor 510, the memory 500, the communication interface 520, the input device 530 and the output device 540 are interconnected via a bus.

[0117] A bus may include a pathway that transfers information between components of a computer system.

[0118] Processor 510 can be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, or the like, or an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present invention. Alternatively, it can be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware components.

[0119] The processor 510 may include a main processor, and may also include a baseband chip, a modem, and the like.

[0120] The memory 500 stores a program for executing the technical solution of the present invention, and may also store an operating system and other key services. Specifically, the program may include program code, which includes computer operating instructions. More specifically, the memory 500 may include read-only memory (ROM), other types of static storage devices that can store static information and instructions, random access memory (RAM), other types of dynamic storage devices that can store information and instructions, disk storage, flash, etc.

[0121] The input device 530 may include a device for receiving data and information input by a user, such as a keyboard, a mouse, a camera, a scanner, a light pen, a voice input device, a touch screen, a pedometer, or a gravity sensor.

[0122] Output device 540 may include devices that allow information to be output to a user, such as a display screen, printer, speakers, etc.

[0123] The communication interface 520 may include any device such as a transceiver to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.

[0124] The processor 510 executes the program stored in the memory 500 and calls other devices, and can be used to implement each step of any multi-task parallel execution method provided in the above embodiments of the present application.

[0125] Exemplary computer program products and storage media

[0126] In addition to the above-mentioned methods and devices, an embodiment of the present application may also be a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the parallel execution method of multiple tasks according to various embodiments of the present application described in the above-mentioned "Exemplary Method" section of this specification.

[0127] The computer program product may be written in any combination of one or more programming languages to implement the program code for performing the operations of the embodiments of the present application, including object-oriented programming languages such as Java, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computing device, partially on the user's computing device, as a standalone software package, partially on the user's computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0128] In addition, an embodiment of the present application may also be a storage medium on which a computer program is stored, and the computer program is executed by a processor to execute the steps of the parallel execution method of multiple tasks according to various embodiments of the present application described in the above "Exemplary Method" section of this specification. The specific working content of the above-mentioned electronic device, as well as the specific working content of the above-mentioned computer program product and the computer program on the storage medium when being executed by the processor, can all be referred to the contents of the above-mentioned method embodiment and will not be repeated here.

[0129] For the sake of simplicity, the aforementioned method embodiments are described as a series of action combinations. However, those skilled in the art should be aware that this application is not limited by the order of the actions described, because according to this application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions and modules involved are not necessarily required by this application.

[0130] It should be noted that the various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. Similarities between the various embodiments can be referred to in conjunction with each other. For device embodiments, since they are generally similar to method embodiments, their description is relatively simple, and for relevant details, reference can be made to the description of the method embodiments.

[0131] The steps in the methods of each embodiment of the present application can be adjusted in sequence, merged, and deleted according to actual needs, and the technical features recorded in each embodiment can be replaced or combined.

[0132] The modules and sub-modules in the devices and terminals of the various embodiments of the present application can be merged, divided, and deleted according to actual needs.

[0133] In the several embodiments provided in this application, it should be understood that the disclosed terminals, devices, and methods can be implemented in other ways. For example, the terminal embodiments described above are merely illustrative. For example, the division of modules or submodules is merely a logical function division. In actual implementation, there may be other division methods, such as multiple submodules or modules can be combined or integrated into another module, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or module, which can be electrical, mechanical or other forms.

[0134] The modules or submodules described as separate components may or may not be physically separate, and the components of the modules or submodules may or may not be physical modules or submodules, that is, they may be located in one place or distributed across multiple network modules or submodules. Some or all of the modules or submodules may be selected to achieve the purpose of this embodiment according to actual needs.

[0135] In addition, each functional module or submodule in each embodiment of the present application may be integrated into a processing module, or each module or submodule may exist physically separately, or two or more modules or submodules may be integrated into a single module. The above-mentioned integrated modules or submodules may be implemented in the form of hardware or software functional modules or submodules.

[0136] Professionals may further appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the above description has generally described the components and steps of each example according to their functions. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals and technicians may use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0137] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein may be implemented directly using hardware, software units executed by a processor, or a combination of the two. The software units may be placed in random access memory (RAM), internal memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0138] Finally, it should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of additional identical elements in the process, method, article, or device comprising the element.

[0139] The above description of the disclosed embodiments will enable those skilled in the art to implement or use the present application. Various modifications to these embodiments will be apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of the present application. Therefore, the present application is not limited to the embodiments shown herein, but is to be construed in the widest manner consistent with the principles and novel features disclosed herein.

Claims

1. A method for executing multiple tasks in parallel, characterized in that: include: While executing a specific task unit in the first task, executing the second task simultaneously; wherein a task includes at least one task unit; the specific task unit refers to a task unit whose execution time exceeds a preset time threshold; When a specific task unit in the first task is completed and the second task is not in a task-locked state, the remaining task units in the first task continue to be executed.

2. The method according to claim 1, characterized in that The method further comprises: When a specific task unit in the first task is completed and the second task is in a task-locked state, the second task continues to be executed.

3. The method according to claim 2, characterized in that When the specific task unit in the first task is completed and the second task is in a task-locked state, continuing to execute the second task includes: determining whether a specific task unit in the first task is the last task unit in the first task; If not, when the specific task unit in the first task is completed and the second task is in the task-locked state, the second task continues to be executed and the first task is controlled to enter the waiting state.

4. The method according to claim 1, wherein The method for determining the task locking state includes: If there is a task occupying a lock flag, determine that the task is in a task lock state; When the task releases the lock flag, it is determined that the task is not in the task lock state.

5. The method according to claim 4, characterized in that The task release lock flag includes: When the task meets the preset conditions, the lock identifier occupied by the task is released; The preset conditions include: all task units in the task are completed; and / or the task executes a specific task unit.

6. The method according to any one of claims 1 to 5, characterized in that The step of simultaneously executing the second task while executing a specific task unit in the first task includes: When a specific task unit in the first task is executed and the first task is not in a task-locked state, if the second task is in a task-locked state, the second task is executed simultaneously.

7. The method according to claim 6, characterized in that The method of executing the second task simultaneously while executing a specific task unit in the first task and the first task is not in a task-locked state and if the second task is in a task-locked state includes: Allocating a lock identifier to a first task according to task execution logic, and executing task units in the first task; When a specific task unit in the first task is executed, the lock identifier is released from the first task, and the lock identifier is allocated to a second task, and the second task is executed in parallel.

8. The method according to claim 7, characterized in that The method of releasing the lock identifier from the first task when executing a specific task unit in the first task, allocating the lock identifier to a second task, and executing the second task in parallel includes: When executing a specific operation in a specific task unit of the first task, releasing the lock identifier from the first task, assigning the lock identifier to a second task, and executing the second task in parallel; wherein a task unit includes at least one operation, and the specific operation represents an operation whose execution time exceeds a preset time threshold; The step of continuing to execute the remaining task units in the first task when the specific task unit in the first task is completed and the second task is not in a task-locked state includes: When the specific operation in the specific task unit of the first task is completed and the second task is not in the task-locked state, the remaining operations in the specific task unit of the first task continue to be executed until all task units in the first task are completed.

9. The method according to claim 7, characterized in that The step of continuing to execute the remaining task units in the first task when the specific task unit in the first task is completed and the second task is not in a task-locked state includes: When the second task is completed or a specific task unit in the second task is executed, releasing the locking identifier from the second task; After the specific task unit in the first task is executed, the locking identifier is reallocated to the first task, and the remaining task units in the first task continue to be executed.

10. The method according to claim 9, characterized in that After releasing the lock identifier from the second task, the method further includes: If the specific task unit in the first task has not been completed, assigning the lock identifier to a third task and executing the third task in parallel; When the third task is completed or a specific task unit in the third task is executed, the locking identifier is released from the third task.

11. The method according to claim 1, wherein After executing the second task while executing the specific task unit in the first task, the method further includes: When the specific task unit in the first task is not completely executed, if the second task needs to use the resources used by the specific task unit in the first task during execution, execution of the second task is stopped.

12. A multi-task parallel execution device, characterized in that: include: A first execution module is configured to simultaneously execute a second task while executing a specific task unit in the first task; wherein a task includes at least one task unit; the specific task unit is a task unit whose execution time exceeds a preset time threshold; The second execution module is configured to continue executing the remaining task units in the first task when a specific task unit in the first task is completed and the second task is not in a task-locked state.

13. An electronic device, characterized in that: include: memory and processor; The memory is connected to the processor and is used to store programs; The processor implements the multi-task parallel execution method according to any one of claims 1 to 11 by running the program in the memory.

14. A storage medium, characterized in that The storage medium stores a computer program, and when the computer program is executed by the processor, the method for parallel execution of multiple tasks according to any one of claims 1 to 11 is implemented.