CN116820712A - Thread pool management method, device, equipment and medium - Google Patents

Thread pool management method, device, equipment and medium Download PDF

Info

Publication number
CN116820712A
CN116820712A CN202310674130.2A CN202310674130A CN116820712A CN 116820712 A CN116820712 A CN 116820712A CN 202310674130 A CN202310674130 A CN 202310674130A CN 116820712 A CN116820712 A CN 116820712A
Authority
CN
China
Prior art keywords
thread
optimal solution
task
haxi
chi
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310674130.2A
Other languages
Chinese (zh)
Inventor
周文强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Jinan Inspur Data Technology Co Ltd
Original Assignee
Jinan Inspur Data Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Jinan Inspur Data Technology Co Ltd filed Critical Jinan Inspur Data Technology Co Ltd
Priority to CN202310674130.2A priority Critical patent/CN116820712A/en
Publication of CN116820712A publication Critical patent/CN116820712A/en
Pending legal-status Critical Current

Links

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The invention provides a method, a device, equipment and a readable medium for managing a thread pool, wherein the method comprises the following steps: establishing a thread Chi Haxi table; responding to the task to be issued into a thread pool, acquiring an optimal solution thread from an online Cheng Chiha Xie table, and adding the task into an optimal solution thread queue; the tasks added into the optimal solution thread queue are used as tree nodes of the optimal solution threads to be updated into a thread Chi Haxi table; in response to completion of task execution, the tree node corresponding to the task is deleted in the thread Chi Haxi table. By using the scheme of the invention, new tasks can be reasonably distributed, the task number of each thread in the thread pool is ensured to be the same, resources can be reasonably utilized, breadth preference is followed when the tasks are distributed, the searching efficiency can be improved, the tasks to be executed and executed in execution are managed, and the management of the thread pool is more transparent.

Description

Thread pool management method, device, equipment and medium
Technical Field
The present invention relates to the field of computers, and more particularly, to a method, apparatus, device, and readable medium for thread pool management.
Background
Multithreading refers to a technology for implementing concurrent execution of multiple threads in a software system, and has become an indispensable part in the current software design, but multithreading also has a certain limitation, and if a large number of threads are created in a short time, excessive system resources are occupied, and even downtime is possibly caused, so that thread pool applications occur. The thread pool is a multi-thread processing form, a fixed number of thread resources are created in the initial stage of system operation, when concurrent tasks are executed, the tasks are added into a thread pool queue for execution, and when the number of the concurrent tasks exceeds the capacity of the thread pool, the tasks are inserted into the thread queue according to a certain rule to wait for execution.
The current thread pool management method adopts a polling method, namely when a new task arrives, the thread pool index +1 used by the last task is the execution thread of the current task, and the method cannot judge the state of the thread in real time, so that the task allocated to a certain thread each time is high in time consumption, the task is accumulated continuously, and the response time is prolonged.
Disclosure of Invention
In view of the above, an object of the embodiments of the present invention is to provide a method, an apparatus, a device, and a readable medium for managing a thread pool, by using the technical solution of the present invention, new tasks can be reasonably allocated, the number of tasks of each thread in the thread pool is guaranteed to be the same, resources can be reasonably utilized, priority is given to allocation of tasks, searching efficiency can be improved, tasks to be executed and executed are managed, and management of the thread pool is more transparent.
Based on the above objects, an aspect of an embodiment of the present invention provides a method for thread pool management, including the steps of:
establishing a thread Chi Haxi table;
responding to the task to be issued into a thread pool, acquiring an optimal solution thread from an online Cheng Chiha Xie table, and adding the task into an optimal solution thread queue;
the tasks added into the optimal solution thread queue are used as tree nodes of the optimal solution threads to be updated into a thread Chi Haxi table;
in response to completion of task execution, the tree node corresponding to the task is deleted in the thread Chi Haxi table.
According to one embodiment of the present invention, further comprising:
all threads in the thread pool are set as root nodes in the thread Chi Haxi table.
According to one embodiment of the invention, in response to a task being issued into a thread pool, obtaining an optimal solution thread in the online Cheng Chiha list and adding the task into the optimal solution thread queue comprises:
responding to the task issued to a thread pool, and searching an optimal solution thread in a thread Chi Haxi table according to a breadth-first searching method;
and adding the tasks into the optimal solution thread queues, wherein the tasks in each thread queue are arranged according to the adding sequence.
According to one embodiment of the invention, looking up the optimal solution thread in the thread Chi Haxi table according to the breadth-first search method includes:
searching whether each root node in the thread Chi Haxi table has a tree node or not;
and in response to the fact that the root node does not exist in the tree node, taking the thread without the tree node as an optimal solution thread.
According to one embodiment of the present invention, further comprising:
responding to all the tree nodes in the root node, and searching whether a second layer of tree nodes exist under the first layer of tree nodes under the root node;
and responding to the fact that the second-layer tree nodes do not exist under the first-layer tree nodes under the root node, and taking the threads without the second-layer tree nodes as optimal solution threads.
According to one embodiment of the invention, updating the task added to the optimal solution thread queue as a tree node for the optimal solution thread into the thread Chi Haxi table includes:
searching all tree nodes corresponding to the optimal solution thread in a thread Chi Haxi table;
and taking the task added into the optimal solution thread queue as a tree node of the last layer of tree nodes.
According to one embodiment of the invention, in response to completion of task execution, deleting the corresponding tree node for the task in the thread Chi Haxi table includes:
in response to completion of task execution, deleting tree nodes corresponding to the tasks in a thread Chi Haxi table;
taking the tree node of the next layer of the deleted tree node as the tree node of the first layer under the root node;
and sequentially moving the tree nodes of other layers to the tree nodes of the upper layer.
In another aspect of the embodiment of the present invention, there is also provided an apparatus for thread pool management, including:
a creation module configured to create a thread Chi Haxi table;
the searching module is configured to respond to the task and issue the task to the thread pool, acquire an optimal solution thread from the online Cheng Chiha Highway table, and add the task to the optimal solution thread queue;
the updating module is configured to update the tasks added into the optimal solution thread queue into a thread Chi Haxi table as tree nodes of the optimal solution threads;
and the deleting module is configured to delete the tree node corresponding to the task in the thread Chi Haxi table in response to completion of task execution.
In another aspect of the embodiments of the present invention, there is also provided a computer apparatus including:
at least one processor; and
and a memory storing computer instructions executable on the processor, the instructions when executed by the processor performing the steps of any of the methods described above.
In another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium storing a computer program which, when executed by a processor, implements the steps of any of the methods described above.
The invention has the following beneficial technical effects: the thread pool management method provided by the embodiment of the invention is implemented by establishing a thread Chi Haxi table; responding to the task to be issued into a thread pool, acquiring an optimal solution thread from an online Cheng Chiha Xie table, and adding the task into an optimal solution thread queue; the tasks added into the optimal solution thread queue are used as tree nodes of the optimal solution threads to be updated into a thread Chi Haxi table; in response to the task execution completion, the technical scheme of deleting the tree node corresponding to the task in the thread Chi Haxi table can reasonably allocate new tasks, ensure that the task number of each thread in the thread pool tends to be the same, reasonably utilize resources, follow breadth priority when allocating the tasks, improve search efficiency, manage the tasks in execution and to be executed, and be more transparent to the management of the thread pool.
Drawings
In order to more clearly illustrate the embodiments of the invention or the technical solutions in the prior art, the drawings that are necessary for the description of the embodiments or the prior art will be briefly described, it being obvious that the drawings in the following description are only some embodiments of the invention and that other embodiments may be obtained according to these drawings without inventive effort for a person skilled in the art.
FIG. 1 is a schematic flow chart diagram of a method of thread pool management in accordance with one embodiment of the invention;
FIG. 2 is a schematic diagram of a thread Chi Haxi table according to one embodiment of the invention;
FIG. 3 is a schematic diagram of a thread for obtaining an optimal solution according to one embodiment of the present invention;
FIG. 4 is a schematic diagram of an apparatus for thread pool management in accordance with one embodiment of the invention;
FIG. 5 is a schematic diagram of a computer device according to one embodiment of the invention;
fig. 6 is a schematic diagram of a computer-readable storage medium according to one embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the following embodiments of the present invention will be described in further detail with reference to the accompanying drawings.
With the above object in view, in a first aspect, an embodiment of a method for thread pool management is provided. Fig. 1 shows a schematic flow chart of the method.
As shown in fig. 1, the method may include the steps of:
s1, establishing a thread Chi Haxi table. In the system initialization stage, a thread pool needs to be initialized, at this time, the capacity of the thread pool and all threads are known, the threads are manufactured into a thread Chi Haxi table, the root node is all threads, at this time, no task is executed, therefore, only the root node is needed, when a subsequent task arrives, a tree node needs to be inserted into a corresponding root node for execution, the tree node represents the task, and information related to the task is stored, as shown in fig. 2.
S2, responding to the task to be issued to a thread pool, acquiring an optimal solution thread from an online Cheng Chiha Xishform, and adding the task to an optimal solution thread queue. In the running process of the system, when new tasks continuously arrive, each thread is searched in the online Cheng Chiha table in sequence according to the breadth-first thought, the thread with the minimum waiting task number is found, the new task is used as a tree node, and the tree node is inserted into the back of the root node corresponding to the thread.
S3, the tasks added into the optimal solution thread queue are used as tree nodes of the optimal solution threads to be updated into a thread Chi Haxi table.
And S4, deleting the tree node corresponding to the task in the thread Chi Haxi table in response to the completion of the task execution.
By using the technical scheme of the invention, new tasks can be reasonably distributed, the task number of each thread in the thread pool is ensured to be the same, resources can be reasonably utilized, breadth priority is followed when tasks are distributed, the searching efficiency can be improved, the tasks to be executed and executed in execution are managed, and the management of the thread pool is more transparent.
In a preferred embodiment of the present invention, further comprising:
all threads in the thread pool are set as root nodes in the thread Chi Haxi table. In the thread Chi Haxi table, all root nodes correspond to all threads, and each root node's tree node corresponds to each thread's task being executed and waiting to be executed.
In a preferred embodiment of the present invention, in response to the task being issued into the thread pool, obtaining the optimal solution thread in the online Cheng Chiha table and adding the task into the optimal solution thread queue comprises:
responding to the task issued to a thread pool, and searching an optimal solution thread in a thread Chi Haxi table according to a breadth-first searching method;
and adding the tasks into the optimal solution thread queues, wherein the tasks in each thread queue are arranged according to the adding sequence. Each tree node corresponding to each root node in the thread Chi Haxi table is also arranged in the order of tasks.
In a preferred embodiment of the present invention, looking up the optimal solution thread in the thread Chi Haxi table according to the breadth-first search method includes:
searching whether each root node in the thread Chi Haxi table has a tree node or not;
and in response to the fact that the root node does not exist in the tree node, taking the thread without the tree node as an optimal solution thread. As shown in fig. 3, the whole thread Chi Haxi table is divided into layers, the root node is one layer, each level of tree node under the root node is one layer, and so on, during searching, the first layer of root node is firstly searched according to the breadth-first algorithm to determine whether the tree node exists, if not, the current thread is determined to not execute any task and is in an idle state, so that a new task can be designated as the thread to execute, and meanwhile, the hash table is refreshed to newly increase the tree node. If all tree nodes exist, searching the next tree node until the thread without the tree node of the next layer is found first.
In a preferred embodiment of the present invention, further comprising:
responding to all the tree nodes in the root node, and searching whether a second layer of tree nodes exist under the first layer of tree nodes under the root node;
and responding to the fact that the second-layer tree nodes do not exist under the first-layer tree nodes under the root node, and taking the threads without the second-layer tree nodes as optimal solution threads.
In a preferred embodiment of the present invention, updating the tasks added to the optimal solution thread queue as tree nodes for the optimal solution threads into the thread Chi Haxi table includes:
searching all tree nodes corresponding to the optimal solution thread in a thread Chi Haxi table;
and taking the task added into the optimal solution thread queue as a tree node of the last layer of tree nodes.
In a preferred embodiment of the present invention, in response to completion of task execution, deleting the corresponding tree node for the task in the thread Chi Haxi table comprises:
in response to completion of task execution, deleting tree nodes corresponding to the tasks in a thread Chi Haxi table;
taking the tree node of the next layer of the deleted tree node as the tree node of the first layer under the root node;
and sequentially moving the tree nodes of other layers to the tree nodes of the upper layer. When the task execution is completed, the corresponding tree node needs to be deleted in the thread Chi Haxi table, so all tree nodes under the tree node move to the upper layer in turn.
The invention has the following advantages:
1. the task to be executed in execution is managed, and the thread pool is managed more transparently;
2. new tasks can be reasonably distributed, the task number of each thread in the thread pool is guaranteed to be the same, the resource utilization is more reasonable, and the response time and the processing speed of the tasks can be improved;
3. the task distribution is performed by following breadth first, so that full traversal is avoided each time, and the searching efficiency is higher.
It should be noted that, it will be understood by those skilled in the art that all or part of the procedures in implementing the methods of the above embodiments may be implemented by a computer program to instruct related hardware, and the above program may be stored in a computer readable storage medium, and the program may include the procedures of the embodiments of the above methods when executed. Wherein the storage medium may be a magnetic disk, an optical disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), or the like. The computer program embodiments described above may achieve the same or similar effects as any of the method embodiments described above.
Furthermore, the method disclosed according to the embodiment of the present invention may also be implemented as a computer program executed by a CPU, which may be stored in a computer-readable storage medium. When executed by a CPU, performs the functions defined above in the methods disclosed in the embodiments of the present invention.
With the above object in mind, in a second aspect of the embodiments of the present invention, there is provided an apparatus for thread pool management, as shown in fig. 4, an apparatus 200 includes:
a creation module configured to create a thread Chi Haxi table;
the searching module is configured to respond to the task and issue the task to the thread pool, acquire an optimal solution thread from the online Cheng Chiha Highway table, and add the task to the optimal solution thread queue;
the updating module is configured to update the tasks added into the optimal solution thread queue into a thread Chi Haxi table as tree nodes of the optimal solution threads;
and the deleting module is configured to delete the tree node corresponding to the task in the thread Chi Haxi table in response to completion of task execution.
In a preferred embodiment of the present invention, the device further comprises a setting module configured to:
all threads in the thread pool are set as root nodes in the thread Chi Haxi table.
In a preferred embodiment of the invention, the search module is further configured to:
responding to the task issued to a thread pool, and searching an optimal solution thread in a thread Chi Haxi table according to a breadth-first searching method;
and adding the tasks into the optimal solution thread queues, wherein the tasks in each thread queue are arranged according to the adding sequence.
In a preferred embodiment of the invention, the search module is further configured to:
searching whether each root node in the thread Chi Haxi table has a tree node or not;
and in response to the fact that the root node does not exist in the tree node, taking the thread without the tree node as an optimal solution thread.
In a preferred embodiment of the invention, the search module is further configured to:
responding to all the tree nodes in the root node, and searching whether a second layer of tree nodes exist under the first layer of tree nodes under the root node;
and responding to the fact that the second-layer tree nodes do not exist under the first-layer tree nodes under the root node, and taking the threads without the second-layer tree nodes as optimal solution threads.
In a preferred embodiment of the invention, the update module is further configured to:
searching all tree nodes corresponding to the optimal solution thread in a thread Chi Haxi table;
and taking the task added into the optimal solution thread queue as a tree node of the last layer of tree nodes.
In a preferred embodiment of the invention, the deletion module is further configured to:
in response to completion of task execution, deleting tree nodes corresponding to the tasks in a thread Chi Haxi table;
taking the tree node of the next layer of the deleted tree node as the tree node of the first layer under the root node;
and sequentially moving the tree nodes of other layers to the tree nodes of the upper layer.
By using the technical scheme of the invention, new tasks can be reasonably distributed, the task number of each thread in the thread pool is ensured to be the same, resources can be reasonably utilized, breadth priority is followed when tasks are distributed, the searching efficiency can be improved, the tasks to be executed and executed in execution are managed, and the management of the thread pool is more transparent.
Based on the above object, a third aspect of the embodiments of the present invention proposes a computer device. Fig. 5 is a schematic diagram of an embodiment of a computer device provided by the present invention. As shown in fig. 5, an embodiment of the present invention includes the following means: at least one processor 21; and a memory 22, the memory 22 storing computer instructions 23 executable on the processor, the instructions when executed by the processor performing the method of:
establishing a thread Chi Haxi table;
responding to the task to be issued into a thread pool, acquiring an optimal solution thread from an online Cheng Chiha Xie table, and adding the task into an optimal solution thread queue;
the tasks added into the optimal solution thread queue are used as tree nodes of the optimal solution threads to be updated into a thread Chi Haxi table;
in response to completion of task execution, the tree node corresponding to the task is deleted in the thread Chi Haxi table.
In a preferred embodiment of the present invention, further comprising:
all threads in the thread pool are set as root nodes in the thread Chi Haxi table.
In a preferred embodiment of the present invention, in response to the task being issued into the thread pool, obtaining the optimal solution thread in the online Cheng Chiha table and adding the task into the optimal solution thread queue comprises:
responding to the task issued to a thread pool, and searching an optimal solution thread in a thread Chi Haxi table according to a breadth-first searching method;
and adding the tasks into the optimal solution thread queues, wherein the tasks in each thread queue are arranged according to the adding sequence.
In a preferred embodiment of the present invention, looking up the optimal solution thread in the thread Chi Haxi table according to the breadth-first search method includes:
searching whether each root node in the thread Chi Haxi table has a tree node or not;
and in response to the fact that the root node does not exist in the tree node, taking the thread without the tree node as an optimal solution thread.
In a preferred embodiment of the present invention, further comprising:
responding to all the tree nodes in the root node, and searching whether a second layer of tree nodes exist under the first layer of tree nodes under the root node;
and responding to the fact that the second-layer tree nodes do not exist under the first-layer tree nodes under the root node, and taking the threads without the second-layer tree nodes as optimal solution threads.
In a preferred embodiment of the present invention, updating the tasks added to the optimal solution thread queue as tree nodes for the optimal solution threads into the thread Chi Haxi table includes:
searching all tree nodes corresponding to the optimal solution thread in a thread Chi Haxi table;
and taking the task added into the optimal solution thread queue as a tree node of the last layer of tree nodes.
In a preferred embodiment of the present invention, in response to completion of task execution, deleting the corresponding tree node for the task in the thread Chi Haxi table comprises:
in response to completion of task execution, deleting tree nodes corresponding to the tasks in a thread Chi Haxi table;
taking the tree node of the next layer of the deleted tree node as the tree node of the first layer under the root node;
and sequentially moving the tree nodes of other layers to the tree nodes of the upper layer.
By using the technical scheme of the invention, new tasks can be reasonably distributed, the task number of each thread in the thread pool is ensured to be the same, resources can be reasonably utilized, breadth priority is followed when tasks are distributed, the searching efficiency can be improved, the tasks to be executed and executed in execution are managed, and the management of the thread pool is more transparent.
Based on the above object, a fourth aspect of the embodiments of the present invention proposes a computer-readable storage medium. FIG. 6 is a schematic diagram illustrating one embodiment of a computer-readable storage medium provided by the present invention. As shown in fig. 6, the computer-readable storage medium 31 stores a computer program 32 that, when executed by a processor, performs the following method:
establishing a thread Chi Haxi table;
responding to the task to be issued into a thread pool, acquiring an optimal solution thread from an online Cheng Chiha Xie table, and adding the task into an optimal solution thread queue;
the tasks added into the optimal solution thread queue are used as tree nodes of the optimal solution threads to be updated into a thread Chi Haxi table;
in response to completion of task execution, the tree node corresponding to the task is deleted in the thread Chi Haxi table.
In a preferred embodiment of the present invention, further comprising:
all threads in the thread pool are set as root nodes in the thread Chi Haxi table.
In a preferred embodiment of the present invention, in response to the task being issued into the thread pool, obtaining the optimal solution thread in the online Cheng Chiha table and adding the task into the optimal solution thread queue comprises:
responding to the task issued to a thread pool, and searching an optimal solution thread in a thread Chi Haxi table according to a breadth-first searching method;
and adding the tasks into the optimal solution thread queues, wherein the tasks in each thread queue are arranged according to the adding sequence.
In a preferred embodiment of the present invention, looking up the optimal solution thread in the thread Chi Haxi table according to the breadth-first search method includes:
searching whether each root node in the thread Chi Haxi table has a tree node or not;
and in response to the fact that the root node does not exist in the tree node, taking the thread without the tree node as an optimal solution thread.
In a preferred embodiment of the present invention, further comprising:
responding to all the tree nodes in the root node, and searching whether a second layer of tree nodes exist under the first layer of tree nodes under the root node;
and responding to the fact that the second-layer tree nodes do not exist under the first-layer tree nodes under the root node, and taking the threads without the second-layer tree nodes as optimal solution threads.
In a preferred embodiment of the present invention, updating the tasks added to the optimal solution thread queue as tree nodes for the optimal solution threads into the thread Chi Haxi table includes:
searching all tree nodes corresponding to the optimal solution thread in a thread Chi Haxi table;
and taking the task added into the optimal solution thread queue as a tree node of the last layer of tree nodes.
In a preferred embodiment of the present invention, in response to completion of task execution, deleting the corresponding tree node for the task in the thread Chi Haxi table comprises:
in response to completion of task execution, deleting tree nodes corresponding to the tasks in a thread Chi Haxi table;
taking the tree node of the next layer of the deleted tree node as the tree node of the first layer under the root node;
and sequentially moving the tree nodes of other layers to the tree nodes of the upper layer.
By using the technical scheme of the invention, new tasks can be reasonably distributed, the task number of each thread in the thread pool is ensured to be the same, resources can be reasonably utilized, breadth priority is followed when tasks are distributed, the searching efficiency can be improved, the tasks to be executed and executed in execution are managed, and the management of the thread pool is more transparent.
Furthermore, the method disclosed according to the embodiment of the present invention may also be implemented as a computer program executed by a processor, which may be stored in a computer-readable storage medium. The above-described functions defined in the methods disclosed in the embodiments of the present invention are performed when the computer program is executed by a processor.
Furthermore, the above-described method steps and system units may also be implemented using a controller and a computer-readable storage medium storing a computer program for causing the controller to implement the above-described steps or unit functions.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the disclosure herein may be implemented as electronic hardware, computer software, or combinations of both. To clearly illustrate this interchangeability of hardware and software, various illustrative components, blocks, modules, circuits, and steps have been described above generally in terms of their functionality. Whether such functionality is implemented as software or hardware depends upon the particular application and design constraints imposed on the overall system. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present disclosure.
In one or more exemplary designs, the functions may be implemented in hardware, software, firmware, or any combination thereof. If implemented in software, the functions may be stored on or transmitted over as one or more instructions or code on a computer-readable medium. Computer-readable media includes both computer storage media and communication media including any medium that facilitates transfer of a computer program from one location to another. A storage media may be any available media that can be accessed by a general purpose or special purpose computer. By way of example, and not limitation, such computer-readable media can comprise RAM, ROM, EEPROM, CD-ROM or other optical disk storage, magnetic disk storage or other magnetic storage devices, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a general purpose or special purpose computer or general purpose or special purpose processor. Further, any connection is properly termed a computer-readable medium. For example, if the software is transmitted from a website, server, or other remote source using a coaxial cable, fiber optic cable, twisted pair, digital Subscriber Line (DSL), or wireless technologies such as infrared, radio, and microwave, then the coaxial cable, fiber optic cable, twisted pair, DSL, or wireless technologies such as infrared, radio, and microwave are included in the definition of medium. Disk and disc, as used herein, includes Compact Disc (CD), laser disc, optical disc, digital Versatile Disc (DVD), floppy disk, blu-ray disc where disks usually reproduce data magnetically, while discs reproduce data optically with lasers. Combinations of the above should also be included within the scope of computer-readable media.
The foregoing is an exemplary embodiment of the present disclosure, but it should be noted that various changes and modifications could be made herein without departing from the scope of the disclosure as defined by the appended claims. The functions, steps and/or actions of the method claims in accordance with the disclosed embodiments described herein need not be performed in any particular order. Furthermore, although elements of the disclosed embodiments may be described or claimed in the singular, the plural is contemplated unless limitation to the singular is explicitly stated.
It should be understood that as used herein, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly supports the exception. It should also be understood that "and/or" as used herein is meant to include any and all possible combinations of one or more of the associated listed items.
The foregoing embodiment of the present invention has been disclosed with reference to the number of embodiments for the purpose of description only, and does not represent the advantages or disadvantages of the embodiments.
It will be understood by those skilled in the art that all or part of the steps for implementing the above embodiments may be implemented by hardware, or may be implemented by a program for instructing relevant hardware, and the program may be stored in a computer readable storage medium, where the storage medium may be a read-only memory, a magnetic disk or an optical disk, etc.
Those of ordinary skill in the art will appreciate that: the above discussion of any embodiment is merely exemplary and is not intended to imply that the scope of the disclosure of embodiments of the invention, including the claims, is limited to such examples; combinations of features of the above embodiments or in different embodiments are also possible within the idea of an embodiment of the invention, and many other variations of the different aspects of the embodiments of the invention as described above exist, which are not provided in detail for the sake of brevity. Therefore, any omission, modification, equivalent replacement, improvement, etc. of the embodiments should be included in the protection scope of the embodiments of the present invention.

Claims (10)

1. A method of thread pool management, comprising the steps of:
establishing a thread Chi Haxi table;
responding to the task to be issued into a thread pool, acquiring an optimal solution thread from an online Cheng Chiha Xie table, and adding the task into an optimal solution thread queue;
the tasks added into the optimal solution thread queue are used as tree nodes of the optimal solution threads to be updated into a thread Chi Haxi table;
in response to completion of task execution, the tree node corresponding to the task is deleted in the thread Chi Haxi table.
2. The method as recited in claim 1, further comprising:
all threads in the thread pool are set as root nodes in the thread Chi Haxi table.
3. The method of claim 1, wherein in response to the task being issued into the thread pool, obtaining the optimal solution thread in the online Cheng Chiha table and adding the task to the optimal solution thread queue comprises:
responding to the task issued to a thread pool, and searching an optimal solution thread in a thread Chi Haxi table according to a breadth-first searching method;
and adding the tasks into the optimal solution thread queues, wherein the tasks in each thread queue are arranged according to the adding sequence.
4. The method of claim 3, wherein looking up the optimal solution thread in the thread Chi Haxi table according to the breadth-first search method comprises:
searching whether each root node in the thread Chi Haxi table has a tree node or not;
and in response to the fact that the root node does not exist in the tree node, taking the thread without the tree node as an optimal solution thread.
5. The method as recited in claim 4, further comprising:
responding to all the tree nodes in the root node, and searching whether a second layer of tree nodes exist under the first layer of tree nodes under the root node;
and responding to the fact that the second-layer tree nodes do not exist under the first-layer tree nodes under the root node, and taking the threads without the second-layer tree nodes as optimal solution threads.
6. The method of claim 1, wherein updating the task added to the optimal solution thread queue as a tree node for the optimal solution thread into the thread Chi Haxi table comprises:
searching all tree nodes corresponding to the optimal solution thread in a thread Chi Haxi table;
and taking the task added into the optimal solution thread queue as a tree node of the last layer of tree nodes.
7. The method of claim 1, wherein in response to completion of task execution, deleting the corresponding tree node for the task in the thread Chi Haxi table comprises:
in response to completion of task execution, deleting tree nodes corresponding to the tasks in a thread Chi Haxi table;
taking the tree node of the next layer of the deleted tree node as the tree node of the first layer under the root node;
and sequentially moving the tree nodes of other layers to the tree nodes of the upper layer.
8. An apparatus for thread pool management, the apparatus comprising:
a creation module configured to create a thread Chi Haxi table;
the searching module is configured to respond to the task and issue the task to the thread pool, acquire an optimal solution thread from the online Cheng Chiha Highway table, and add the task to the optimal solution thread queue;
the updating module is configured to update the tasks added into the optimal solution thread queue into a thread Chi Haxi table as tree nodes of the optimal solution threads;
and the deleting module is configured to delete the tree node corresponding to the task in the thread Chi Haxi table in response to completion of task execution.
9. A computer device, comprising:
at least one processor; and
a memory storing computer instructions executable on the processor, which when executed by the processor, perform the steps of the method of any one of claims 1-7.
10. A computer readable storage medium storing a computer program, characterized in that the computer program when executed by a processor implements the steps of the method of any one of claims 1-7.
CN202310674130.2A 2023-06-07 2023-06-07 Thread pool management method, device, equipment and medium Pending CN116820712A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310674130.2A CN116820712A (en) 2023-06-07 2023-06-07 Thread pool management method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310674130.2A CN116820712A (en) 2023-06-07 2023-06-07 Thread pool management method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN116820712A true CN116820712A (en) 2023-09-29

Family

ID=88119620

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310674130.2A Pending CN116820712A (en) 2023-06-07 2023-06-07 Thread pool management method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN116820712A (en)

Similar Documents

Publication Publication Date Title
US11297130B2 (en) Cluster resource management in distributed computing systems
CN110197079B (en) Secure regions in knowledge graph
CN111107131A (en) Management method and device of Internet of things equipment, server and storage medium
US20230229496A1 (en) Allocating resources for network function virtualization
CN106856438A (en) A kind of method of Network instantiation, device and NFV systems
CN113805816B (en) Disk space management method, device, equipment and storage medium
CN104424222B (en) Database index method and device
KR20200141208A (en) Grahp data processing methdo and apparatus thereof
CN115185679A (en) Task processing method and device for artificial intelligence algorithm, server and storage medium
Lin et al. Infinite-llm: Efficient llm service for long context with distattention and distributed kvcache
US20200394077A1 (en) Map reduce using coordination namespace hardware acceleration
US11403026B2 (en) Method, device and computer program product for managing storage system
CN114490062A (en) Local disk scheduling method and device, electronic equipment and storage medium
CN114138181A (en) Method, device, equipment and readable medium for placing, grouping and selecting owners in binding pool
CN116820712A (en) Thread pool management method, device, equipment and medium
CN113419828B (en) Object storage life cycle management method and system
CN114528078A (en) Data migration method, device, equipment and medium for object storage
US11782765B2 (en) Method, device, and program product for managing computing system
US8832176B1 (en) Method and system for processing a large collection of documents
CN114153594A (en) Content distribution network preheating method, system, electronic equipment and storage medium
CN113806076A (en) Method, device and equipment for allocating memory in four-control environment and readable medium
CN115686811A (en) Process management method, device, computer equipment and storage medium
KR102054068B1 (en) Partitioning method and partitioning device for real-time distributed storage of graph stream
CN110780993A (en) Kubernetes-based resource scheduling optimization method, equipment and medium
CN116069263B (en) File system optimization method, device, server, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination