Thread resource scheduling method, device, storage medium and electronic device

By obtaining the maximum number of threads and initial time complexity of thread resources, determining the thread weight and allocating the number of threads, the problem of unbalanced thread resource allocation is solved, and data processing efficiency and system stability are improved.

CN114237895BActive Publication Date: 2024-11-05CHINA TELECOM CORP LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202111559737.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-12-20
Publication Date
2024-11-05
Estimated Expiration
2041-12-20

AI Technical Summary

Technical Problem

When processing massive data, unbalanced thread resource allocation of each node leads to excessive system resource usage, which is prone to memory overflow and other problems, affecting system stability and efficiency.

Method used

By obtaining the maximum number of threads and initial time complexity of thread resources, determining the thread weight, and allocating the number of threads according to the weight and maximum number of threads, building a private thread pool, dynamically adjusting the thread weight and thread pool size to achieve resource balance.

Benefits of technology

It improves the efficiency of nodes in processing data, maximizes the performance of server hardware, ensures system stability, and avoids excessive resource usage and memory overflow problems.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114237895B_ABST
    Figure CN114237895B_ABST
Patent Text Reader

Abstract

The present disclosure provides a method, device, storage medium and electronic device for thread resource scheduling, which relates to the field of computer technology. The method includes: obtaining the maximum number of threads available in the thread resources, and obtaining the initial time complexity of the thread node to be allocated; determining the thread weight of the thread node to be allocated according to the initial time complexity; determining the number of threads of the thread node to be allocated according to the thread weight of the thread node to be allocated and the maximum number of threads. The method can solve the problem of uneven thread resource allocation of each node in the related technology, greatly improve the efficiency of node processing data, maximize the performance of server hardware, and ensure the stability of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, storage medium and electronic device for thread resource scheduling. Background Art

[0002] With the rapid development of computer and communication technology, there are massive amounts of data that need to be processed in various complex ways. When processing massive amounts of data, it is often necessary to perform corresponding operations through different nodes. Due to the differences in the data processing mode and processing efficiency of each node, there will be an obvious bucket effect in performance. In this case, it is difficult to ensure the stability of the system and the efficiency of system data processing. At present, the conventional solution to this problem is mostly to directly use multi-threading to call nodes with longer execution time. However, this method is prone to excessive system resource usage and uneven resource allocation of each node in the system when scheduling multiple nodes, leaving a huge hidden danger to the system. Once memory overflow occurs, it will cause irreparable consequences. There is still a lot of room for exploration in the field of scientific and efficient scheduling algorithms.

[0003] To sum up, how to ensure balanced allocation of thread resources among nodes is a problem that needs to be solved at present. Summary of the invention

[0004] The purpose of the present disclosure is to provide a method, device, storage medium and electronic device for thread resource scheduling to solve the problem of unbalanced allocation of thread resources among nodes in the related art.

[0005] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.

[0006] According to one aspect of the present disclosure, a method for thread resource scheduling is provided, including: obtaining the maximum number of threads available in thread resources, and obtaining the initial time complexity of the thread node to be allocated; determining the thread weight of the thread node to be allocated based on the initial time complexity; determining the number of threads of the thread node to be allocated based on the thread weight of the thread node to be allocated and the maximum number of threads.

[0007] In one embodiment of the present disclosure, determining the thread weight of the thread node to be assigned based on the initial time complexity includes: determining the proportion of the initial time complexity of each thread node to be assigned to the sum of the initial time complexities of all thread nodes to be assigned, and determining the proportion as the thread weight of each thread node to be assigned.

[0008] In one embodiment of the present disclosure, after determining the number of threads of the thread node to be assigned, the method also includes: obtaining the operating efficiency of the thread node to be assigned based on the scheduled task; judging whether the thread node to be assigned meets the conditions for updating the thread weight according to the operating efficiency; and updating the thread weight of the thread node to be assigned in response to meeting the conditions for updating the thread weight.

[0009] In one embodiment of the present disclosure, obtaining the operating efficiency of the thread node to be assigned based on the scheduled task includes: obtaining the execution time complexity of the thread node to be assigned based on the scheduled task; and determining the operating efficiency of the thread node to be assigned according to the execution time complexity.

[0010] In one embodiment of the present disclosure, the operation efficiency of the thread node to be allocated is the variance of the execution time complexity.

[0011] In one embodiment of the present disclosure, the condition for updating the thread weight is that the variance of the execution time complexity is greater than a preset value.

[0012] In one embodiment of the present disclosure, after determining the number of threads of the thread node to be allocated, the method further includes: allocating the thread resources according to the number of threads of the thread node to be allocated, and constructing a private thread pool of the thread node to be allocated.

[0013] According to another aspect of the present disclosure, a device for thread resource scheduling is provided, including: an acquisition module, used to obtain the maximum number of threads available in the thread resources, and the initial time complexity of the thread node to be allocated; a weight determination module, used to determine the thread weight of the thread node to be allocated according to the initial time complexity; a thread number determination module, used to determine the number of threads of the thread node to be allocated according to the thread weight of the thread node to be allocated and the maximum number of threads.

[0014] In one embodiment of the present disclosure, the weight determination module is also used to: determine the proportion of the initial time complexity of each thread node to be assigned to the sum of the initial time complexities of all thread nodes to be assigned, and determine the proportion as the thread weight of each thread node to be assigned.

[0015] In one embodiment of the present disclosure, the device also includes a weight update module, which is used to obtain the operating efficiency of the thread node to be assigned based on the scheduled task; determine whether the thread node to be assigned meets the conditions for updating the thread weight according to the operating efficiency; and update the thread weight of the thread node to be assigned in response to meeting the conditions for updating the thread weight.

[0016] In one embodiment of the present disclosure, the weight updating module is further used to: obtain the execution time complexity of the thread node to be assigned based on the scheduled task; and determine the operation efficiency of the thread node to be assigned according to the execution time complexity.

[0017] In one embodiment of the present disclosure, the operation efficiency of the thread node to be allocated is the variance of the execution time complexity.

[0018] In one embodiment of the present disclosure, the condition for updating the thread weight is that the variance of the execution time complexity is greater than a preset value.

[0019] In one embodiment of the present disclosure, the device further includes a thread pool construction module, which is used to allocate the thread resources according to the number of threads of the thread node to be allocated, and to construct a private thread pool of the thread node to be allocated.

[0020] According to another aspect of the present disclosure, a computer-readable storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the method for scheduling thread resources is implemented.

[0021] According to another aspect of the present disclosure, an electronic device is provided, comprising: a processor; and a memory for storing executable instructions of the processor; wherein the processor is configured to execute the above-mentioned thread resource scheduling method by executing the executable instructions.

[0022] The thread resource scheduling method provided by the embodiment of the present disclosure can determine the operation status of the node and the operation efficiency of each node according to the initial time complexity of each thread node to be assigned, further automatically analyze the data processing mode of each node to obtain the thread weight of the current node, and then allocate a reasonable number of threads to each node for concurrent processing according to the thread weight. It can greatly improve the efficiency of node data processing, maximize the performance of server hardware, and ensure the stability of the system.

[0023] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS

[0024] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.

[0025] Figure 1A schematic diagram showing an exemplary system architecture to which the method for generating an apartment outline according to an exemplary embodiment of the present disclosure can be applied;

[0026] Figure 2 A flowchart of a method for thread resource scheduling according to an embodiment of the present disclosure is shown;

[0027] Figure 3 A schematic diagram of data flow processing in the prior art is shown;

[0028] Figure 4 A flowchart of a method for thread resource scheduling according to an embodiment of the present disclosure is shown;

[0029] Figure 5 A schematic diagram showing data flow processing according to an embodiment of the present disclosure is shown;

[0030] Figure 6 A flowchart showing thread weight update according to an embodiment of the present disclosure is shown;

[0031] Figure 7 A block diagram showing an apparatus for thread resource scheduling according to an embodiment of the present disclosure; and

[0032] Figure 8 A structural block diagram of a device for generating an apartment outline in an embodiment of the present disclosure is shown. DETAILED DESCRIPTION

[0033] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that the disclosure will be more comprehensive and complete and to fully convey the concepts of the example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments.

[0034] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.

[0035] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of the present disclosure, the meaning of "plurality" is at least two, such as two, three, etc., unless otherwise clearly and specifically defined.

[0036] In view of the technical problems existing in the above-mentioned related technologies, an embodiment of the present disclosure provides a method for thread resource scheduling, so as to solve at least one or all of the above-mentioned technical problems.

[0037] Figure 1 The diagram shows an exemplary system architecture to which the thread resource scheduling method according to the exemplary embodiments of the present disclosure can be applied.

[0038] like Figure 1 As shown, the system architecture may include a server 101, a network 102, and a client 103. The network 102 may provide a medium for a communication link between the client 103 and the server 101. The network 102 may include various connection types, such as wired, wireless communication links, or fiber optic cables.

[0039] The server 101 may be a server that provides various services, such as a background management server that provides support for devices operated by users using the client. The background management server may analyze and process the received request data, and feed back the processing results to the client.

[0040] The client 103 may be a mobile terminal such as a mobile phone, a game console, a tablet computer, an e-book reader, smart glasses, smart home devices, AR (Augmented Reality) devices, VR (Virtual Reality) devices, etc., or the client 103 may also be a personal computer, such as a laptop computer and a desktop computer.

[0041] In an exemplary embodiment of the present disclosure, the server may, for example, obtain the maximum number of threads available in the thread resources, and obtain the initial time complexity of the thread node to be allocated; determine the thread weight of the thread node to be allocated based on the initial time complexity; and determine the number of threads of the thread node to be allocated based on the thread weight of the thread node to be allocated and the maximum number of threads.

[0042] It should be understood that Figure 1The number of clients, networks and servers is merely illustrative. The server 101 may be a physical server, a server cluster consisting of multiple servers, or a cloud server. Depending on actual needs, it may have any number of terminal devices, networks and servers.

[0043] Hereinafter, each step of the method for generating an apartment outline in the exemplary embodiment of the present disclosure will be described in more detail with reference to the accompanying drawings and embodiments.

[0044] Figure 2 A flowchart of a method for thread resource scheduling according to an embodiment of the present disclosure is shown. The method provided by the embodiment of the present disclosure can be performed as follows: Figure 1 The process is executed in the server or client shown in the figure, but the present disclosure is not limited to this.

[0045] In the following examples, the server cluster 101 is used as the execution subject for example description.

[0046] like Figure 2 As shown, the method for generating thread resource scheduling provided by the embodiment of the present disclosure may include the following steps.

[0047] Step S210, obtain the maximum number of threads available in the thread resources, and obtain the initial time complexity of the thread node to be allocated. Among them, the maximum number of threads available in the thread resources can be determined in advance based on the hardware of the server where the system is located, and the maximum number of threads that the entire system can withstand while meeting the current business high-efficiency operation is obtained through stress testing. The thread node to be allocated can implement various services that require more resources, such as calling downstream HTTP interfaces, MQ queue enqueueing, database query, IO stream reading, etc. The initial time complexity refers to the time difference between the end of the node call and the start of the call. In this embodiment, there are two ways to obtain the initial time complexity, one is pre-set, and the other can be based on the average time complexity of each node recorded in real time.

[0048] Step S220, determining the thread weight of the thread node to be allocated according to the initial time complexity. In the embodiment of the present disclosure, the initial operation efficiency of each node is determined by the initial time complexity of each thread node to be allocated. Then, by determining the thread weight of the thread node to be allocated according to the initial time complexity, it reflects that the thread weight of each node is determined according to the initial operation efficiency of each node, so that the allocation of thread resources is more reasonable, and the operation efficiency of each node can be higher.

[0049] Step S230, determining the number of threads of the thread node to be allocated according to the thread weight of the thread node to be allocated and the maximum number of threads. Optionally, after determining the thread weight of each node, thread resources can be allocated according to the number of threads of each thread node to be allocated, and a private thread pool of each thread node to be allocated can be constructed to facilitate thread calls of each node.

[0050] In such Figure 3 In the data stream processing chain shown, the thread resources of each node are unevenly distributed through the existing technology, which will lead to the problem of processing chain congestion. Specifically, if the processing time of node C is too long, node B will be congested, and further congestion of node B will also lead to congestion of node A. Therefore, the congestion of the processing chain will seriously lead to the instability of the data stream processing system and the low real-time operation efficiency of each node.

[0051] According to the embodiments of the present disclosure, the operating status of the nodes and the operating efficiency of each node can be determined based on the initial time complexity of each thread node to be assigned, and the data processing mode of each node can be further automatically analyzed to obtain the thread weight of the current node, and then a reasonable number of threads can be allocated to each node according to the thread weight for concurrent processing.

[0052] Figure 4 A flowchart of a method for thread resource scheduling according to an embodiment of the present disclosure is shown. Figure 4 As shown, the thread resource scheduling method may include:

[0053] Step S410, obtaining the maximum number of threads available in the thread resources, and obtaining the initial time complexity of all thread nodes to be allocated.

[0054] Step S420, determine the proportion of the initial time complexity of each thread node to be allocated to the sum of the initial time complexities of all thread nodes to be allocated, and determine the proportion as the thread weight of each thread node to be allocated. For example, assuming that the thread nodes to be allocated are node1, node2, node3..., noden, where n is the number of thread nodes to be allocated, the initial time complexity of each thread node to be allocated obtained by step S410 is T1, T2,...T n , then the thread weight of the node is:

[0055]

[0056] Among them, i is equal to 1, 2, 3…, n.

[0057] Step S430, according to the thread weight of each thread node to be allocated and the maximum number of threads, determine the number of threads of each thread node to be allocated. For the above example, assuming that the maximum number of threads available in the thread resource obtained by step S410 is N, and after the thread weight of the node is determined by step S420, the number of threads of the node is determined as:

[0058]

[0059] Step S440: Based on the scheduled task, the operation efficiency of the thread node to be assigned is obtained, which is the real-time operation efficiency of each node.

[0060] Step S450: judging whether the thread node to be allocated meets the condition for updating the thread weight according to the operation efficiency.

[0061] Step S460: in response to satisfying the thread weight update condition, updating the thread weight of the thread node to be assigned.

[0062] According to the disclosed embodiment, if the operating efficiency of each node changes greatly within a period of time, the thread weight of each node can be recalculated, thereby dynamically modifying the weight of each node and the number of threads in the thread pool. Under the same hardware environment, the system data processing efficiency can be greatly improved, and the thread resources occupied by each node can be balanced in real time. This perfectly solves the "bottleneck" and "bucket effect" problems that occur in the data processing process.

[0063] Figure 5 A schematic diagram of data flow processing according to an embodiment of the present disclosure is shown. Figure 5 As shown, the process of performing data stream processing according to the embodiment of the present disclosure includes:

[0064] Step 1: The data processing time complexity of reading nodes A, B, C, and D is Ta, Tb, Tc, and Td, and the maximum number of threads for reading is 8. Node A is the upstream node and is only a call initiator in this graph logic. Node B is used to call nodes C and D. Therefore, there is no weighted algorithm in the A node system. The main body of the weighted algorithm is node B. There is no weighted algorithm in the A, C, and D node programs.

[0065] Step 2: The data flow must first pass through node A. Before processing at node A, its thread weight is 100%, and the number of threads allocated in the weight line pool of node A is 8;

[0066] Step 3: Execute the weighted algorithm in node B. Specifically, the thread weights of nodes C and D are determined to be Tc / (Tc+Td) and Td / (Tc+Td) according to Tc and Td, respectively. Assuming that they are 62.5% and 37.5% respectively, the number of threads to be allocated in the weighted line pools of nodes C and D is 8*62.5%=5 and 8*37.5%=3 respectively.

[0067] Step 4: When executing the weighted algorithm in node B, the current data processing time of nodes C and D is recorded according to the scheduled task, and the thread weights of nodes C and D are recalculated to adjust the thread allocation of nodes C and D.

[0068] Figure 6 FIG. 4 is a flowchart showing thread weight update according to an embodiment of the present disclosure. Figure 6 As shown, the process of updating thread weight may include:

[0069] Step S610, based on the scheduled task, obtain the execution time complexity of the thread node to be assigned. The execution time complexity of each node is the real-time time complexity of the node, that is, the time taken to process data in real time. Specifically, the execution time complexity can be determined by calculating the time from the end of the node call to the start of the node call through the scheduled task. For example, assuming that the execution time complexity of the n thread nodes to be assigned is recorded as: T1', T2', ... T n '.

[0070] Step S620, determine the operating efficiency of the thread node to be assigned according to the execution time complexity. The operating efficiency of the thread node to be assigned is the variance of the execution time complexity. Specifically, each time a node starts calling and ends calling, there is a corresponding record, which can be a database record or a log. The time difference between the end of each node call and the start of the node call is calculated through the timed task of step S610, and then the variance of all the call times during this period is calculated, that is, according to T1', T2', ...T n 'And the following variance formula calculates the variance of each execution time complexity:

[0071]

[0072] Step S630, if the variance of the execution time complexity is greater than the preset value, it is determined that the thread node to be assigned meets the condition for updating the thread weight. For example, if the variance of the execution time complexity is greater than 50% of the unit time, the node weighting formula is re-triggered, the number of threads that can be assigned to each node is recalculated, and the previous thread pool allocation strategy is modified. Among them, the unit time refers to the time complexity used by this node when the weighted thread pool is initially or last assigned thread calculation.

[0073] Step S640: adjusting the number of threads allocated to the thread node to be allocated according to the updated thread weight of the thread node to be allocated.

[0074] According to the embodiment of the present disclosure, by real-time monitoring of the operating status of the current system, the real-time operating efficiency of each node can be calculated, and the variance formula is used Determine whether to change the current weighted thread pool strategy so that the weighted thread pool is dynamically allocated according to the current system operation status, ensure that the weighted thread pool strategy conforms to the operation status of each node in the current system, and ensure the soundness and stability of the system.

[0075] It should be noted that the above figures are only schematic illustrations of the processes included in the method according to an exemplary embodiment of the present invention, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.

[0076] Figure 7 FIG. 1 is a block diagram of a thread resource scheduling device according to an embodiment of the present disclosure. Figure 7 As shown, the apparatus 700 for thread resource scheduling may include: an acquisition module 701 , a weight determination module 702 , and a thread number determination module 703 .

[0077] Among them, the acquisition module 701 can be used to: obtain the maximum number of threads available in the thread resources, and the initial time complexity of the thread node to be allocated; the weight determination module 702 can be used to: determine the thread weight of the thread node to be allocated according to the initial time complexity; the thread number determination module 703 can be used to: determine the number of threads of the thread node to be allocated according to the thread weight of the thread node to be allocated and the maximum number of threads.

[0078] In an exemplary embodiment, the weight determination module 702 may also be used to determine the proportion of the initial time complexity of each thread node to be assigned to the sum of the initial time complexities of all thread nodes to be assigned, and determine the proportion as the thread weight of each thread node to be assigned.

[0079] In an exemplary embodiment, the device also includes a weight update module, which can be used to: obtain the operating efficiency of the thread node to be assigned based on the scheduled task; determine whether the thread node to be assigned meets the conditions for updating the thread weight according to the operating efficiency; and update the thread weight of the thread node to be assigned in response to meeting the conditions for updating the thread weight.

[0080] In an exemplary embodiment, the weight updating module may also be used to: obtain the execution time complexity of the thread node to be assigned based on the scheduled task; and determine the operation efficiency of the thread node to be assigned according to the execution time complexity.

[0081] In an exemplary embodiment, the operation efficiency of the thread node to be allocated is the variance of the execution time complexity.

[0082] In an exemplary embodiment, the condition for updating the thread weight is that the variance of the execution time complexity is greater than a preset value.

[0083] In an exemplary embodiment, the device also includes a thread pool construction module, which can be used to allocate thread resources according to the number of threads of the thread node to be allocated, and build a private thread pool of the thread node to be allocated.

[0084] It should be noted that the block diagrams shown in the above figures are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.

[0085] Figure 8 The structural block diagram of a thread resource scheduling generation device in the embodiment of the present disclosure is shown. It should be noted that the electronic device shown in the figure is only an example and should not bring any limitation to the function and scope of use of the embodiment of the present invention.

[0086] Refer to the following Figure 8 An electronic device 800 according to this embodiment of the present invention will be described. Figure 8 The electronic device 800 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0087] like Figure 8 As shown, the electronic device 800 is in the form of a general computing device. The components of the electronic device 800 may include but are not limited to: at least one processing unit 810, at least one storage unit 820, and a bus 830 connecting different system components (including the storage unit 820 and the processing unit 810).

[0088] The storage unit stores program codes, which can be executed by the processing unit 810, so that the processing unit 810 performs the steps according to various exemplary embodiments of the present invention described in the above “Exemplary Method” section of this specification. For example, the processing unit 810 can perform the following steps: Figure 2 In step S210 shown in the figure, the maximum number of threads available in the thread resources is obtained, and the initial time complexity of the thread node to be allocated is obtained; in step S220, the thread weight of the thread node to be allocated is determined according to the initial time complexity; in step S230, the number of threads of the thread node to be allocated is determined according to the thread weight of the thread node to be allocated and the maximum number of threads.

[0089] The storage unit 820 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 8201 and / or a cache memory unit 8202 , and may further include a read-only memory unit (ROM) 8203 .

[0090] The storage unit 820 may also include a program / utility 8204 having a set (at least one) of program modules 8205, such program modules 8205 including but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment.

[0091] Bus 830 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.

[0092] The electronic device 800 may also communicate with one or more external devices 900 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 1000, and / or communicate with any device that enables the electronic device 800 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 850. Furthermore, the electronic device 1000 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 860. As shown, the network adapter 860 communicates with other modules of the electronic device 800 via a bus 830. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 800, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, etc.

[0093] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0094] In an exemplary embodiment of the present disclosure, a computer-readable storage medium is also provided, on which a program product capable of implementing the above method of the present specification is stored. In some possible implementations, various aspects of the present invention can also be implemented in the form of a program product, which includes a program code, and when the program product is run on a terminal device, the program code is used to enable the terminal device to execute the steps according to various exemplary embodiments of the present invention described in the above "Exemplary Method" section of the present specification.

[0095] The program product for implementing the above method according to the embodiment of the present invention may adopt a portable compact disk read-only memory (CD-ROM) and include program code, and may be run on a terminal device, such as a personal computer. However, the program product of the present invention is not limited thereto, and in this document, a readable storage medium may be any tangible medium containing or storing a program, which may be used by or in combination with an instruction execution system, apparatus, or device.

[0096] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.

[0097] Computer readable signal media may include data signals propagated in baseband or as part of a carrier wave, in which readable program code is carried. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Readable signal media may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0098] The program code embodied on the readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the foregoing.

[0099] Program code for performing the operations of the present invention may be written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Java, C++, etc., and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).

[0100] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.

[0101] In addition, although the steps of the method in the present disclosure are described in a specific order in the drawings, this does not require or imply that the steps must be performed in this specific order, or that all the steps shown must be performed to achieve the desired results. Additionally or alternatively, some steps may be omitted, multiple steps may be combined into one step, and / or one step may be decomposed into multiple steps, etc.

[0102] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the implementation of the present disclosure.

[0103] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any modification, use or adaptation of the present disclosure, which follows the general principles of the present disclosure and includes common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the appended claims.

Claims

1. A method for thread resource scheduling, characterized in that: include: Obtain the maximum number of threads available in the thread resources, and obtain the initial time complexity of the thread node to be allocated; wherein the initial time complexity is preset, or the average time complexity of each node recorded in real time; the time complexity of the node is the time difference between the end call and the start call of the node; Determining the thread weight of the thread node to be assigned according to the initial time complexity; which includes: determining the proportion of the initial time complexity of each thread node to be assigned to the sum of the initial time complexities of all thread nodes to be assigned, and determining the proportion as the thread weight of each thread node to be assigned; Determining the number of threads of the thread node to be allocated according to the thread weight of the thread node to be allocated and the maximum number of threads; it includes: determining the number of threads of the thread node to be allocated as the product of the thread weight of the thread node to be allocated and the maximum number of threads.

2. The method according to claim 1, characterized in that: After determining the number of threads to be allocated to the thread node, the method further includes: Based on the scheduled task, the operation efficiency of the thread node to be allocated is obtained; According to the operation efficiency, judging whether the thread node to be assigned meets the condition for updating the thread weight; wherein the condition for updating the thread weight is that the operation efficiency of the thread node to be assigned is greater than a preset value; In response to satisfying a thread weight update condition, updating the thread weight of the to-be-allocated thread node.

3. The method according to claim 2, characterized in that The obtaining the operation efficiency of the thread node to be allocated based on the scheduled task includes: Based on the scheduled task, the execution time complexity of the thread node to be assigned is obtained; wherein the execution time complexity is the time taken by the thread node to be assigned to process data in real time; According to the execution time complexity, the operation efficiency of the thread node to be assigned is determined; wherein the operation efficiency of the thread node to be assigned is the variance of the execution time complexity.

4. The method according to any one of claims 1 to 3, characterized in that: After determining the number of threads to be allocated to the thread node, the method further includes: According to the number of threads of the thread node to be allocated, the thread resources are allocated, and a private thread pool of the thread node to be allocated is constructed.

5. A thread resource scheduling device, characterized in that: include: An acquisition module is used to obtain the maximum number of threads available in the thread resources and the initial time complexity of the thread node to be allocated; wherein the initial time complexity is preset or the average time complexity of each node recorded in real time; the time complexity of a node is the time difference between the end call and the start call of the node; A weight determination module is used to determine the thread weight of the thread node to be assigned according to the initial time complexity; it includes: determining the proportion of the initial time complexity of each thread node to be assigned to the sum of the initial time complexities of all thread nodes to be assigned, and determining the proportion as the thread weight of each thread node to be assigned; The thread number determination module is used to determine the thread number of the thread node to be allocated according to the thread weight of the thread node to be allocated and the maximum number of threads; it includes: multiplying the thread weight of the thread node to be allocated and the maximum number of threads to determine the thread number of the thread node to be allocated.

6. A computer-readable storage medium having a computer program stored thereon, wherein when the program is executed by a processor, the method for thread resource scheduling according to any one of claims 1 to 4 is implemented.

7. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the thread resource scheduling method as described in any one of claims 1 to 4.