A method and related device for multi-task processing based on a single-threaded pool

By using a single-thread pool multi-tasking method in the information interaction between the equipment and the factory information system, the processor idle problem caused by single-threaded single-task is solved, and the efficient execution of the information handover process is achieved.

CN114153573BActive Publication Date: 2025-07-25SHENZHEN SEICHITECH TECHN CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202111269621.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-10-29
Publication Date
2025-07-25
Estimated Expiration
2041-10-29

AI Technical Summary

Technical Problem

In the prior art, the information interaction between the equipment and the factory information system is performed in sequence due to the use of single-threaded and single tasks to interact information, resulting in the processor being idle while waiting for external information and being unable to perform other tasks, resulting in inefficiency and slow message reporting.

Method used

Using a multi-task processing method based on a single-threaded pool, the pending messages are bound to one-to-one with subtasks in the task pool, and other tasks are trained to perform, thereby improving the processor's time utilization efficiency.

Benefits of technology

It improves the time utilization efficiency of the processor, avoids delays and waits caused by reporting one-threaded and single tasks one-by-one reporting, and ensures efficient progress of the information transfer process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114153573B_ABST
    Figure CN114153573B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a method and related device for multi-task processing based on a single thread pool, which is used to improve the time utilization efficiency of a processor when a thread is in a waiting state during information handshaking. The method of the embodiments of the present application includes: cyclically obtaining the messages to be processed in the message queue, determining whether there is a binding relationship between the messages to be processed and the subtasks in the thread task pool, if not, binding the messages to be processed to the subtasks with the task status being the idle state; performing an information handshaking process on the subtasks bound to the messages to be processed, and marking the task status of the subtasks bound to the messages to be processed as the busy state; if the subtasks marked as the busy state are currently in the waiting state, cyclically execute the next subtask in the busy state; if the subtasks marked as the busy state complete the information handshaking process, delete the messages to be processed corresponding to the bound subtasks from the message queue, and release the subtasks back to the thread task pool.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present application relate to the field of device control application software, and particularly to a method and related device for multi-task processing based on a single thread pool. Background Art

[0002] During the manufacturing process of panel industry equipment, for various processes such as panel manufacturing and inspection, information interaction with the factory information system is required when flowing between the upstream and downstream of the equipment. Currently, for third-party software communication, such as accessing factory information systems MES and CIM systems, etc., in the information handshake process between the equipment and the factory information system, it is necessary to comply with the information interaction process specifications provided by the factory. Each piece of information can ensure correct reporting to the factory information system only after the information handshake process is completely executed. There are many internal units in medium and large-sized equipment. At the same time, different messages will be generated by products in different units and need to be reported. During the information handshake process, there is always a certain time delay when the equipment is waiting for the factory information system to read data, set the flag bit ON / OFF, or due to the influence of communication efficiency.

[0003] Due to hardware device limitations, the existing CIM system information interaction technical solution uses single-thread single-task sequential information interaction, that is, the messages to be sent are placed in the message queue, and the messages are reported to the factory information system MES in sequence. During the execution of the information handshake process, there are often delays or waiting for external information. At this time, the processor is in an idle state but cannot execute other tasks. Reporting item by item in this way has low efficiency, resulting in slow message reporting and affecting the operation rhythm of the equipment. Summary of the Invention

[0004] The embodiments of the present application provide a method and related device for multi-task processing based on a single thread pool. When the thread is in a waiting state during the execution of the information handshake, other tasks can be executed in a polling manner inside the thread to improve the time utilization efficiency of the processor.

[0005] To achieve the above object, the first aspect of the present application discloses a method for multi-task processing based on a single thread pool, including:

[0006] Circularly obtain the messages to be processed in the message queue, and determine whether there is a binding relationship between the messages to be processed and the subtasks in the thread task pool. If not, bind the messages to be processed to the subtasks with the task status of idle.

[0007] Execute the information handshake process for the subtasks bound to the messages to be processed, and mark the task status of the subtasks bound to the messages to be processed as busy.

[0008] If the subtask marked as busy is currently in a waiting state, loop to execute the next busy subtask;

[0009] If the subtask marked as busy completes the handshake process, delete the pending message corresponding to the subtask from the message queue and release the subtask back to the thread task pool.

[0010] In an optional embodiment, before looping to obtain the pending messages in the message queue, the method further includes:

[0011] Create and initialize a thread task pool;

[0012] Divide tasks for the thread task pool. At the same time, mark the task status of each divided subtask as the idle state.

[0013] In an optional embodiment, if the pending message has a binding relationship with the subtask in the thread task pool, return the pending message to the message queue.

[0014] In an optional embodiment, the loop to obtain the pending messages in the message queue includes:

[0015] Inspect the message queue to monitor whether there are incoming pending messages.

[0016] In an optional embodiment, the handshake process includes the following steps:

[0017] The sender sends a message sending request;

[0018] The receiver confirms the received information;

[0019] The sender sends a message;

[0020] The receiver confirms the completion of message reception.

[0021] A second aspect of the present application discloses a multi-task processing system based on a single thread pool, including:

[0022] A first acquisition unit for looping to obtain the pending messages in the message queue;

[0023] A first judgment unit for judging whether the pending message has a binding relationship with the subtask in the thread task pool;

[0024] A task allocation unit, when the first judgment unit determines that the pending message has no binding relationship with the subtask in the thread task pool, for binding the pending message to a subtask with an idle task status;

[0025] A task execution unit for performing an information handshaking process on the subtask execution information bound to the message to be processed;

[0026] A marking unit for marking the task status of the subtask bound to the message to be processed as a busy status;

[0027] A task scheduling unit, if the subtask marked as busy is currently in a waiting state, the task scheduling unit is used to loop and execute the next subtask in a busy state;

[0028] A deletion unit, if the subtask marked as busy completes the information handshaking process, is used to delete the message to be processed bound to the subtask from the message queue;

[0029] A task restoration unit for releasing the subtask back to the thread task pool.

[0030] In an optional embodiment, the system further includes:

[0031] A thread creation unit for creating and initializing a thread task pool;

[0032] A task division unit for dividing tasks for the thread task pool.

[0033] In an optional embodiment, the system further includes: a message restoration unit, when the first determination unit determines that there is a binding relationship between the message to be processed and the subtask in the thread task pool, for returning the message to be processed to the message queue.

[0034] The third aspect of the present application discloses an electronic device, including:

[0035] A processor, a memory, an input / output unit, and a bus;

[0036] The processor is connected to the memory, the input / output unit, and the bus;

[0037] The memory stores machine-readable instructions executable by the processor. When the electronic device runs, the processor communicates with the memory through the bus. When the machine-readable instructions are executed by the processor, the steps of a method for multi-task processing based on a single thread pool as described in any one of the foregoing first aspect and optional embodiments are executed.

[0038] The fourth aspect of the present application discloses a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the steps of a method for multi-task processing based on a single thread pool as described in any one of the foregoing first aspect and optional embodiments are executed.

[0039] In the above technical solution, by binding the message to be processed to each subtask in the task pool one by one, when waiting for external information during the execution of each subtask, the next subtask is executed in a loop, and other tasks can be executed in a polling manner within the thread, instead of relying on a single-threaded and single-task approach to report information item by item, thereby completing the handshaking process and improving the time utilization efficiency of the processor. BRIEF DESCRIPTION OF THE DRAWINGS

[0040] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for the description of the embodiments or the prior art. Obviously, the drawings in the following description are only the embodiments of the present invention. For those of ordinary skill in the art, other drawings can be obtained based on the provided drawings without creative efforts.

[0041] Figure 1 It is a schematic flowchart of an embodiment of a method for multi-task processing based on a single-threaded pool provided by an embodiment of the present application;

[0042] Figure 2 It is a schematic flowchart of another embodiment of a method for multi-task processing based on a single-threaded pool provided by an embodiment of the present application;

[0043] Figure 3 It is a schematic structural diagram of an embodiment of a system for multi-task processing based on a single-threaded pool provided by an embodiment of the present application;

[0044] Figure 4 It is a schematic structural diagram of another embodiment of a system for multi-task processing based on a single-threaded pool provided by an embodiment of the present application;

[0045] Figure 5 It is a schematic structural diagram of an embodiment of an electronic device provided by an embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0046] The embodiments of the present application provide a method for multi-task processing based on a single-threaded pool and related devices, which are used to execute other tasks in a polling manner within the thread when encountering delays or waiting for external information during the information handshaking process, thereby improving the time utilization efficiency of the processor.

[0047] The first aspect of the present application discloses a method for multi-task processing based on a single-threaded pool, and this method adopts computer program control measures. In the present application, the method includes an architecture in which multiple subtasks are executed simultaneously under a single thread and is applied to the information interaction process between the factory information system and the device. The following will elaborate on each step included in the method.

[0048] Please refer toFigure 1 , Figure 1 Schematic diagram of a process of an embodiment of a multi - task processing method based on a single - thread pool provided by an embodiment of the present application; including:

[0049] 101. Continuously obtain the messages to be processed in the message queue;

[0050] Large and medium - sized enterprises use equipment with many internal units. At the same moment, different system units will generate different messages to be reported. For example, the system units generate (M + 1) messages simultaneously, which are respectively recorded as message 1, …, message M, message 1'. Among them, it is assumed that message 1 and message 1' are the same type of message. These messages will be placed in the message queue in the message thread. After the program starts, it continuously monitors and obtains the messages to be processed in the message queue.

[0051] 102. Determine whether there is a binding relationship between the message to be processed and the subtasks in the thread task pool. If not, execute step 103;

[0052] When the program starts, a fully automated running thread is newly created, and N subtasks are created and started, indicating that the main process runs in a loop. At this time, the operating system allocates the thread to the processor, and the thread management is controlled by the operating system kernel. At this time, the task states of these N subtasks are all in the idle state, and the task state of the subtask is marked as NoWorking. The subtasks in the idle state are in a state of waiting to receive messages in the current thread. Determine whether there is a binding relationship between the obtained message to be processed and the subtasks in the thread task pool. If no subtask has a binding relationship with the obtained message to be processed, execute step 103.

[0053] 103. Bind the message to be processed to the subtask with the task state of idle state;

[0054] According to the setting, the same message cannot be reported simultaneously. The messages to be processed in the message queue will be bound to the subtasks marked as NoWorking in the thread task pool one by one. If a message to be processed is obtained in the message queue, first compare the binding results. If no subtask has a binding relationship with the obtained message to be processed, then bind the message to be processed to the subtask marked as NoWorking. If there is no subtask in the thread task pool, the message to be processed is in a waiting - to - be - processed state.

[0055] 104. Perform an information handshake process on the subtask bound to the message to be processed, and mark the task state of the subtask bound to the message to be processed as the busy state;

[0056] Execute an information handshaking process for the subtask execution information bound to the message to be processed. For example, if task 1 is bound to the message to be processed 1, then task 1 starts and task 1 is in a busy state. Mark task 1 as the Working state and enter the message handshaking process.

[0057] In addition, it should be noted that the above message handshaking process includes the following steps: the sender sends a message sending request; the receiver confirms the received information; the sender sends the message; the receiver confirms the completion of information reception. After message 1 executes the message sending request, it needs to wait for the system to confirm the received information. At this time, task 2 starts and is marked as the Working state, and also enters the message handshaking process. After sending the message request, it waits for the system to receive the confirmation,... Task M also starts,... until all tasks bound to the messages to be processed start. At this time, all tasks are polling and waiting for the signal of the system to receive the confirmation information.

[0058] 105. If the subtask marked as the busy state is currently in the waiting state, loop to execute the next subtask in the busy state;

[0059] If task 1 receives the system reception confirmation signal at this time, task 1 executes the message sending and needs to further wait for the confirmation signal of the system to confirm the completion of message reception. Task 2 executes the message sending and also needs to further wait for the confirmation signal of the system to confirm the completion of message reception,... If task 1 receives the confirmation signal of the system reception completion at this time, and other tasks still have not received the MES confirmation signal, the current subtask continues to poll and wait, releases the processor resources, and the processor loops to execute the next subtask in the busy state.

[0060] 106. If the subtask marked as the busy state completes the information handshaking process, delete the message to be processed corresponding to the subtask from the message queue and release the subtask back to the above thread task pool.

[0061] If the subtask marked as the busy state completes the information handshaking process, that is, the current subtask receives the confirmation signal of the completion of information reception, delete the message to be processed corresponding to the currently executed subtask from the above message queue, and restore the task state of the subtask to the idle state, that is, mark it as NoWorking. The subtask is released back to the above thread task pool, so that the subtask is in the state when waiting to be bound to the message to be processed.

[0062] In the above technical solution, by binding the message to be processed to each subtask in the task pool one by one, when each subtask is executed and encounters waiting for external information, the next subtask is looped to execute. The threads can poll to execute other tasks internally, instead of relying on single-threaded single-task to report information item by item, so as to complete the handshaking process and improve the time utilization efficiency of the processor.

[0063] Please refer to Figure 2 , Figure 2 , which is a schematic flowchart of another embodiment of a multi-task processing method based on a single thread pool provided by an embodiment of the present application; including:

[0064] 201. Create and initialize a thread task pool;

[0065] Thread initialization mainly initializes the initial value of the total number of thread tasks in the thread pool. The initialization method is to instantiate N single thread pools through a loop, where N is the maximum number of tasks that the thread task pool can accommodate, and is specifically determined according to memory resources.

[0066] 202. Divide tasks for the thread task pool. At the same time, mark the task status of each divided subtask as the idle state;

[0067] Specifically, divide tasks for the thread task pool according to the context configuration and the total number of tasks. At the same time, mark the task status of each divided subtask as the idle state, and the idle state can be identified by NoWorking.

[0068] 203. Patrol the message queue to monitor whether there are incoming messages to be processed;

[0069] The internal units of the equipment used by large and medium-sized enterprises are relatively numerous. At the same time, different system units will generate different messages that need to be reported. These messages will be placed in the message queue in the message thread. After the program starts, the messages in the message queue are read in a loop to monitor and obtain the messages to be processed in the message queue at all times.

[0070] 204. Determine whether there is a binding relationship between the message to be processed and the subtasks in the thread task pool. If so, execute step 209; if not, execute step 205;

[0071] When the program starts, a fully automated running thread is newly created, and N subtasks are created and started, indicating that the main process runs in a loop. At this time, the operating system allocates the thread to the processor, and the thread management is controlled by the operating system kernel. At this time, the task status of these N subtasks is all in the idle state, and the task status of the subtasks is indicated by being marked as NoWorking. The subtasks in the idle state are in a state of waiting to receive messages in the current thread. Determine whether there is a binding relationship between the obtained message to be processed and the subtasks in the thread task pool. If there is no subtask with a binding relationship to the obtained message to be processed, execute step 205; if there is a subtask with a binding relationship to the obtained message to be processed, execute step 209.

[0072] 205. Bind the message to be processed to a subtask with an idle task status;

[0073] 206. Perform an information handshake process on the subtask bound to the message to be processed, and mark the task status of the subtask bound to the message to be processed as the busy status;

[0074] 207. If the subtask marked as the busy status is currently in the waiting state, loop to execute the next subtask in the busy status;

[0075] 208. If the subtask marked as the busy status completes the information handshake process, delete the message to be processed corresponding to the subtask bound from the message queue, and release the subtask back to the above thread task pool.

[0076] Steps 205 to 208 in this embodiment are similar to steps 103 to 106 in the foregoing embodiment, and will not be elaborated here.

[0077] 209. Return the message to be processed to the message queue.

[0078] If there is already a same message bound to a subtask for the message to be processed obtained, and the same message cannot be reported simultaneously, return the currently obtained message to be processed to the above message queue, and wait until the same message completes reporting before binding it to a subtask with an idle status in the thread pool. This can ensure that each message can be correctly reported to the information system and avoid the probability of information reporting errors.

[0079] The second aspect of this application discloses a multi-task processing system based on a single thread pool. Please refer to Figure 3 , Figure 3 which is a schematic structural diagram of an embodiment of a multi-task processing system based on a single thread pool provided by an embodiment of this application; including:

[0080] The first acquisition unit 301 is configured to circularly acquire messages to be processed in the message queue;

[0081] The first judgment unit 302 is configured to judge whether there is a binding relationship between the message to be processed and a subtask in the thread task pool;

[0082] The task allocation unit 303 is configured to, when the first judgment unit 302 determines that there is no binding relationship between the message to be processed and a subtask in the thread task pool, bind the message to be processed to a subtask with an idle task status;

[0083] The task execution unit 304 is configured to perform an information handshake process on the subtask bound to the message to be processed;

[0084] A marking unit 305 for marking the task status of the subtask bound to the message to be processed as a busy status;

[0085] A task scheduling unit 306, if the subtask marked as a busy status is currently in a waiting state, the task scheduling unit 306 is used to loop and execute the next subtask in a busy status;

[0086] A deletion unit 307, if the subtask marked as a busy status completes the information handshake process, is used to delete the message to be processed corresponding to the subtask from the message queue;

[0087] A task restoration unit 308 for releasing the subtask back to the thread task pool.

[0088] Please refer to Figure 4 , Figure 4 , which is a schematic structural diagram of another embodiment of a multi-task processing system based on a single thread pool provided by an embodiment of the present application; including:

[0089] A first acquisition unit 401 for looping to acquire messages to be processed in the message queue;

[0090] A first judgment unit 402 for judging whether there is a binding relationship between the message to be processed and the subtasks in the thread task pool;

[0091] A task allocation unit 403, when the first judgment unit 402 determines that there is no binding relationship between the message to be processed and the subtasks in the thread task pool, is used to bind the message to be processed to a subtask with an idle task status;

[0092] A task execution unit 404 for performing an information handshake process on the subtask bound to the message to be processed;

[0093] A marking unit 405 for marking the task status of the subtask bound to the message to be processed as a busy status;

[0094] A task scheduling unit 406, if the subtask marked as a busy status is currently in a waiting state, the task scheduling unit 406 is used to loop and execute the next subtask in a busy status;

[0095] A deletion unit 407, if the subtask marked as a busy status completes the information handshake process, is used to delete the message to be processed corresponding to the subtask from the message queue;

[0096] A task restoration unit 408 for releasing the subtask back to the thread task pool.

[0097] In an optional embodiment, the system further includes:

[0098] A thread creation unit 409 for creating and initializing a thread task pool;

[0099] A task division unit 410 for dividing tasks in the thread task pool.

[0100] In an optional embodiment, the system further includes: a message restoration unit 411, configured to return the message to be processed to the message queue when the first determination unit 402 determines that there is a binding relationship between the message to be processed and a subtask in the thread task pool.

[0101] For the system for multi-task processing based on a single thread pool described in the second aspect, the specific limitations can refer to the limitations on the method for multi-task processing based on a single thread pool in the first aspect above, which will not be elaborated here. Each module in the above system for multi-task processing based on a single thread pool can be implemented in whole or in part by software, hardware, and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the corresponding operations of the above modules.

[0102] The third aspect of the present application discloses an electronic device, Figure 5 which is a schematic structural diagram of an embodiment of an electronic device provided by an embodiment of the present application; including:

[0103] A processor 501, a memory 502, an input / output unit 503, and a bus 504;

[0104] The processor 501 is connected to the memory 502, the input / output unit 503, and the bus 504;

[0105] The memory 502 stores machine-readable instructions executable by the processor 501. When the electronic device runs, communication between the processor 501 and the memory 502 is through the bus. When the machine-readable instructions are executed by the processor 501, the corresponding steps in the method for multi-task processing based on a single thread pool in the foregoing Figures 1 to 2 illustrated embodiment are executed, which will not be elaborated here.

[0106] The fourth aspect of the present application discloses a computer-readable storage medium, on which a program is stored. When the program is executed on a computer, the corresponding steps in the method for multi-task processing based on a single thread pool in the foregoing Figures 1 to 2 illustrated embodiment are executed, which will not be elaborated here.

[0107] The terms used in this invention are for the purpose of describing specific embodiments only and are not intended to limit the present disclosure. The singular forms "a", "the", and "said" used in the present disclosure and the appended claims are also intended to include the plural forms unless the context clearly dictates otherwise. It should also be understood that the term "and / or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.

[0108] The foregoing description of the disclosed embodiments enables those skilled in the art to practice or use the present invention. Various modifications to these embodiments will be readily 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 invention. Thus, the present invention will not be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

[0109] It should also be noted that, in this document, relational terms such as first and second are used solely to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any actual such relationship or order between these entities or operations.

[0110] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the systems, devices, and units described above can refer to the corresponding processes in the foregoing method embodiments and will not be elaborated herein.

[0111] In the several embodiments provided in this application, it should be understood that the disclosed systems, devices, and methods can be implemented in other ways. For example, the device embodiments described above are merely illustrative. For example, the division of the units is only a logical functional division, and there may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the couplings, direct couplings, or communication connections shown or discussed with each other can be through some interfaces, and the indirect couplings or communication connections of the devices or units can be in electrical, mechanical, or other forms.

[0112] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they can be located in one place or distributed to multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0113] In addition, each functional unit in various embodiments of the present application may be integrated into one processing unit, may exist separately as individual physical units, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of a software functional unit.

[0114] If the above-mentioned integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it may be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present application. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, read-only memory), random access memories (RAM, random access memory), magnetic disks, or optical discs that can store program codes.

Claims

1. A method for multi-task processing based on a single-threaded pool, characterized in that It includes: Create and initialize a thread task pool; Divide the tasks of the thread task pool, and at the same time, mark the task status of each divided subtask as the idle state; Loop to obtain the messages to be processed in the message queue, and determine whether there is a binding relationship between the messages to be processed and the subtasks in the thread task pool. If not, bind the messages to be processed to the subtasks with the task status of idle state one by one; Execute the information handshake process for the subtasks bound to the messages to be processed, and mark the task status of the subtasks bound to the messages to be processed as the busy state; If the subtasks marked as the busy state are currently in the waiting state, loop to execute the next subtask in the busy state; If the subtasks marked as the busy state complete the information handshake process, delete the messages to be processed corresponding to the subtasks from the message queue, and release the subtasks back to the thread task pool; If there is a binding relationship between the messages to be processed and the subtasks in the thread task pool, return the messages to be processed to the message queue.

2. A method for multi-task processing based on a single-threaded pool, as claimed in claim 1, wherein The loop to obtain the messages to be processed in the message queue includes: Inspect the message queue to monitor whether there are incoming messages to be processed.

3. A method for multi-task processing based on a single-threaded pool according to claim 1, characterized in that, The information handshake process includes the following steps: The sender sends a message sending request; The receiver confirms the received information; The sender sends a message; The receiver confirms the completion of information reception.

4. A multi-task processing system based on a single-threaded pool, characterized in that, It includes: A thread creation unit for creating and initializing a thread task pool; A task division unit for dividing the tasks of the thread task pool, and at the same time, marking the task status of each divided subtask as the idle state; A first acquisition unit for looping to obtain the messages to be processed in the message queue; A first judgment unit for judging whether there is a binding relationship between the messages to be processed and the subtasks in the thread task pool; A task allocation unit for binding the messages to be processed to the subtasks with the task status of idle state when the first judgment unit determines that there is no binding relationship between the messages to be processed and the subtasks in the thread task pool; A task execution unit for executing the information handshake process for the subtasks bound to the messages to be processed; A marking unit for marking the task status of the subtasks bound to the messages to be processed as the busy state; A task scheduling unit for looping to execute the next subtask in the busy state if the subtasks marked as the busy state are currently in the waiting state; A deletion unit for deleting the messages to be processed corresponding to the subtasks from the message queue if the subtasks marked as the busy state complete the information handshake process; A task restoration unit for releasing the subtasks back to the thread task pool; A message restoration unit for returning the messages to be processed to the message queue when the first judgment unit determines that there is a binding relationship between the messages to be processed and the subtasks in the thread task pool.

5. An electronic device, characterized in that, It includes: A processor, a memory, an input / output unit, and a bus; The processor is connected to the memory, the input / output unit, and the bus; The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via a bus. When the machine-readable instructions are executed by the processor, the steps of a multi-task processing method based on a single-thread pool as described in any one of claims 1 to 3 are executed.

6. A computer-readable storage medium, on which a program is stored. When the program is executed on a computer, a multi-task processing method based on a single-thread pool as described in any one of claims 1 to 3 is executed.

Citation Information

Patent Citations

  • Distributed graph data processing method and device

    CN106815080A

  • Thread pool task processing method in high-availability cluster system

    CN107832146A

  • Task processing method and device

    CN112817745A