Thread pool management method and device, equipment, medium and product
By rationally dividing and adjusting the number of thread pools and their corresponding APIs for kitchen appliances, the problems of resource contention and thread pool accumulation were solved, thereby improving the system performance and response efficiency of the server.
Patent Information
- Application Number
- CN202411225640.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-03
- Publication Date
- 2026-03-10
AI Technical Summary
In the processing of voice control information for kitchen appliances, existing technologies often involve multiple APIs sharing a single thread pool, leading to resource contention and thread starvation. Alternatively, the one-to-one correspondence between APIs and thread pools can result in a large accumulation of thread pools, impacting server system performance.
By determining the initial thread pool information of the voice recipe transmission system, and based on the command parameters of the voice control commands, the correspondence between the number of thread pools and APIs is adjusted, the thread pools are rationally divided, the correspondence between the thread pools and APIs is established, and the management of the thread pools is optimized.
It reduces the waiting and response time for voice control information, saves server processing and energy storage resources, and improves server system performance.
Smart Images

Figure CN121636202A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of household appliances, and in particular to a thread pool management method, device, equipment, medium and product. BACKGROUND
[0002] Voice control information of a kitchen electrical equipment is sent to a thread pool through an application programming interface (API), and each voice control information in the thread pool is processed by a server in sequence.
[0003] Different voice control information needs to be sent by using different APIs. At present, in a voice service, the corresponding mode of the API and the thread pool includes that multiple APIs share one thread pool and that each API is configured to correspond to one thread pool. However, the calling mode and response speed of different voice control information are different, and the multiple APIs sharing one thread pool will cause resource competition and thread starvation problems, resulting in that the waiting time and response time of part of the voice control information are too long. The one-to-one correspondence between the API and the thread pool will cause a large number of thread pool accumulation problems, consume the processing resources of the server, increase the management difficulty and memory usage of the server, and affect the system performance of the server. SUMMARY
[0004] The present application provides a thread pool management method, device, equipment, medium and product, which aims to reasonably determine the number of thread pools and formulate the corresponding relationship between the thread pool and the API, reduce the waiting time and response time of each voice control information, save the processing resources of the server, and improve the system performance of the server.
[0005] According to an aspect of the present application, a thread pool management method is provided, which comprises:
[0006] Determining initial thread pool information of a voice recipe transmission system, wherein the initial thread pool information comprises at least one initial thread pool set and at least one initial service type, the initial thread pool set and the initial service type correspond to each other, and the initial thread pool set comprises at least one initial thread pool.
[0007] Based on the instruction parameters of the voice control instructions in each initial thread pool, a thread pool adjustment scheme is determined.
[0008] Using the thread pool adjustment scheme, the initial thread pool information is adjusted to obtain target thread pool information of the voice recipe transmission system, wherein the target thread pool information comprises at least one target thread pool set and at least one target service type, the target thread pool set and the target service type correspond to each other, the target thread pool set comprises at least one target thread pool, and the initial service type and the target service type correspond to each other.
[0009] According to another aspect of the present invention, a thread pool management apparatus is provided. This apparatus is used to implement the thread pool management method in any embodiment of the present invention. The apparatus includes:
[0010] The acquisition module is used to determine the initial thread pool information of the voice recipe transmission system. The initial thread pool information includes at least one initial thread pool set and at least one initial business type. The initial thread pool set and the initial business type correspond one-to-one. The initial thread pool set includes at least one initial thread pool.
[0011] The determination module is used to determine the thread pool adjustment scheme based on the instruction parameters of the voice control commands in each initial thread pool;
[0012] The execution module is used to adjust the initial thread pool information using a thread pool adjustment scheme to obtain the target thread pool information of the voice recipe transmission system. The target thread pool information includes at least one target thread pool set and at least one target business type. The target thread pool set and the target business type correspond one-to-one. The target thread pool set includes at least one target thread pool. The initial business type and the target business type correspond one-to-one.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] At least one processor; and a memory communicatively connected to the at least one processor;
[0015] The memory stores a computer program that can be executed by at least one processor, which enables the at least one processor to execute the thread pool management method in any embodiment of the present invention.
[0016] According to another aspect of the present invention, a computer-readable storage medium is provided that stores computer instructions for causing a processor to execute and implement the thread pool management method of any embodiment of the present invention.
[0017] According to another aspect of the present invention, a computer program product is provided, the computer program product including a computer program, which, when executed by a processor, implements the thread pool management method of any embodiment of the present invention.
[0018] The thread pool management method of the present invention includes: determining the initial thread pool information of a voice recipe transmission system, wherein the initial thread pool information includes at least one initial thread pool set and at least one initial business type, the initial thread pool set and the initial business type are in one-to-one correspondence, and the initial thread pool set includes at least one initial thread pool; determining a thread pool adjustment scheme based on the instruction parameters of voice control commands in each initial thread pool; and adjusting the initial thread pool information using the thread pool adjustment scheme to obtain the target thread pool information of the voice recipe transmission system, wherein the target thread pool information includes at least one target thread pool set and at least one target business type, the target thread pool set and the target business type are in one-to-one correspondence, the target thread pool set includes at least one target thread pool, and the initial business type and the target business type are in one-to-one correspondence. The technical solution of the present invention can adjust the initial thread pool information of the voice recipe transmission system according to the instruction parameters of voice control commands in each thread pool, and selectively divide the thread pools, for example, reasonably determine the number of thread pools and establish the correspondence between thread pools and APIs, obtain the target thread pool information, reduce the waiting time and response time of each voice control information, save server processing resources and energy storage resources, and improve server system performance. This solution addresses issues such as resource contention and thread starvation caused by multiple APIs sharing a single thread pool, resulting in excessively long waiting and response times for some voice control information; and the problem of a one-to-one correspondence between APIs and thread pools leading to a large accumulation of thread pools, consuming server processing resources, increasing server management complexity and memory usage, and impacting server system performance.
[0019] It should be understood that the description in this section is not intended to identify key or essential features of the embodiments of the present invention, nor is it intended to limit the scope of the invention. Other features of the invention will become readily apparent from the following description. Attached Figure Description
[0020] To more clearly illustrate the technical solutions in this invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0021] Figure 1 This is a flowchart illustrating a thread pool management method provided by the present invention;
[0022] Figure 2 This is a flowchart illustrating another thread pool management method provided by the present invention;
[0023] Figure 3 This is a schematic diagram of a voice recipe transmission process provided by the present invention;
[0024] Figure 4 This is a schematic diagram of the structure of a thread pool management device provided by the present invention;
[0025] Figure 5 This is a schematic diagram of the structure of an electronic device provided by the present invention. Detailed Implementation
[0026] To enable those skilled in the art to better understand the present invention, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are merely some, not all, of the embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort should fall within the scope of protection of the present invention.
[0027] It should be noted that the terms "first," "second," etc., in the specification, claims, and accompanying drawings of this invention are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of the invention described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0028] Figure 1 This is a flowchart illustrating a thread pool management method provided by the present invention. This embodiment is applicable to thread pool management and partitioning, improving the efficiency of distributing voice recipe information, etc. The method can be executed by the thread pool management device provided by the present invention. This device can be implemented in hardware and / or software. In a specific embodiment, the device can be integrated into an electronic device. The following embodiments will illustrate this using the integration of the device into an electronic device as an example. (Refer to...) Figure 1 The method specifically includes the following steps:
[0029] S101. Determine the initial thread pool information for the voice recipe transmission system.
[0030] A voice recipe transmission system can be understood as a system that forwards control information from kitchen appliances. Voice control information sent by a user to one or more kitchen appliances is forwarded to the corresponding appliances via the voice recipe transmission system, enabling the appliances to execute the control commands contained in the voice control information. A thread pool can be understood as a data pool that processes and forwards voice control information; that is, voice control information is responded to and forwarded through the thread pool. The control efficiency and speed of the kitchen appliances are closely related to the number and classification of the thread pools, and the correspondence between the thread pools and the voice information transmission interface. Initial thread pool information can be understood as the thread pool partitioning result set based on information transmission experience.
[0031] Specifically, the initial thread pool information includes at least one initial thread pool set and at least one initial business type, with a one-to-one correspondence between the initial thread pool set and the initial business type, and the initial thread pool set includes at least one initial thread pool.
[0032] Kitchen appliances have multiple functions, including but not limited to baking, timer functions, and mode settings. This invention divides the thread pool according to the functions of the kitchen appliances. The business type can be understood as the identifier corresponding to the function of the kitchen appliance. The initial thread pool set refers to the thread pool corresponding to the function of the kitchen appliance, that is, the pool used to forward and respond to that function. The advantage of this setting is that it can ensure that each function of the kitchen appliance has its corresponding thread pool, avoiding resource contention and thread starvation problems caused by voice control commands of different functions.
[0033] In one implementation, assuming the kitchen appliance functions include baking, reservation, and mode setting, and the service types include reservation service, baking service, and mode setting service, the initial thread pool set includes a baking thread pool set, a reservation thread pool set, and a mode setting thread pool set. If, based on information transmission experience or historical information transmission data, it is known that the baking service and mode setting service are more frequently used, while the reservation service is less frequently used, then the reservation thread pool set can be set to include only one thread pool. This ensures that the reservation function can be used normally, reduces resource waste, and allows for an adaptive increase in the number of thread pools in the baking thread pool set and the mode setting thread pool set to ensure the response rate of voice control commands for the baking service and the mode setting service.
[0034] S102. Determine the thread pool adjustment scheme based on the instruction parameters of the voice control commands in each initial thread pool.
[0035] The control requirements of kitchen appliances change in real time. There may be a large number of reservation requests at time A or during time period A, and a large number of baking requests at time B or during time period B. The command parameters of the voice control commands in the initial thread pool are used to indicate the execution status of the voice control commands in that initial thread pool. This is used to evaluate whether the initial thread pool information of the voice recipe transmission system meets the current voice transmission requirements. For example, there may be a large number of queued voice control messages in the initial thread pool, or no voice control messages requiring execution may be present for an extended period. The thread pool adjustment scheme can be understood as adjustment instructions for the initial thread pool information of the voice recipe transmission system. For example, some thread pools may need to be deleted, some may need to be added, and some may not need to be changed. This embodiment does not limit this.
[0036] Specifically, based on the command parameters of the voice control commands in each initial thread pool, the adjustment method of each initial thread pool can be determined. By summarizing the adjustment methods of each initial thread pool, the thread pool adjustment scheme of the voice recipe transmission system can be obtained.
[0037] For example, assuming that the baking thread pool set, the reservation thread pool set, and the mode setting thread pool set each include one thread pool, and the command parameters of the voice control commands in each initial thread pool indicate that the baking thread pool set is missing two thread pools, the reservation thread pool set does not need adjustment, and the mode setting thread pool set is missing one thread pool, then the thread pool adjustment plan is determined to be to add two thread pools to the baking thread pool set and add one thread pool to the mode setting thread pool set. Secondly, to ensure that the control information for each function can be transmitted normally, when deleting a thread pool, it is necessary to ensure that at least one thread pool exists in the thread pool set. That is, when only one thread pool exists in the thread pool set, it cannot be deleted even if there are no usage records in the short term.
[0038] The advantage of this setup is that it can quickly and accurately analyze the difference between the initial thread pool information and the current control requirements of the kitchen appliances, thereby determining the adjustment plan for the initial thread pool information. This allows the initial thread pool information to be adjusted to meet the current control requirements of the kitchen appliances, improving the user's kitchen appliance control experience.
[0039] S103. Using the thread pool adjustment scheme, adjust the initial thread pool information to obtain the target thread pool information for the voice recipe transmission system.
[0040] The target thread pool can be understood as a thread pool deployment method that meets the user's current kitchen appliance control needs. The target thread pool information includes at least one target thread pool set and at least one target business type. The target thread pool set and the target business type correspond one-to-one. The target thread pool set includes at least one target thread pool, and the initial business type and the target business type correspond one-to-one.
[0041] In one implementation, it is assumed that the initial thread information indicates that the baking thread pool set, the reservation thread pool set, and the mode setting thread pool set each include one thread pool. The thread pool adjustment scheme is to add two thread pools to the baking thread pool set and one thread pool to the mode setting thread pool set. The target thread pool set is the adjusted baking thread pool set, the reservation thread pool set, and the mode setting thread pool set. The adjusted baking thread pool set includes three thread pools, the reservation thread pool set includes one thread pool, and the mode setting thread pool set includes two thread pools.
[0042] The advantage of this setup is that it can improve the response speed of each function while controlling the server's memory consumption and processing resource consumption as much as possible.
[0043] Optionally, the present invention may also periodically acquire the current time and determine whether the current time meets the preset thread pool adjustment time conditions; if the current time meets the preset thread pool adjustment time conditions, the current thread pool information shall be adjusted based on the current time and the preset thread pool adjustment scheme.
[0044] This invention can also be set for specific time periods, such as holidays and peak cooking times. The preset thread pool adjustment time conditions can be understood as the time information for holidays or peak cooking times. Generally, kitchen appliances are used more frequently during holidays and peak cooking times, and the number of voice control messages is larger. The thread pool can be increased adaptively to maintain a shorter device response time.
[0045] It is worth noting that while the thread pool can be increased during holidays and peak cooking seasons, it can also be decreased after holidays or during off-peak cooking seasons.
[0046] The preset thread pool adjustment scheme includes multiple thread pool adjustment methods, which means that different thread increase and decrease methods can be set for different time periods or holidays. This invention can determine the thread pool adjustment method suitable for the current time based on the matching result of the current time and the usage time of each thread increase and decrease scheme, aiming to achieve high response of kitchen appliance voice control with minimal resource consumption.
[0047] The technical solution of this embodiment can adjust the initial thread pool information of the voice recipe transmission system according to the instruction parameters of the voice control commands in each thread pool. It can selectively divide the thread pools, for example, by reasonably determining the number of thread pools and establishing the correspondence between thread pools and APIs, thus obtaining target thread pool information. This reduces the waiting and response times of various voice control messages, saves server processing and storage resources, and improves server system performance. It solves the problems of resource contention and thread starvation caused by multiple APIs sharing a single thread pool, resulting in excessively long waiting and response times for some voice control messages; and the phenomenon of a large accumulation of thread pools due to a one-to-one correspondence between APIs and thread pools, consuming server processing resources, increasing server management difficulty and memory usage, and affecting server system performance.
[0048] Figure 2 This is a flowchart illustrating another thread pool management method provided by the present invention. This embodiment is applicable to thread pool management and partitioning, improving the efficiency of voice recipe information delivery, etc. The method can be executed by the thread pool management device provided by the present invention. This device can be implemented in hardware and / or software. In a specific embodiment, the device can be integrated into an electronic device. The following embodiments will illustrate this using the integration of the device into an electronic device as an example. (Refer to...) Figure 2 The method specifically includes the following steps:
[0049] S201. Based on the service type identifier of the voice recipe transmission system, determine at least one initial service type.
[0050] The service type identifier can be understood as the attribute information of a service (which can be understood as the function of a kitchen appliance), including but not limited to the name and number of the service. At least one initial service type can be understood as the service division result in the voice recipe transmission system, with a one-to-one correspondence between the service type identifier and the initial service type.
[0051] In one implementation, assuming that the business type identifier includes scheduled appointment, unscheduled appointment, baking, frying, temperature, and time, then at least one initial business type includes scheduled appointment type, unscheduled appointment type, baking type, frying type, temperature type, and time type.
[0052] The advantage of this setup is that it allows for the rapid determination of the initial service types of the voice recipe transmission system based on the service type identifier.
[0053] S202. Based on the number of service types of the voice recipe transmission system, at least one initial service type, and the service requirements of at least one initial service type, determine at least one initial thread pool set.
[0054] Different services are used at different frequencies. This invention can allocate more thread pools to frequently used services to ensure the performance of the voice recipe transmission system. The number of service types represents the number of services for kitchen appliances, and the service requirements of the initial service type can be understood as the usage frequency of the initial service type, representing the quantity and size of voice control information for that initial service type. The initial thread pool set corresponds one-to-one with the initial service type, and the initial thread pool set includes at least one initial thread pool.
[0055] Based on the number of service types in the voice recipe transmission system, at least one initial service type, and the service requirements of at least one initial service type, at least one initial thread pool set is determined. Specifically, this may include: determining the number of initial thread pool sets based on the number of service types in the voice recipe transmission system, establishing a correspondence between initial thread pool sets and initial service types, determining the number of thread pools in each initial thread pool set according to the service requirements of the initial service type corresponding to each initial thread pool set, and organizing each initial thread pool set to obtain at least one initial thread pool set.
[0056] The advantage of this setup is that it divides the thread pool according to business type, which facilitates thread pool management and enables high-response, low-resource-consumption transmission of voice control information.
[0057] S203. Based on the instruction parameters of the voice control instructions in each initial thread pool, determine the instruction execution information of each initial thread pool.
[0058] The command parameters of the voice control commands represent the current state of the voice control commands. The command execution information of each initial thread pool can be understood as the execution status of the voice control information in each initial thread pool, including the name and execution status of the voice control information being executed, the name of the voice control information being queued, the queuing time, the estimated waiting time, and other information. Specifically, the command execution information of each initial thread pool.
[0059] This embodiment monitors the voice control commands in each initial thread pool. The main purpose is to determine whether there are queued voice control messages in each initial thread pool and whether there are no voice control messages. If there are queued voice control messages in the initial thread pools corresponding to a certain service, it is considered that the number of thread pools corresponding to that service is insufficient and needs to be increased. If there are no voice control messages in an initial thread pool, the thread pool is considered to have low utility. When there is more than one thread pool in the thread pool set corresponding to a certain thread pool, it is considered that the thread pool can be deleted. Furthermore, if there are queued voice control messages in an initial thread pool, another thread pool can be added under its corresponding thread pool set to share the workload of that thread pool.
[0060] Specifically, for any voice control command, the transmission process of the voice control command includes: determining the first transmission interface of the voice control command based on the command type of the voice control command; using the first transmission interface, searching in the first correspondence relationship to obtain the first thread pool of the voice control command, wherein the first correspondence relationship is the correspondence between the transmission interface and the thread pool, and the first thread pool is connected to a high-level transmission interface and at least one low-level transmission interface; and transmitting the voice control command to the first thread pool based on the first transmission interface, wherein the first thread pool is a thread pool in at least one initial thread pool set.
[0061] The high-level transmission interface can be understood as the interface for transmitting voice information with high priority and response speed requirements, while the low-level transmission interface can be understood as the interface for transmitting voice information with low priority and response speed requirements. In this invention, a thread pool can connect to at most one high-level transmission interface. The purpose of this setting is to better handle voice information with high priority and response speed requirements, reduce the queuing time of such information, and improve the user's control experience.
[0062] Specifically, the correspondence between the transmission interface and the thread pool can be pre-defined. The advantage of this setting is that it can shorten the information transmission time. Secondly, the present invention will update the correspondence in real time. The advantage of this setting is that it can ensure the real-time, efficient and accurate nature of the information transmission method.
[0063] S204. Based on the instruction execution information of each initial thread pool, determine the adjustment requirements of each initial thread pool.
[0064] The adjustment requirements can be categorized as adjustment direction or adjustment direction and adjustment scale. Adjustment direction can be understood as increasing or decreasing the number of thread pools, while adjustment scale can be understood as the number of thread pools added or decreased. Specifically, determining the adjustment requirements for each initial thread pool based on its instruction execution information can be understood as determining which locations of thread pools need to be removed, which locations need to be added, and the number of thread pools to be added or removed, based on the instruction execution information of each initial thread pool, thus obtaining the adjustment requirements for each initial thread pool.
[0065] For example, suppose a thread pool can handle ten control messages. If the instruction execution information of thread pool 1 indicates that there are twenty-five control messages in the queue, then the adjustment requirement for thread pool 1 is determined to be to add three more thread pools. The advantage of this setting is that the adjustment requirements of each initial thread pool can be determined based on the individual information of each initial thread pool.
[0066] It is worth noting that the unit for determining the thread pool adjustment scheme of the present invention can also be the initial thread pool set. That is, based on the instruction execution information of each initial thread pool set, the adjustment requirements of each initial thread pool set are determined. The advantage of using the initial thread pool set as the unit is that the scale of thread pool reduction can be intuitively and quantitatively determined, without needing to further determine whether the initial thread pool to be reduced is the only thread pool in its corresponding initial thread pool set.
[0067] S205. Based on the adjustment requirements of each initial thread pool, determine the thread pool adjustment plan.
[0068] Specifically, determining the thread pool adjustment plan based on the adjustment requirements of each initial thread pool can be understood as summarizing the adjustment requirements of each initial thread pool to obtain the thread pool adjustment plan for the voice recipe transmission system. For example, assuming there are three thread pools, thread pool A requires adding two thread pools, thread pool B requires adding one thread pool, and thread pool C requires no change, then the determined thread pool adjustment plan is to add one thread pool to thread pool B and two thread pools to thread pool A.
[0069] The advantage of this setup is that it allows for quick and accurate determination of thread pool adjustment strategies.
[0070] Optionally, for any initial thread pool, based on the instruction execution information of the initial thread pool, determine the adjustment requirements of the initial thread pool, including: when the instruction execution information of the initial thread pool indicates that there are waiting voice control instructions in the initial thread pool, it is considered that the current initial thread pool is insufficient to execute control information for the corresponding business type quickly, and the adjustment direction is determined to increase the thread pool, and the adjustment scale is determined based on the instruction information of waiting voice control instructions; when the instruction execution information of the initial thread pool indicates that there are no voice control instructions in the initial thread pool, it is considered that there is no need for the current thread pool, and the adjustment direction is determined to delete the thread pool.
[0071] This invention aims to process voice control commands in parallel, eliminating queuing and improving the response rate of kitchen appliances. Therefore, determining the adjustment scale based on the information of waiting voice control commands can be achieved by determining the number of thread pools capable of processing queued voice control information based on information such as the memory size and quantity of voice control commands, thus solving the queuing problem of voice control commands. It is worth noting that when deleting a thread pool, it is necessary to ensure that the deleted thread pool is not the only thread pool in its initial pool; this limitation aims to ensure that control commands for each business can be processed.
[0072] S206. Using the thread pool adjustment scheme, adjust the initial thread pool information to obtain the target thread pool information for the voice recipe transmission system.
[0073] The target thread pool information includes at least one target thread pool set and at least one target business type. The target thread pool set and the target business type correspond one-to-one. The target thread pool set includes at least one target thread pool. The initial business type and the target business type correspond one-to-one.
[0074] For example, assuming that both the baking thread pool set and the mode setting thread pool set in the initial thread pool set have two thread pools, the thread pool adjustment scheme is to add two thread pools to the baking thread pool set and one thread pool to the mode setting thread pool set. Adjusting the initial thread pool information to obtain the target thread pool information of the voice recipe transmission system can be understood as adding two thread pools to the baking thread pool set in the initial thread pool set and adding one thread pool to the mode setting thread pool set to obtain the target thread pool set. The baking thread pool set in the target thread pool set includes four thread pools, and the mode setting thread pool set includes three thread pools.
[0075] Figure 3 This is a schematic diagram of a voice recipe transmission process provided by the present invention. Solid arrows in the diagram represent data uploads, typically containing runtime information for each thread pool. Dashed lines represent control information transmission, typically containing modification instructions for the thread pools, including but not limited to adding and removing thread pools. The management center can be understood as a device that monitors each thread pool, including but not limited to a Redis registry. This device can register and manage different pools, which refer to pools shared for different business purposes, using thread pools A1 and A2 in the diagram. Figure 3 As can be seen, a thread pool will access multiple interfaces of the same type of business. The multiple thread pools handle different businesses. The management center manages multiple thread pools and sends the data they monitor to the server. On the one hand, the server sends control instructions to the corresponding kitchen appliances so that the corresponding kitchen appliances can perform the corresponding work. On the other hand, it can analyze the data reported by the management center and adjust the allocation of each thread pool in real time.
[0076] The technical solution of this embodiment can adjust the initial thread pool information of the voice recipe transmission system according to the instruction parameters of the voice control commands in each thread pool. For example, the adjustment direction and adjustment scale of each thread pool can be determined according to the instruction parameters of the voice control commands in each thread pool, and the thread pool can be allocated in a targeted manner. The number of thread pools can be reasonably determined and the correspondence between thread pools and APIs can be established to obtain target thread pool information, reduce the waiting time and response time of each voice control information, save server processing resources and energy storage resources, and improve the system performance of the server. This system addresses several issues that arise from multiple APIs sharing a single thread pool, leading to resource contention and thread starvation, resulting in excessively long waiting and response times for some voice control messages. It also resolves the problem of a one-to-one correspondence between APIs and thread pools causing excessive thread pool accumulation, consuming server processing resources, increasing server management complexity and memory usage, and impacting system performance. By adjusting the initial thread pool information of the voice recipe transmission system based on the command parameters of voice control instructions in each thread pool, the system strategically divides thread pools, such as determining the appropriate number of thread pools and establishing the correspondence between thread pools and APIs. This results in target thread pool information, reducing the waiting and response times for various voice control messages, saving server processing and energy storage resources, and improving server system performance.
[0077] Figure 4 This is a schematic diagram of the structure of a thread pool management device provided by the present invention. Figure 4 As shown, the device includes: an acquisition module 301, a determination module 302, and an execution module 303.
[0078] The acquisition module 301 is used to determine the initial thread pool information of the voice recipe transmission system. The initial thread pool information includes at least one initial thread pool set and at least one initial business type. The initial thread pool set and the initial business type correspond one-to-one. The initial thread pool set includes at least one initial thread pool.
[0079] The determination module 302 is used to determine the thread pool adjustment scheme based on the instruction parameters of the voice control commands in each initial thread pool.
[0080] The execution module 303 is used to adjust the initial thread pool information using a thread pool adjustment scheme to obtain the target thread pool information of the voice recipe transmission system. The target thread pool information includes at least one target thread pool set and at least one target business type. The target thread pool set and the target business type correspond one-to-one. The target thread pool set includes at least one target thread pool. The initial business type and the target business type correspond one-to-one.
[0081] Optionally, the acquisition module 301 is specifically used to determine at least one initial business type based on the business type identifier of the voice recipe transmission system, wherein the business type identifier and the initial business type correspond one-to-one; and to determine at least one initial thread pool set based on the number of business types of the voice recipe transmission system, at least one initial business type and the business requirements of at least one initial business type.
[0082] Optionally, the device further includes an information transmission module for transmitting voice control commands. For any given voice control command, the information transmission module is specifically used to determine a first transmission interface for the voice control command based on the command type; using the first transmission interface, a search is performed in a first correspondence relationship to obtain a first thread pool for the voice control command, wherein the first correspondence relationship is the correspondence between transmission interfaces and thread pools, and the first thread pool is connected to a high-level transmission interface and at least one low-level transmission interface; based on the first transmission interface, the voice control command is transmitted to the first thread pool, wherein the first thread pool is a thread pool in at least one initial thread pool set.
[0083] Optionally, the determining module 302 is specifically used to determine the instruction execution information of each initial thread pool based on the instruction parameters of the voice control instructions in each initial thread pool; to determine the adjustment requirements of each initial thread pool based on the instruction execution information of each initial thread pool, wherein the adjustment requirements are the adjustment direction or the adjustment direction and adjustment scale; and to determine the thread pool adjustment scheme based on the adjustment requirements of each initial thread pool.
[0084] Optionally, for any initial thread pool, the determining module 302 is specifically used to determine the adjustment direction as adding a thread pool when the instruction execution information of the initial thread pool indicates that there is a waiting voice control instruction in the initial thread pool, and to determine the adjustment scale based on the instruction information of the waiting voice control instruction; and to determine the adjustment direction as deleting a thread pool when the instruction execution information of the initial thread pool indicates that there is no voice control instruction in the initial thread pool.
[0085] Optionally, the execution module is also used to determine whether the current time meets the preset thread pool adjustment time condition; if the current time meets the preset thread pool adjustment time condition, the current thread pool information is adjusted based on the current time and the preset thread pool adjustment scheme.
[0086] The thread pool management device provided in this embodiment can execute the thread pool management method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0087] Figure 5 This is a schematic diagram of the structure of an electronic device provided by the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (such as helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.
[0088] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the read-only memory (ROM) 12 or loaded from storage unit 18 into the random access memory (RAM) 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0089] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.
[0090] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, digital signal processors (DSPs), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as thread pool management methods.
[0091] In some embodiments, the thread pool management method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the thread pool management method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to execute the thread pool management method by any other suitable means (e.g., by means of firmware).
[0092] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.
[0093] Computer programs used to implement the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be performed. The computer programs may be executed entirely on a machine, partially on a machine, or as a standalone software package, partially on a machine and partially on a remote machine, or entirely on a remote machine or server.
[0094] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.
[0095] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).
[0096] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), middleware components (e.g., application servers), or frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.
[0097] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.
[0098] In one embodiment, the present invention further includes a computer program product comprising a computer program that, when executed by a processor, implements the thread pool management method of any embodiment of the present invention.
[0099] In implementing the computer program product, computer program code for performing the operations of this invention can be written in one or more programming languages or a combination thereof. Programming languages include object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as C or similar languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network—including a local area network (LAN) or a wide area network (WAN)—or can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0100] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.
[0101] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.
Claims
1. A method of managing a thread pool, characterized by, The method comprises the following steps: determining initial thread pool information of a voice recipe transmission system, wherein the initial thread pool information comprises at least one initial thread pool set and at least one initial service type, the initial thread pool set and the initial service type are in one-to-one correspondence, and the initial thread pool set comprises at least one initial thread pool; determining a thread pool adjustment scheme based on instruction parameters of voice control instructions in each initial thread pool; adjusting the initial thread pool information by using the thread pool adjustment scheme to obtain target thread pool information of the voice recipe transmission system, wherein the target thread pool information comprises at least one target thread pool set and at least one target service type, the target thread pool set and the target service type are in one-to-one correspondence, the target thread pool set comprises at least one target thread pool, and the initial service type and the target service type are in one-to-one correspondence.
2. The method of claim 1, wherein, The method of determining the initial thread pool information of the voice recipe transmission system comprises: determining the at least one initial service type based on a service type identifier of the voice recipe transmission system, wherein the service type identifier and the initial service type are in one-to-one correspondence; determining the at least one initial thread pool set based on a service type quantity of the voice recipe transmission system, the at least one initial service type, and service demands of the at least one initial service type.
3. The method of claim 1, wherein, For any one voice control instruction, the delivery process of the voice control instruction comprises: determining a first transmission interface of the voice control instruction based on an instruction type of the voice control instruction; finding a first thread pool of the voice control instruction in a first correspondence relationship by using the first transmission interface, wherein the first correspondence relationship is a correspondence relationship between transmission interfaces and thread pools, and the first thread pool is connected with one high-level transmission interface and at least one low-level transmission interface; transmitting the voice control instruction to the first thread pool based on the first transmission interface, wherein the first thread pool is a thread pool in the at least one initial thread pool set.
4. The method of claim 1, wherein, The method of determining the thread pool adjustment scheme based on instruction parameters of voice control instructions in each initial thread pool comprises: determining instruction execution information of each initial thread pool based on instruction parameters of voice control instructions in each initial thread pool; determining adjustment requirements of each initial thread pool based on the instruction execution information of each initial thread pool, wherein the adjustment requirements are adjustment directions or adjustment directions and adjustment scales; determining the thread pool adjustment scheme based on the adjustment requirements of each initial thread pool.
5. The method of claim 4, wherein, For any one initial thread pool, the method of determining adjustment requirements of the initial thread pool based on instruction execution information of the initial thread pool comprises: when the instruction execution information of the initial thread pool indicates that there is a waiting voice control instruction in the initial thread pool, determining that the adjustment direction is to increase a thread pool, and determining the adjustment scale based on instruction information of the waiting voice control instruction; when the instruction execution information of the initial thread pool indicates that there is no voice control instruction in the initial thread pool, determining that the adjustment direction is to delete a thread pool.
6. The method of claim 1, wherein, The method further comprises: determine whether a preset thread pool adjustment time condition is met by a current time; if the preset thread pool adjustment time condition is met by the current time, adjust current thread pool information based on the current time and a preset thread pool adjustment scheme.
7. A thread pool management device, characterized in that, The thread pool management method and the thread pool management device of any one of claims 1 to 6 comprise: an obtaining module configured to determine initial thread pool information of a voice recipe transmission system, wherein the initial thread pool information comprises at least one initial thread pool set and at least one initial service type, the initial thread pool set and the initial service type correspond to each other, and the initial thread pool set comprises at least one initial thread pool; a determining module configured to determine a thread pool adjustment scheme based on instruction parameters of voice control instructions in each initial thread pool; an executing module configured to adjust the initial thread pool information by using the thread pool adjustment scheme to obtain target thread pool information of the voice recipe transmission system, wherein the target thread pool information comprises at least one target thread pool set and at least one target service type, the target thread pool set and the target service type correspond to each other, the target thread pool set comprises at least one target thread pool, and the initial service type and the target service type correspond to each other.
8. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected to the at least one processor in communication; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to execute the thread pool management method of any one of claims 1 to 6.
9. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for causing a processor to execute the thread pool management method of any one of claims 1 to 6 when executed by the processor.
10. A computer program product comprising a computer program, characterized in that, The computer program, when executed by a processor, implements the thread pool management method of any one of claims 1 to 6.