Thread Asynchronous Processing System with Adaptive Adjustment Based on Requirements
Through the deep learning model, the thread pool adjustment cycle and parameters are predicted, and the thread pool is adaptively adjusted, which solves the problem of not being able to adapt to dynamic task load in the existing technology, and improves the system's processing efficiency and resource utilization.
Patent Information
- Application Number
- CN202510354459.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-25
- Publication Date
- 2025-06-20
- Estimated Expiration
- 2045-03-25
AI Technical Summary
Existing thread pooling technologies cannot adapt to dynamic task loads, resulting in low resource utilization and the inability to achieve optimal management of thread pools.
By obtaining the task type, thread pool operation parameters and system resource parameters in the sequence of tasks to be executed, input these data into the pre-trained deep learning model, predicting the thread pool adjustment period and parameters, thereby adaptively adjusting the thread pool.
It improves the system's processing efficiency and resource utilization under different task loads and resource conditions, and solves the problem of resource waste caused by the inability to meet the adaptive needs and frequent dynamic adjustments in traditional thread pools.
Smart Images

Figure CN119862020B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of thread asynchronous processing, and more specifically, to a thread asynchronous processing system based on demand adaptive adjustment. Background Art
[0002] Thread asynchronous processing means that during the task execution process, the main thread can be not blocked and directly return to continue processing other tasks, thereby improving the overall processing ability of the system. When the system processes multiple requests simultaneously, if a certain request takes a long time, subsequent requests can only wait for this request to complete before they can be processed, which will seriously affect the user experience. Thread asynchronous processing can hand these time-consuming requests to the background worker threads for processing, and the main thread continues to process other requests, so that users can get faster responses.
[0003] Existing thread asynchronous processing usually uses a thread pool for management. A thread pool is a tool for managing threads based on the pooling idea. Its basic idea is to establish an object pool and allocate a memory space where multiple threads are stored. However, in actual applications, the performance and resource utilization rate of the thread pool may be affected by various factors, such as the arrival rate of tasks, execution time, system load, etc.
[0004] Most current thread pool technologies manage in a preset rule or static configuration manner, and this way cannot adapt to dynamic task loads. In addition, there is also a way to dynamically adjust the thread pool capacity according to the working parameters of the thread pool. This way requires real-time updating of the thread pool capacity and does not consider the characteristics of one or consecutive multiple tasks in the task queue in actual requirements, which not only causes unnecessary excessive overhead of resources but also cannot achieve the optimal management of the thread pool. Therefore, how to achieve thread asynchronous processing based on demand adaptive adjustment is an urgent problem to be solved. Summary of the Invention
[0005] In view of the above technical problems, the present invention provides a thread asynchronous processing system, method, electronic device and computer storage medium based on demand adaptive adjustment to at least partially solve the above technical problems.
[0006] The present invention discloses a thread asynchronous processing system based on demand adaptive adjustment. The system includes a thread asynchronous processing device, characterized in that the asynchronous processing device includes: an acquisition unit for acquiring demand index data, where the index data at least includes the types of tasks to be executed in the task sequence to be executed, the operating parameters of the thread pool at the current moment, and the system working resource parameters at the current moment; a prediction unit for inputting the demand index data into a pre-trained first model to obtain a thread pool adjustment period and thread pool adjustment parameters, including obtaining a first thread pool adjustment period and a first thread pool adjustment parameter based on the proportion of the first task type in the task sequence to be executed, and obtaining a second thread pool adjustment period and a second thread pool adjustment parameter based on the proportion of the second task type in the task sequence to be executed; an adjustment unit for adaptively adjusting the thread pool based on the thread pool adjustment period and the thread pool adjustment parameters.
[0007] The present invention also discloses a thread asynchronous processing method based on demand adaptive adjustment. The method includes the following steps: acquiring demand index data, where the index data at least includes the types of tasks to be executed in the task sequence to be executed, the operating parameters of the thread pool at the current moment, and the system working resource parameters at the current moment; inputting the demand index data into a pre-trained first model to obtain a thread pool adjustment period and thread pool adjustment parameters, including obtaining a first thread pool adjustment period and a first thread pool adjustment parameter based on the proportion of the first task type in the task sequence to be executed, and obtaining a second thread pool adjustment period and a second thread pool adjustment parameter based on the proportion of the second task type in the task sequence to be executed; adaptively adjusting the thread pool based on the thread pool adjustment period and the thread pool adjustment parameters.
[0008] Optionally, the thread pool adjustment period is dynamically adjusted based on the type of task to be executed and the sorting of the task type in the task sequence.
[0009] Optionally, the thread pool adjustment period and the thread pool adjustment parameters are optimized based on the second thread pool adjustment period and the second thread pool adjustment parameters corresponding to the second execution task similar to the type of task to be executed.
[0010] Optionally, the first task type is a compute-intensive task, and the second task type is an I / O-intensive task.
[0011] The present invention also discloses an electronic device, including: at least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, where the processor executes the computer program to implement the method as described in any of the foregoing.
[0012] The present invention also discloses a computer storage medium. The computer-readable storage medium stores a computer program, and the computer program is executed by a processor to implement the method as described in any of the preceding items.
[0013] The present invention discloses a method for thread asynchronous processing based on demand adaptive adjustment. The method first obtains demand index data including the type of task to be executed, thread pool operation parameters, system working resource parameters, etc., and then inputs it into a pre-trained deep learning model. The model predicts the thread pool adjustment period and adjustment parameters, such as the adjustment amounts of the number of threads, priority, etc., based on index data such as the proportion of the type of task to be executed. The thread pool is adaptively adjusted according to the prediction results. This method uses a deep learning model to intelligently perceive the task and resource status, and periodically optimizes the thread pool configuration, effectively improving the processing efficiency and resource utilization rate of the system under different task loads and resource conditions, solving the problem that the static adjustment of the traditional thread pool cannot meet the adaptive requirements and the dynamic frequent adjustment causes waste of system resources, and is applicable to thread asynchronous processing scenarios in multiple fields. Brief Description of the Drawings
[0014] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the following will briefly introduce the drawings required to be used in the embodiments. It should be understood that the following drawings only show some embodiments of the present invention, and therefore should not be regarded as limiting the scope. For those of ordinary skill in the art, other related drawings can be obtained based on these drawings without creative efforts.
[0015] Figure 1 It is a schematic flowchart of a method for thread asynchronous processing based on demand adaptive adjustment disclosed in an embodiment of the present invention.
[0016] Figure 2 It is a schematic diagram of a thread asynchronous processing device disclosed in an embodiment of the present invention.
[0017] Figure 3 It is a schematic diagram of an electronic device for thread asynchronous processing based on demand adaptive adjustment disclosed in an embodiment of the present invention. Detailed Embodiments
[0018] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the following will clearly and completely describe the technical solutions in the embodiments of the present invention with reference to the drawings in the embodiments of the present invention. Obviously, the described embodiments are some, but not all, of the embodiments of the present invention. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts fall within the protection scope of the present invention.
[0019] In addition, the technical features involved in different embodiments of the present application described below can be combined with each other as long as they do not conflict with each other.
[0020] Figure 1 A thread asynchronous processing method based on demand adaptive adjustment provided for an embodiment of the present invention. This method can be executed by a thread asynchronous processing system based on demand adaptive adjustment. The system can be implemented in the form of hardware and / or software and can be configured in an electronic device, which can be a server. As Figure 1 shown, the method includes: S101, obtaining demand index data, where the index data at least includes the types of tasks to be executed in the task sequence to be executed, the running parameters of the thread pool at the current moment, and the working parameters of the system resources at the current moment.
[0021] Among them, specific demands can be determined according to the actual application scenario. The tasks to be executed correspond to the actual application scenario. For example, the application scenario can be a web crawler, and the tasks to be executed can include web page scraping, data parsing and storage. The application scenario can be file processing, and the tasks to be executed can include file uploading and downloading, file format conversion. The application scenario can be distributed computing, and the tasks to be executed can include big data analysis, machine learning model training. The application scenario can be graphic image processing, and the tasks to be executed can include image rendering, image filter processing. The application scenario can be a server application, and the tasks to be executed can include Web service request processing, message queue processing, etc.
[0022] Optionally, the tasks to be executed can be classified according to the resource consumption method and the task completion purpose. For example, they can be divided into compute-intensive tasks or I / O-intensive tasks. Compute-intensive tasks mainly rely on the CPU for a large number of computing operations. Therefore, the CPU priority of the thread needs to be set relatively high. Such tasks are usually suitable for using threads dedicated to computing, and these threads should be designed and configured to minimize other non-computing-related operations. For example, avoid frequent I / O operations in these threads to avoid interfering with the continuity of the computing tasks. I / O-intensive tasks will be in a blocked state while waiting for I / O operations to complete, such as waiting for network responses, disk read and write operations, etc. To reduce the impact of frequent I / O operations on system performance, the thread can have a certain I / O buffering function. For example, in a file reading task, the thread can temporarily store the read file data in a buffer and process a certain amount of data at one time, instead of processing only a small amount of bytes of data each time, thereby improving I / O efficiency.
[0023] Among them, the running parameters of the thread pool at the current moment may include the number of threads, the types of threads (such as compute-intensive threads, I / O-intensive threads), the core thread count, which is the number of threads that always remain alive in the thread pool, even when they are idle. These threads are the basic working force of the thread pool and are used to process tasks in the task queue. The maximum thread count is the maximum number of threads that the thread pool allows to be created. The thread survival time means that when the number of threads in the thread pool exceeds the core thread count, if the waiting time of the idle threads for tasks exceeds the survival time, they will be automatically destroyed to release system resources. The task queue is a queue for storing tasks waiting to be processed by threads. Common types of task queues include blocking queues (Blocking Queue), such as ArrayBlockingQueue (bounded blocking queue), LinkedBlockingQueue (unbounded blocking queue), etc. The thread factory is a factory class for creating new threads. Through the thread factory, the creation process of threads can be customized, such as setting the name, priority, daemon thread property, etc. of the threads. The rejection policy is the processing policy for newly submitted tasks when the task queue is full and the number of threads in the thread pool has reached the maximum thread count.
[0024] Among them, the system working resource parameters at the current moment may include key metrics such as the current CPU utilization rate (expressed as a percentage), the current memory utilization rate (percentage), the disk I / O bandwidth occupancy rate (percentage), the network bandwidth occupancy rate (percentage), etc.
[0025] S102: Input the demand metric data into a pre-trained first model to obtain the thread pool adjustment period and thread pool adjustment parameters, including obtaining the first thread pool adjustment period and the first thread pool adjustment parameters based on the proportion of the first task type in the to-be-executed task sequence, and obtaining the second thread pool adjustment period and the second thread pool adjustment parameters based on the proportion of the second task type in the to-be-executed task sequence.
[0026] Among them, the pre-trained first model is an artificial neural network model (multi-layer perceptron (MLP) model) based on deep learning. The model architecture includes an input layer, several hidden layers, and an output layer. The number of neurons in the input layer corresponds to the dimension of the demand metric data. The hidden layer can be set to multiple layers, and the number of neurons in each layer is determined according to the actual situation. The output layer has two outputs, corresponding to the thread pool adjustment period and the thread pool adjustment parameters respectively. The dimension of the thread pool adjustment parameters can be set according to actual needs, such as including the thread number adjustment amount, the thread priority adjustment amount, etc. It can be understood that the neural network model is not limited to the MLP model.
[0027] Specifically, after the information processing by the hidden layer, the data finally reaches the output layer. For the prediction of the thread pool adjustment period, a single neuron in the output layer will perform weighted summation and bias addition operations again based on the information received from the hidden layer. Let the input of the neuron in the output layer be (the output from the hidden layer after weighted summation and bias addition), and its output (the predicted thread pool adjustment period) can be mapped through a suitable activation function. For example, if the desired adjustment period is within a positive real number range, the Sigmoid function may be used, or directly use a linear function (i.e., ) to obtain the final predicted value .
[0028] Assume that the input layer has neurons, the input vector is , the weight matrix from the input layer to the first hidden layer is , the bias vector is , then the output of the -th neuron in the first hidden layer is: ; where is the activation function.
[0029] For subsequent hidden layers, assume that the -th hidden layer has neurons, the weight matrix from it to the -th hidden layer is , the bias vector is , then the output of the -th neuron in the -th hidden layer is: , finally, for the neuron in the output layer that predicts the thread pool adjustment period, let the input it receives from the last hidden layer be , the weight vector is , the bias is , if a linear activation function is used, the predicted thread pool adjustment period is: ; where represents the -th neuron, is the output of the -th neuron in the last hidden layer.
[0030] Preferably, based on the proportion of the first task type in the to-be-executed task sequence, the first thread pool adjustment period and the first thread pool adjustment parameter are obtained, and based on the proportion of the second task type in the to-be-executed task sequence, the second thread pool adjustment period and the second thread pool adjustment parameter are obtained.
[0031] Preferably, different models can be used to predict the thread pool adjustment period and the thread pool adjustment parameter respectively. For example, considering the sequence correlation of tasks or resources changing over time, for the thread pool adjustment period, a long short-term memory network (LSTM) can be used, and for the thread pool parameter adjustment, a general deep neural network (DNN) can be used for prediction. This embodiment does not make any limitations.
[0032] Specifically, the first task type is a compute-intensive task, and the second task type is an I / O-intensive task. The to-be-executed tasks in the to-be-executed task sequence are usually sorted in the execution order. The adjustment period of the thread pool can be dynamically adjusted based on the proportion of task types and / or the order of different task types in the to-be-executed task sequence. For example, if the proportion of compute-intensive tasks in the sequence is relatively high and / or the compute-intensive tasks are ranked at the front, then based on the fact that compute-intensive tasks have a higher CPU priority requirement, the thread pool adjustment period is correspondingly shortened to minimize the interruption of compute tasks by other tasks. Correspondingly, for the adjustment of the thread pool parameters, it can be to increase the proportion of the number of compute-intensive threads. As another example, for instance, if the proportion of I / O-intensive tasks in the sequence is relatively high and / or the I / O-intensive tasks are ranked at the front, then based on the fact that I / O-intensive tasks have a lower CPU priority requirement, the thread pool adjustment period is correspondingly lengthened to reduce the unnecessary consumption and waste of resources caused by frequent adjustment of the thread pool. Correspondingly, for the adjustment of the thread pool parameters, it can be to increase the proportion of the number of threads for I / O-intensive tasks. It can be understood that in addition to adjusting the thread types for different situations, other parameters of the thread pool can also be adjusted collaboratively according to the task type proportion and sorting, which will not be elaborated here.
[0033] Preferably, in order to more accurately predict the thread pool adjustment period and the thread pool adjustment parameter, the thread pool adjustment period and the thread pool adjustment parameter corresponding to other execution tasks similar to the to-be-executed task type in the system can also be combined. On the one hand, the adjustment period and adjustment parameter of this task can be optimized by referring to the adjustment period and adjustment parameter of other tasks. On the other hand, the consumption or to-be-consumed situation of the overall system resources can be considered to ensure the load balance of different thread pools in the system.
[0034] S103, adaptively adjust the thread pool based on the thread pool adjustment period and the thread pool adjustment parameter.
[0035] Through the embodiments of the present disclosure, based on index data such as the proportion of task types to be executed and the sorting of task types, etc., a deep learning model can be used to predict the thread pool adjustment period and adjustment parameters, such as the adjustment amounts of the number of threads, priorities, etc. The thread pool is adaptively adjusted according to the prediction results. This method uses a deep learning model to intelligently perceive the task and resource status, and periodically optimizes the thread pool configuration, effectively improving the processing efficiency and resource utilization rate of the system under different task loads and resource conditions, solving the problem that the static adjustment of the traditional thread pool cannot meet the adaptive requirements, and the dynamic and frequent adjustment causes waste of system resources, and is applicable to the thread asynchronous processing scenarios in multiple fields.
[0036] Another exemplary embodiment of the present disclosure provides a thread asynchronous processing system based on demand adaptive adjustment. The system at least includes a thread asynchronous processing device based on demand adaptive adjustment (or referred to as a thread asynchronous processing device), such as Figure 2 As shown, the device includes: an acquisition unit 201, configured to acquire demand index data, where the index data at least includes the types of tasks to be executed in the task sequence to be executed, the running parameters of the thread pool at the current moment, and the system working resource parameters at the current moment.
[0037] A prediction unit 202, configured to input the demand index data into a pre-trained first model to obtain a thread pool adjustment period and thread pool adjustment parameters, including obtaining a first thread pool adjustment period and a first thread pool adjustment parameter based on the proportion of the first task type in the task sequence to be executed, and obtaining a second thread pool adjustment period and a second thread pool adjustment parameter based on the proportion of the second task type in the task sequence to be executed.
[0038] An adjustment unit 203, configured to perform adaptive adjustment on the thread pool based on the thread pool adjustment period and the thread pool adjustment parameters.
[0039] Optionally, the acquisition unit 201 is configured to acquire demand index data, where the index data at least includes the types of tasks to be executed in the task sequence to be executed, the running parameters of the thread pool at the current moment, and the system working resource parameters at the current moment.
[0040] Optionally, the prediction unit 202 is configured to input the demand index data into a pre-trained first model to obtain a thread pool adjustment period and thread pool adjustment parameters, including obtaining a first thread pool adjustment period and a first thread pool adjustment parameter based on the proportion of the first task type in the task sequence to be executed, and obtaining a second thread pool adjustment period and a second thread pool adjustment parameter based on the proportion of the second task type in the task sequence to be executed.
[0041] Optionally, the adjustment unit 203 is configured to perform adaptive adjustment on the thread pool based on the thread pool adjustment period and the thread pool adjustment parameters.
[0042] Regarding the device in the above embodiments, the specific manners in which each module performs operations have been described in detail in the embodiments related to the method, and will not be elaborated herein.
[0043] Through the embodiments of the present disclosure, based on index data such as the proportion of task types to be executed and the sorting of task types, the thread pool adjustment period and adjustment parameters, such as the adjustment amounts of the number of threads, priorities, etc., can be predicted through a deep learning model. The thread pool is adaptively adjusted according to the prediction results. This method uses a deep learning model to intelligently perceive the task and resource status, and periodically optimizes the thread pool configuration, effectively improving the processing efficiency and resource utilization rate of the system under different task loads and resource conditions, solving the problems that the static adjustment of the traditional thread pool cannot meet the adaptive requirements and the dynamic and frequent adjustment causes system resource waste, and is applicable to the thread asynchronous processing scenarios in multiple fields.
[0044] It should be noted that: when adjusting the parameters of the thread asynchronous processing device provided in the above embodiments, only the division of the above functional units is used for illustration. In actual applications, the above functions can be allocated to different functional units according to needs. In addition, the thread asynchronous processing device provided in the above embodiments and the embodiments of the thread asynchronous processing method based on demand adaptive adjustment belong to the same concept, and the specific implementation process is detailed in the method embodiments and will not be elaborated here.
[0045] Figure 3 Schematic diagram of the electronic device 300 according to an embodiment of the present application. Optionally, as Figure 3 shown, the electronic device 300 further includes: a thread asynchronous processing module 303, a communication module 304, an input unit 305, and a power supply 306. Among them, the processor 301 is electrically connected to the thread asynchronous processing module 303, the communication module 304, the input unit 305, and the power supply 306 respectively. Those skilled in the art can understand that Figure 3 the structure of the electronic device shown in
[0046] does not constitute a limitation on the electronic device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0047] The thread asynchronous processing module 303 can be used for thread asynchronous processing based on demand adaptive adjustment.
[0048] The communication module 304 can be used for communicating with other devices.
[0049] The power supply 306 is used to supply power to various components of the electronic device 300. Optionally, the power supply 306 can be logically connected to the processor 301 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 306 can also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.
[0050] In the above embodiments, the descriptions of the various embodiments have their own emphases. For parts not detailed in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0051] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling relevant hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0052] For this reason, the embodiments of the present application provide a computer-readable storage medium, in which multiple computer programs are stored. The computer programs can be loaded by a processor to execute the steps of a method for thread asynchronous processing based on demand adaptive adjustment provided by the embodiments of the present application. For example, the computer program can execute the following steps: obtaining demand index data, where the index data at least includes the type of task to be executed in the task sequence to be executed, the running parameters of the thread pool at the current moment, and the system working resource parameters at the current moment; inputting the demand index data into a pre-trained first model to obtain a thread pool adjustment period and thread pool adjustment parameters, including obtaining a first thread pool adjustment period and a first thread pool adjustment parameter based on the proportion of the first task type in the task sequence to be executed, and obtaining a second thread pool adjustment period and a second thread pool adjustment parameter based on the proportion of the second task type in the task sequence to be executed, and adaptively adjusting the thread pool based on the thread pool adjustment period and thread pool adjustment parameters.
[0053] Among them, the computer-readable storage medium can include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc.
[0054] Since the computer programs stored in this storage medium can execute the steps in any method for thread asynchronous processing based on demand adaptive adjustment provided by the embodiments of the present application, the beneficial effects of any method for thread asynchronous processing based on demand adaptive adjustment provided by the embodiments of the present application can be achieved. For details, see the previous embodiments and will not be repeated here.
[0055] This application is described with reference to the flowcharts and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the present application. These computer program instructions can be provided to the processors of general-purpose computers, special-purpose computers, embedded processors, or other programmable data processing devices to generate a machine, such that the instructions executed by the processors of the computer or other programmable data processing devices produce means for implementing the functions specified in one process or multiple processes and / or one block or multiple blocks in the flow Figure 1 one process or multiple processes and / or Figure 1 one block or multiple blocks.
[0056] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing device to work in a specific manner, such that the instructions stored in the computer-readable memory produce a manufactured article including instruction means that implement the functions specified in one process or multiple processes and / or one block or multiple blocks in the flow Figure 1 one process or multiple processes and / or Figure 1 one block or multiple blocks.
[0057] These computer program instructions can also be loaded onto a computer or other programmable data processing device, such that a series of operational steps are executed on the computer or other programmable device to generate a computer-implemented process, and thus the instructions executed on the computer or other programmable device provide steps for implementing the functions specified in one process or multiple processes and / or one block or multiple blocks in the flow Figure 1 one process or multiple processes and / or Figure 1 one block or multiple blocks.
[0058] The embodiments of the present invention have been described in detail above in conjunction with the accompanying drawings, but the present invention is not limited to the described embodiments. For those skilled in the art, without departing from the principles and spirit of the present invention, various changes, modifications, substitutions, and variations to these embodiments still fall within the protection scope of the present invention.
Claims
1. A thread asynchronous processing system based on demand adaptive adjustment, the system comprising a thread asynchronous processing device, characterized in that: The asynchronous processing device includes: an acquisition unit, which is used to acquire demand indicator data, wherein the indicator data at least includes the type of task to be executed in the task sequence to be executed, the operating parameters of the thread pool at the current moment, and the system working resource parameters at the current moment; a prediction unit, which is used to input the demand indicator data into a pre-trained first model to obtain a thread pool adjustment period and a thread pool adjustment parameter, including obtaining a first thread pool adjustment period and a first thread pool adjustment parameter based on the proportion of the first task type in the task sequence to be executed, and obtaining a second thread pool adjustment period and a second thread pool adjustment parameter based on the proportion of the second task type in the task sequence to be executed; an adjustment unit , used to adaptively adjust the thread pool based on the thread pool adjustment period and the thread pool adjustment parameters; the prediction unit is also used to dynamically adjust the thread pool adjustment period based on the proportion of the task types to be executed and the order of the task types in the task sequence, specifically, if the proportion of tasks of the first task type is higher than the proportion of tasks of the second task type and the tasks of the first task type are ranked in the front, then the first period is shortened; if the proportion of tasks of the second task type is higher than the proportion of tasks of the first task type and the tasks of the second task type are ranked in the front, then the second period is lengthened, the first task type is a computationally intensive task, and the second task type is an I / O intensive task.
2. The thread asynchronous processing system based on demand adaptive adjustment according to claim 1, characterized in that: The prediction unit is also used to optimize the thread pool adjustment period and the thread pool adjustment parameters based on the second thread pool adjustment period and the second thread pool adjustment parameters corresponding to the second execution task that is similar to the type of the task to be executed.
3. A thread asynchronous processing method based on demand adaptive adjustment, characterized in that: The method comprises the following steps: obtaining demand index data, wherein the demand index data at least comprises the type of tasks to be executed in the sequence of tasks to be executed, the operating parameters of the thread pool at the current moment, and the working resource parameters of the system at the current moment; The demand indicator data is input into a pre-trained first model to obtain a thread pool adjustment period and a thread pool adjustment parameter, including: obtaining a first thread pool adjustment period and a first thread pool adjustment parameter based on the proportion of the first task type in the task sequence to be executed, and obtaining a second thread pool adjustment period and a second thread pool adjustment parameter based on the proportion of the second task type in the task sequence to be executed; adaptively adjusting the thread pool based on the thread pool adjustment period and the thread pool adjustment parameter, and also including dynamically adjusting the thread pool adjustment period based on the proportion of the task types to be executed and the order of the task types in the task sequence, specifically, if the proportion of tasks of the first task type is higher than the proportion of tasks of the second task type and the tasks of the first task type are ranked in the front, then shortening the first period, and if the proportion of tasks of the second task type is higher than the proportion of tasks of the first task type and the tasks of the second task type are ranked in the front, then lengthening the second period, the first task type is a computationally intensive task, and the second task type is an I / O intensive task.
4. The thread asynchronous processing method based on demand adaptive adjustment according to claim 3, characterized in that: Based on a second thread pool adjustment period and a second thread pool adjustment parameter corresponding to a second execution task similar to the type of the task to be executed, the thread pool adjustment period and the thread pool adjustment parameter are optimized.
5. An electronic device comprising: At least one processor, a memory, and a computer program stored in the memory and executable on the at least one processor, wherein the processor executes the computer program to implement the method according to any one of claims 3 to 4.
6. A computer storage medium storing a computer program, characterized in that: The computer program is executed by a processor to implement the method according to any one of claims 3-4.
Citation Information
Patent Citations
Control method and device for adaptive thread pool
CN116820703A
Task scheduling method, system and device and computer readable storage medium
CN118838698A