Calculation task dynamic adjustment method based on behavior prediction feedback loop
By introducing a lock management system into the operating system and dynamically adjusting the lock lease time, the deadlock and resource utilization reduction caused by the fixed lock lease time in the prior art are solved, and more efficient resource management and system stability are achieved.
Patent Information
- Application Number
- CN202510052889.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-14
- Publication Date
- 2025-05-06
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The prior art has the problem of fixation when setting the lock lease time, which leads to problems such as deadlock and reduced resource utilization in high concurrency environments.
The dynamic adjustment method of computing tasks based on behavior prediction feedback loop is adopted. By creating a lock management system when the operating system is initialized, the execution strategy of the computing task is dynamically adjusted, and the priority and historical behavior score of the target process are based on the evaluation value of the system load and lock competition degree, the lock lease time is dynamically set, and the effective utilization of resources is ensured through the lease monitor and the violation processing module.
It effectively prevents deadlocks and resource hunger, improves the utilization rate of system resources and the overall system throughput, and enhances the stability and reliability of the system.
Smart Images

Figure CN119938348A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer systems, and in particular to a method for dynamically adjusting computing tasks based on a behavior prediction feedback loop. Background Art
[0002] In modern computing environments, resource competition and concurrent execution are one of the main challenges facing operating systems. With the increasing complexity of systems and task concurrency, how to effectively manage resources and prevent deadlock problems has become the key. Although traditional lock mechanisms can coordinate resource access to a certain extent, they often seem to be unable to cope with complex multi-tasking environments. For this reason, it is particularly important to introduce a more flexible and intelligent mechanism, which is to introduce the concept of "lease" in the lock management system. By dynamically adjusting the execution strategy of computing tasks, the lease mechanism can not only effectively prevent deadlocks, but also provide guarantees for the efficient use of system resources.
[0003] The setting of the lease time needs to be very accurate, otherwise the lease time may be too short, causing frequent lock release and re-acquisition, increasing system overhead; or too long, resulting in reduced resource utilization. The current technology has the problem of fixed setting of lease time. The time set for any process is consistent, which affects performance and may cause system bottlenecks, especially in a high-concurrency environment, which may affect the overall system response time, thereby affecting the overall system response time. Summary of the invention
[0004] In view of the deficiencies of the prior art, the present invention provides a method for dynamically adjusting computing tasks based on a behavior prediction feedback loop, aiming to dynamically adjust the execution of computing tasks and prevent and solve deadlock problems by introducing the concept of "lease" in the lock management system.
[0005] The present invention solves the above technical problems through the following technical means: a method for dynamically adjusting computing tasks based on a behavior prediction feedback loop, comprising: Step 1: When the computer operating system is initialized, a lock management system is created, wherein the lock management system is used to allocate locks to each process in the computer operating system; Step 2: When a process in the computer operating system requests a lock from the lock management system, the process is recorded as a target process, and at the same time, the lock lease management module in the lock management system determines the lock lease time allocated to the target process; Step 3: According to the lock lease time of the target process calculated in step 2, the lock management system allocates a lock to the target process and starts a lease monitor, which is responsible for tracking the usage status of the lock and ensuring that the lock is released before the lease time expires; Step 4: If the lock is not released after the lease time expires, the lease violation processing module is started, and the module executes the corresponding solution strategy for the target process according to the process information of the target process.
[0006] Based on the above embodiment, the lock lease time allocated to the target process is determined, and the specific determination process is as follows: Obtaining process information of the target process, thereby evaluating the priority and historical behavior score of the target process, and calculating the process information of the target process to obtain a priority nonlinear function and a historical behavior score nonlinear function of the target process; Synchronously acquiring system information of the computer operating system, wherein the system information includes a system load evaluation value and a lock contention degree evaluation value; Then comprehensively calculate the lock lease time of the target process , The basic lease time set for all processes in the computer operating system. are the priority nonlinear function and historical behavior scoring nonlinear function of the target process, FZ is the system load evaluation value of the computer operating system, and JZ is the competition degree evaluation value of the corresponding lock of the computer operating system. They are the weight coefficients of the predefined system load and lock contention degree respectively.
[0007] Based on the above embodiment, a priority nonlinear function of the target process is obtained, and the specific acquisition process is as follows: Obtaining the CPU time used, the waiting time in the ready queue, the I / O request frequency, and the process type of the target process; wherein the process type is divided into user process and system process; If the process type of the target process is identified as a user process, the initial weight setting value of the process type factor of the target process is On the contrary, if the process type of the target process is identified as a system process, the initial weight setting value of the process type factor of the target process is , and finally obtain the final weight setting value of the process type factor of the target process ,in The value is or ; Then we get the priority nonlinear function of the target process , is the I / O request frequency of the target process, t is the CPU time used by the target process, e is a natural constant, A is the maximum weight of the Sigmoid function related to the CPU usage time, B is the maximum weight of the Sigmoid function related to the process waiting time, DZ is the waiting time of the target process in the ready queue, k is the parameter for controlling the slope of the function, They are the center points of the Sigmoid function corresponding to the CPU usage time and process waiting time, respectively.
[0008] Based on the above embodiment, a nonlinear function of the historical behavior score of the target process is obtained. The specific acquisition process is as follows: Obtain the historical information corresponding to the target process, including the historical average CPU usage, the total number of historical memory leaks, the historical average I / O waiting time, the efficiency of using system resources, and the degree of cooperation in responding to system scheduling; The historical behavior score nonlinear function of the target process is calculated ,in, They are respectively represented as pre-set weight coefficients, which are used to adjust the contribution of different historical information to the nonlinear function of historical behavior scoring; is the nonlinear scoring function of the CPU usage of the target process. , The historical average CPU usage of the target process. is the set decay rate; is the nonlinear scoring function of the number of memory leaks corresponding to the target process, , XL is the total number of historical memory leaks corresponding to the target process, is a tuning parameter used to emphasize the negative impact of memory leaks on the score; is the nonlinear scoring function of the target process corresponding to the I / O waiting time, , is the historical average I / O waiting time corresponding to the target process, It is a tuning parameter, which means that the longer the historical average I / O waiting time is, the lower the score is; is a nonlinear scoring function for the resource utilization efficiency of the target process. , Re is the efficiency of the target process in using system resources in history, is the expected value of resource efficiency, is the set gain function; is a nonlinear scoring function of the target process’s corresponding system scheduling cooperation degree, , HZ represents the degree of cooperation of the target process with respect to the historical response system scheduling, It is a frequency parameter, which is used to indicate the degree of cooperation between the target process and the system scheduling.
[0009] On the basis of the above embodiment, the evaluation value of the contention degree of the lock corresponding to the computer operating system is obtained, and the specific acquisition process is as follows: Capturing all lock-related events from the computer operating system, including lock requests, attempted acquisitions, successful possession, and releases, and recording the time at which each lock-related event occurred, the process or process identifier in which it occurred, and the associated lock identifier; Each process is considered as a node in the lock contention graph, and the lock request and release operations are represented as directed edges between nodes. If a process tries to obtain a lock that is already occupied by another process, a directed edge is added to the lock contention graph from the process node requesting the lock to the process node holding the lock. In this way, a complete lock contention graph is constructed. Collect the timestamps of each process waiting for a specific lock and the timestamp of each process finally obtaining the lock from the lock contention graph. For each directed edge in the graph, calculate the waiting time of the source node of the edge (the process waiting for the lock), that is, the time difference from requesting the lock to obtaining the lock. Then, sum up all these waiting times and divide them by the total number of lock requests to get the average waiting time of all processes waiting for the lock. Get the number of lock requests for each lock in a specific time window, divide it by the length of the specific time window, sum it up and divide it by the total number of lock requests, and then get the average frequency of lock requests per unit time; Then calculate the lock contention intensity in the computer operating system , v is the number of each lock in the lock contention graph, v=1,2,...W, are the request frequency, average waiting time, and holding time of the v-th lock in the lock contention graph, TC is the number of processes participating in the contention in the lock contention graph, and W is the total number of all locks in the lock contention graph; The evaluation value of the competition degree of the corresponding lock of the computer operating system is calculated from this , is the average waiting time for all processes waiting for locks, is the lock request frequency per unit time, The calculation coefficient equalization factor is set.
[0010] On the basis of the above embodiment, a corresponding solution strategy is executed on the target process, wherein the solution strategy is specifically divided into a transaction rollback strategy, a process scheduling strategy and a forced release strategy.
[0011] On the basis of the above embodiment, the module executes the corresponding solution strategy for the target process according to the process information of the target process. The specific execution process is as follows: Get the CPU usage of the target process , Memory usage and I / O operating frequency ; Using analytical formula , calculate the priority value of the target process , are the predefined weights of CPU usage, memory usage, and I / O operation frequency, respectively, and ; Compare the priority value of the target process with the set priority interval value Compare, if the priority value of the target process is less than , then execute the transaction rollback strategy for the target process; if Less than or equal to the priority value of the target process and the priority value of the target process is less than or equal to , the process scheduling policy is executed on the target process; if the priority value of the target process is greater than , then the forced release policy is executed on the target process.
[0012] A device for dynamically adjusting computing tasks based on a behavior prediction feedback loop, comprising a processor, a memory and a communication bus; The memory stores a computer-readable program that can be executed by the processor; The communication bus realizes the connection and communication between the processor and the memory; When the processor executes the computer-readable program, it is executed to implement a method for dynamically adjusting computing tasks based on a behavior prediction feedback loop as described in the present invention.
[0013] Beneficial effects of the present invention: The present invention provides a method for dynamically adjusting computing tasks based on a behavior prediction feedback loop. By creating a lock management system when the operating system is initialized, it can ensure that all processes have orderly and controlled access to resources. The lock management system allocates a lock to each process that requests a lock, and limits the holding time of the lock by the lease time. This mechanism effectively prevents the process from occupying resources for a long time, thereby reducing the risk of deadlock and resource starvation. In a multi-tasking operating system, efficient management of resources is crucial to maintaining the stability of the system. By limiting the holding time of the lock, the system can better ensure the fair allocation of resources and improve the throughput of the overall system.
[0014] The introduction of the lease monitor ensures that the lock usage status is tracked in real time. The monitor can not only remind the process to release the lock before the lease time expires, but also start the lease violation handling module when necessary. This design enhances the system's automated management capabilities and reduces the need for manual intervention. When the lock is not released within the lease time, the lease violation handling module can automatically handle the exception according to preset strategies (such as transaction rollback, process scheduling, and forced release). This automated exception handling mechanism improves the system's response speed and reliability.
[0015] In addition, the necessity of this lock management mechanism is also reflected in the optimized use of system resources. In a high-concurrency environment, the effective use of resources directly affects the performance of the system. Through the lock lease management module, the system can dynamically adjust the lock allocation strategy to ensure that resources are used reasonably. The accumulation of log records and monitoring data also provides valuable references for subsequent performance optimization and troubleshooting.
[0016] In summary, the introduction of the lock management system and its related modules provides an efficient resource management solution for the operating system. This not only optimizes system performance, but also enhances system stability and reliability. Through automated monitoring and processing mechanisms, the system can maintain efficient operation in a complex multi-tasking environment, ensuring business continuity and data consistency. This design has important practical significance in the modern computing environment and can effectively cope with the growing computing needs and complex resource management challenges. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 It is a schematic diagram of the connection structure of the method steps of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention. Example
[0019] See also Figure 1 As shown, a method for dynamically adjusting computing tasks based on a behavior prediction feedback loop comprises the following steps: Step 1: When the computer operating system is initialized, a lock management system is created, wherein the lock management system is used to allocate locks to each process in the computer operating system; Step 2: When a process in the computer operating system requests a lock from the lock management system, the process is recorded as a target process, and at the same time, the lock lease management module in the lock management system determines the lock lease time allocated to the target process; According to a preferred embodiment, the lock lease time allocated to the target process is determined, and the specific determination process is as follows: Obtaining process information of the target process, thereby evaluating the priority and historical behavior score of the target process, and calculating the process information of the target process to obtain a priority nonlinear function and a historical behavior score nonlinear function of the target process; Synchronously acquiring system information of the computer operating system, wherein the system information includes a system load evaluation value and a lock contention degree evaluation value; Get the system load evaluation value of the computer operating system. The specific acquisition methods are as follows: In Python, you can use the built-in `os` module to get the system load average; If in a Bash script, you can directly read the ` / proc / loadavg` file to get the system load; In C language, you can use the `getloadavg` function to get the system load.
[0020] Then comprehensively calculate the lock lease time of the target process , The basic lease time set for all processes in the computer operating system. are the priority nonlinear function and historical behavior scoring nonlinear function of the target process, FZ is the system load evaluation value of the computer operating system, and JZ is the competition degree evaluation value of the corresponding lock of the computer operating system. They are the weight coefficients of the predefined system load and lock contention degree respectively.
[0021] According to a preferred embodiment, a priority nonlinear function of the target process is obtained, and the specific acquisition process is as follows: Obtaining the CPU time used by the target process, the waiting time in the ready queue, the I / O request frequency, and the process type; wherein the process type is divided into user process and system process; If the process type of the target process is identified as a user process, the initial weight setting value of the process type factor of the target process is On the contrary, if the process type of the target process is identified as a system process, the initial weight setting value of the process type factor of the target process is , and finally obtain the final weight setting value of the process type factor of the target process ,in The value is or ; Then we get the priority nonlinear function of the target process , is the I / O request frequency of the target process, t is the CPU time used by the target process, e is a natural constant, A is the maximum weight of the Sigmoid function related to the CPU usage time, B is the maximum weight of the Sigmoid function related to the process waiting time, DZ is the waiting time of the target process in the ready queue, k is the parameter for controlling the slope of the function, They are the center points of the Sigmoid function corresponding to the CPU usage time and process waiting time, respectively.
[0022] In the above priority nonlinear function calculation formula, the first term is a Siqmoid function about CPU usage time, where is the median, the center point of the control function. The second term is also a Sigmoid function, which is used for process waiting time, where B is the maximum weight, is the median waiting time; the third term is a logarithmic function of process type and I / 0 frequency, where is the weight determined by the process type. is the I / O request frequency. A logarithmic function is used to reduce the impact of high values of the I / O frequency, while ensuring that this item does not disappear even if the I / O frequency is 0.
[0023] is the center point of the sigmoid function corresponding to the CPU usage time. When , the Siqmoid function output is 0.5. This means that if the CPU usage time t of the process is equal to , its contribution to the priority is moderate. If t is greater than , the contribution will be higher, otherwise it will be lower. is the center point of the Siqmoid function corresponding to the process waiting time. Similarly, when DZ= , the contribution of this item to the priority is medium. If the waiting time DZ of a process exceeds , then the contribution of this factor to its priority will increase, encouraging the system to schedule processes with longer waiting times.
[0024] In the nonlinear function f(YX) of the priority of the target process above, A and B are two weight factors, which are multiplied by the sigmoid function of the CPU usage time and the sigmoid function of the process waiting time respectively to determine the relative importance of these two factors in calculating the process priority: A is the maximum weight of the sigmoid function related to CPU usage time. It determines the maximum possible impact of CPU usage time t on the process priority. For example, if the value of A is large, then the role of CPU usage time t in the process priority calculation will be more significant. If the CPU usage time t of a process is much greater than , the value of its sigmoid function will be close to 1, so A will be approximately equal to the priority score obtained by this process due to CPU usage time. On the contrary, if the CPU usage time t of a process is much less than , the value of its siqmoid function will be close to 0, so the contribution of this part to the priority is also close to 0; B is the maximum weight of the sigmoid function related to the process waiting time. It determines the maximum possible impact of the process waiting time on the process priority. If the value of B is large, the waiting time has a greater impact on the priority calculation. If a process's waiting time is much longer than , the value of its siqmoid function will be close to 1, so B will be approximately equal to the priority score obtained by this process due to its waiting time. , the value of its Sigmoid function will be close to 0, and the contribution of this part to the priority will also be close to 0; By adjusting the values of Á and B, the operating system's scheduler can control the influence of CPU usage time and waiting time in the process priority calculation. For example, for a system that needs to respond quickly to user interactions, it may give more weight to waiting time (B) so that processes with longer waiting times are scheduled first. For a system whose goal is to ensure high CPU utilization, it may give more weight to CPU usage time (A).
[0025] According to a preferred embodiment, a nonlinear function of the historical behavior score of the target process is obtained, and the specific acquisition process is as follows: Obtain the historical information corresponding to the target process, including the historical average CPU usage, the total number of historical memory leaks, the historical average I / O waiting time, the efficiency of using system resources, and the degree of cooperation in responding to system scheduling; The efficiency of a process's use of system resources generally refers to how effectively a process uses computer resources such as CPU, memory, and disk I / O to complete its tasks. An efficient process can maximize the use of system resources and complete more work with minimal overhead. For example, a CPU-intensive process can be considered efficient if it can complete computing tasks using less CPU time. Efficiency can be measured through monitoring tools, such as the `top` or `htop` commands in Unix / Linux systems, Task Manager in Windows, or more advanced performance monitoring tools such as Prometheus or New Relic. These tools can provide information such as the process's CPU usage, memory usage, I / O read and write speeds, etc., through which the resource utilization efficiency of the process can be calculated; The degree of cooperation of a process in response to system scheduling describes the response of the process to the instructions issued by the operating system scheduler. A process with a high degree of cooperation will start or pause in a timely manner according to the scheduling policy of the operating system to cooperate with the system's multi-tasking. For example, when the operating system needs to pause a process to give up the CPU to a higher priority process, the process can respond quickly and enter a waiting state, showing a high degree of cooperation. This degree of cooperation can be evaluated by tracking system scheduling events, process state transitions, and the speed of responding to interrupts. In the Linux system, this information can be obtained through various status files in the ` / proc` file system, or performance analysis tools such as `perf` can be used to monitor the process's response to scheduling events.
[0026] The historical behavior score nonlinear function of the target process is calculated ,in, They are respectively represented as pre-set weight coefficients, which are used to adjust the contribution of different historical information to the nonlinear function of historical behavior scoring; is the nonlinear scoring function of the CPU usage of the target process. , The historical average CPU usage of the target process. The decay rate is set to indicate that the higher the CPU usage, the lower the score; is the nonlinear scoring function of the number of memory leaks corresponding to the target process, , XL is the total number of historical memory leaks corresponding to the target process, is a tuning parameter used to emphasize the negative impact of memory leaks on the score; is the nonlinear scoring function of the target process corresponding to the I / O waiting time, , is the historical average I / O waiting time corresponding to the target process, It is a tuning parameter, which means that the longer the historical average I / O waiting time is, the lower the score is; is a nonlinear scoring function for the resource utilization efficiency of the target process. , Re is the efficiency of the target process in using system resources in history, is the expected value of resource efficiency, is the set gain function; is a nonlinear scoring function of the target process’s corresponding system scheduling cooperation degree, , HZ represents the degree of cooperation of the target process with respect to the historical response system scheduling, It is a frequency parameter, which is used to indicate the degree of cooperation between the target process and the system scheduling.
[0027] According to a preferred embodiment, the evaluation value of the contention degree of the lock corresponding to the computer operating system is obtained, and the specific acquisition process is: Capturing all lock-related events from the computer operating system, including lock requests, attempted acquisitions, successful possession, and releases, and recording the time at which each lock-related event occurred, the process or process identifier in which it occurred, and the associated lock identifier; Each process is considered as a node in the lock contention graph, and the lock request and release operations are represented as directed edges between nodes. If a process tries to obtain a lock that is already occupied by another process, a directed edge is added to the lock contention graph from the process node requesting the lock to the process node holding the lock. In this way, a complete lock contention graph is constructed. At the same time, it is necessary to identify all connected components from the lock contention graph, which can be done by graph traversal algorithms such as depth-first search (DFS) or breadth-first search (BFS). Each connected component represents an independent lock contention subsystem, in which all processes are directly or indirectly connected to each other through lock requests; Next, you need to detect cycles in the graph, as cycles represent potential deadlock conditions. This can be done by using Tarjan's algorithm or another cycle detection algorithm. Record the number of cycles and their size, which is the number of nodes contained in the cycle, which reflects the number of processes involved in the deadlock; Then, the in-degree and out-degree of each node are calculated, that is, the number of edges pointing to the node and the number of edges departing from the node. In the lock contention graph, the in-degree of a node indicates the number of other processes trying to acquire the lock held by the process, while the out-degree indicates the number of processes waiting to acquire the lock. A node with high in-degree may indicate that a lock resource is frequently contended by multiple processes, while a node with high out-degree may be a participant in a deadlock or a process that frequently encounters lock delays; Finally, these structural features are combined to analyze the lock contention of the entire system. For example, if there are many large connected components, this may indicate that the lock usage is widely distributed, while many cycles may indicate a high risk of deadlock.
[0028] Collect the timestamps of each process waiting for a specific lock and the timestamp of each process finally obtaining the lock from the lock contention graph. For each directed edge in the graph, calculate the waiting time of the source node of the edge (the process waiting for the lock), that is, the time difference from requesting the lock to obtaining the lock. Then, sum up all these waiting times and divide them by the total number of lock requests to get the average waiting time of all processes waiting for the lock. Get the number of lock requests for each lock in a specific time window, divide it by the length of the specific time window, sum it up and divide it by the total number of lock requests, and then get the average frequency of lock requests per unit time; Then calculate the lock contention intensity in the computer operating system , v is the number of each lock in the lock contention graph, v=1,2,...W, are the request frequency, average waiting time, and holding time of the v-th lock in the lock contention graph, TC is the number of processes participating in the contention in the lock contention graph, and W is the total number of all locks in the lock contention graph; The evaluation value of the competition degree of the corresponding lock of the computer operating system is calculated from this , is the average waiting time for all processes waiting for locks, is the lock request frequency per unit time, The calculation coefficient equalization factor is set.
[0029] Step 3: According to the lock lease time of the target process calculated in step 2, the lock management system allocates a lock to the target process and starts a lease monitor, which is responsible for tracking the usage status of the lock and ensuring that the lock is released before the lease time expires; Step 4: If the lock is not released after the lease time expires, the lease violation processing module is started, and the module executes the corresponding solution strategy for the target process according to the process information of the target process.
[0030] According to a preferred implementation, a corresponding solution strategy is executed on the target process, wherein the solution strategy is specifically divided into a transaction rollback strategy, a process scheduling strategy and a forced release strategy.
[0031] Transaction rollback strategy: Usually, if a transaction holds a lock that times out, the first thing to consider is rolling back the transaction. This is because rolling back can restore the system to a consistent state and release the current lock without affecting other running transactions. Rolling back is a relatively safe operation, especially for long transactions that have modified data but have not yet been committed.
[0032] Process scheduling policy: If the transaction can be delayed or rescheduled without causing much impact on the overall performance or data consistency of the system, the process scheduling policy may be an option. For example, if a process is just reading data and can be tried again later, the system can choose to delay the execution of this process instead of rolling back the transaction immediately.
[0033] Forced release strategy: This is usually the last resort, because forcibly releasing a lock may cause data consistency problems, especially if the lock is a write lock. Before performing a forced release, the system needs to ensure that all related data changes can be safely undone, or the system can be recovered without data corruption.
[0034] According to a preferred implementation, the module executes a corresponding solution strategy for the target process based on the process information of the target process. The specific execution process is as follows: Get the CPU usage of the target process , Memory usage and I / O operating frequency ; Using analytical formula , calculate the priority value of the target process , are the predefined weights of CPU usage, memory usage, and I / O operation frequency, respectively, and ; Compare the priority value of the target process with the set priority interval value Compare, if the priority value of the target process is less than , then execute the transaction rollback strategy for the target process; if Less than or equal to the priority value of the target process and the priority value of the target process is less than or equal to , the process scheduling policy is executed on the target process; if the priority value of the target process is greater than , then the forced release policy is executed on the target process.
[0035] In a multi-tasking system, effective management of resources is crucial to ensure the stability and performance of the system. When a process does not release the lock after the lease expires, it may cause long-term occupation of resources, thereby affecting the operation of other processes. This situation will cause serious performance problems, especially in a high-concurrency and resource-constrained environment. Therefore, designing an effective lease violation processing module can help the system better manage resources, avoid resource waste and system performance degradation; By collecting and analyzing the CPU usage, memory usage, I / O waiting time and other indicators of the process, the system can have a more comprehensive understanding of the current status of the process. The priority value is calculated using a weighted formula, which can be flexibly adjusted according to the importance of different indicators. This calculation method allows system administrators to adjust the weight according to actual needs, ensuring that the system can automatically select the most appropriate strategy under different workloads; Choosing the right strategy can not only improve the utilization of system resources, but also reduce potential conflicts and deadlocks. For example, through the transaction rollback strategy, resources can be quickly released to restore the normal operation of the system; through the process scheduling strategy, the priority of the problem process can be temporarily reduced to allow other processes to continue running; and when necessary, through the forced release strategy, the process occupying resources can be decisively terminated to avoid more serious system problems; The necessity of this method is also reflected in the flexibility and adaptability of the system. Under different loads and environments, the system can dynamically adjust strategies to ensure the optimization of overall performance. At the same time, detailed logging and security checks also provide reliable data support for subsequent system optimization and troubleshooting; In summary, this computing method provides a flexible and effective resource management method for the system, which can maintain the efficient operation and stability of the system in a complex multi-task environment. Through reasonable strategy selection, the system can not only improve resource utilization, but also enhance the ability to respond to emergencies and ensure business continuity and reliability. Example
[0036] A device for dynamically adjusting computing tasks based on a behavior prediction feedback loop, comprising a processor, a memory and a communication bus; The memory stores a computer-readable program that can be executed by the processor; The communication bus realizes the connection and communication between the processor and the memory; When the processor executes the computer-readable program, it is executed to implement a method for dynamically adjusting computing tasks based on a behavior prediction feedback loop as described in the present invention.
[0037] In the description of this specification, the description with reference to the terms "one embodiment", "example", "specific example", etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present invention. In this specification, the schematic representation of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any one or more embodiments or examples in a suitable manner.
[0038] The preferred embodiments of the present invention disclosed above are only used to help explain the present invention. The preferred embodiments do not describe all the details in detail, nor do they limit the invention to only specific implementation methods. Obviously, many modifications and changes can be made according to the content of this specification. This specification selects and specifically describes these embodiments in order to better explain the principles and practical applications of the present invention, so that those skilled in the art can understand and use the present invention well. The present invention is limited only by the claims and their full scope and equivalents.
Claims
1. A method for dynamically adjusting computing tasks based on a behavior prediction feedback loop, characterized in that: The method comprises the following steps: Step 1: When the computer operating system is initialized, a lock management system is created, wherein the lock management system is used to allocate locks to each process in the computer operating system; Step 2: When a process in the computer operating system requests a lock from the lock management system, the process is recorded as a target process, and at the same time, the lock lease management module in the lock management system determines the lock lease time allocated to the target process; Step 3: According to the lock lease time of the target process calculated in step 2, the lock management system allocates a lock to the target process and starts a lease monitor, which is responsible for tracking the usage status of the lock and ensuring that the lock is released before the lease time expires; Step 4: If the lock is not released after the lease time expires, the lease violation processing module is started, and the module executes the corresponding solution strategy for the target process according to the process information of the target process.
2. A method for dynamically adjusting computing tasks based on a behavior prediction feedback loop according to claim 1, characterized in that: Determine the lock lease time assigned to the target process. The specific decision process is as follows: Obtaining process information of the target process, thereby evaluating the priority and historical behavior score of the target process, and calculating the process information of the target process to obtain a priority nonlinear function and a historical behavior score nonlinear function of the target process; Synchronously acquiring system information of the computer operating system, wherein the system information includes a system load evaluation value and a lock contention degree evaluation value; Then comprehensively calculate the lock lease time of the target process , The basic lease time set for all processes in the computer operating system. are the priority nonlinear function and historical behavior scoring nonlinear function of the target process, FZ is the system load evaluation value of the computer operating system, and JZ is the competition degree evaluation value of the corresponding lock of the computer operating system. They are the weight coefficients of the predefined system load and lock contention degree respectively.
3. A method for dynamically adjusting computing tasks based on a behavior prediction feedback loop according to claim 2, characterized in that: Get the priority nonlinear function of the target process. The specific acquisition process is as follows: Obtaining the CPU time used by the target process, the waiting time in the ready queue, the I / O request frequency, and the process type; wherein the process type is divided into user process and system process; If the process type of the target process is identified as a user process, the initial weight setting value of the process type factor of the target process is On the contrary, if the process type of the target process is identified as a system process, the initial weight setting value of the process type factor of the target process is , and finally obtain the final weight setting value of the process type factor of the target process ,in The value is or ; Then we get the priority nonlinear function of the target process , is the I / O request frequency of the target process, t is the CPU time used by the target process, e is a natural constant, A is the maximum weight of the Sigmoid function related to the CPU usage time, B is the maximum weight of the Sigmoid function related to the process waiting time, DZ is the waiting time of the target process in the ready queue, k is the parameter for controlling the slope of the function, They are the center points of the Sigmoid function corresponding to the CPU usage time and process waiting time, respectively.
4. The method for dynamically adjusting computing tasks based on a behavior prediction feedback loop according to claim 2, characterized in that: The nonlinear function of the historical behavior score of the target process is obtained. The specific acquisition process is as follows: Obtain the historical information corresponding to the target process, including the historical average CPU usage, the total number of historical memory leaks, the historical average I / O waiting time, the efficiency of using system resources, and the degree of cooperation in responding to system scheduling; The historical behavior score nonlinear function of the target process is calculated ,in, They are respectively represented as preset weight coefficients, which are used to adjust the contribution of different historical information to the nonlinear function of historical behavior scoring.
5. The method for dynamically adjusting computing tasks based on a behavior prediction feedback loop according to claim 4, characterized in that: is the nonlinear scoring function of the CPU usage of the target process. , The historical average CPU usage of the target process. is the set decay rate; is the nonlinear scoring function of the number of memory leaks corresponding to the target process, , XL is the total number of historical memory leaks corresponding to the target process, is a tuning parameter used to emphasize the negative impact of memory leaks on the score; is the nonlinear scoring function of the target process corresponding to the I / O waiting time, , is the historical average I / O waiting time corresponding to the target process, It is a tuning parameter, which means that the longer the historical average I / O waiting time is, the lower the score is; is a nonlinear scoring function for the resource utilization efficiency of the target process. , Re is the efficiency of the target process in using system resources in history, is the expected value of resource efficiency, is the set gain function; is a nonlinear scoring function of the target process’s corresponding system scheduling cooperation degree, , HZ represents the degree of cooperation of the target process with respect to the historical response system scheduling, is the frequency parameter.
6. The method for dynamically adjusting computing tasks based on a behavior prediction feedback loop according to claim 2, characterized in that: Get the evaluation value of the contention level of the lock corresponding to the computer operating system. The specific acquisition process is as follows: Capturing all lock-related events from the computer operating system, including lock requests, attempted acquisitions, successful possession, and releases, and recording the time at which each lock-related event occurred, the process or process identifier in which it occurred, and the associated lock identifier; Each process is considered as a node in the lock contention graph, and the lock request and release operations are represented as directed edges between nodes. If a process tries to obtain a lock that is already occupied by another process, a directed edge is added to the lock contention graph from the process node requesting the lock to the process node holding the lock. In this way, a complete lock contention graph is constructed. Collect the timestamps of each process waiting for a specific lock and the timestamp of each process finally obtaining the lock from the lock contention graph. For each directed edge in the lock contention graph, calculate the waiting time of the source node of the directed edge, that is, the time difference from requesting the lock to obtaining the lock. Then, sum up all these waiting times and divide them by the total number of lock requests to get the average waiting time of all processes waiting for the lock. Get the number of lock requests for each lock in a specific time window, divide it by the length of the specific time window, sum it up and divide it by the total number of lock requests, and then get the average frequency of lock requests per unit time; Then calculate the lock contention intensity in the computer operating system , v is the number of each lock in the lock contention graph, v=1,2,...W, are the request frequency, average waiting time, and holding time of the v-th lock in the lock contention graph, respectively. TC is the number of processes participating in the contention in the lock contention graph; The evaluation value of the competition degree of the corresponding lock of the computer operating system is calculated from this , is the average waiting time for all processes waiting for locks, is the lock request frequency per unit time, The calculation coefficient equalization factor is set.
7. The method for dynamically adjusting computing tasks based on a behavior prediction feedback loop according to claim 1, characterized in that: A corresponding solution strategy is executed on the target process, wherein the solution strategy is specifically divided into a transaction rollback strategy, a process scheduling strategy and a forced release strategy.
8. The method for dynamically adjusting computing tasks based on a behavior prediction feedback loop according to claim 7, characterized in that: This module executes the corresponding solution strategy for the target process based on the process information of the target process. The specific execution process is as follows: Get the CPU usage of the target process , memory usage and I / O operating frequency ; Using analytical formula , calculate the priority value of the target process , are the predefined weights of CPU usage, memory usage, and I / O operation frequency, respectively, and ; Compare the priority value of the target process with the set priority interval value Compare, if the priority value of the target process is less than , then execute the transaction rollback strategy for the target process; if Less than or equal to the priority value of the target process and the priority value of the target process is less than or equal to , then execute the process scheduling strategy for the target process; If the priority value of the target process is greater than , then the forced release policy is executed on the target process.
9. A device for dynamically adjusting computing tasks based on a behavior prediction feedback loop, characterized in that : It is based on any one of claims 1-8 of a method for dynamically adjusting computing tasks based on a behavior prediction feedback loop, comprising a processor, a memory and a communication bus; The memory stores a computer-readable program that can be executed by the processor; The communication bus realizes the connection and communication between the processor and the memory; When the processor executes the computer-readable program, it implements a method for dynamically adjusting computing tasks based on a behavior prediction feedback loop as described in any one of claims 1-8.
Citation Information
Cited By
Process scheduling method and device, storage medium and computer program product
CN120508398A
A process scheduling method, device, storage medium and computer program product
CN120508398B