Memory management method, system, desktop computer and computer storage medium

By obtaining and analyzing the storage frequency and memory size of each running process, and dynamically adjusting the memory allocation strategy, the problem of low CPU memory resource allocation efficiency is solved, and resource utilization and system performance are improved.

CN118312320BActive Publication Date: 2025-05-23SHENZHEN GUOSHUOHONG ELECTRONICS CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202410516128.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-04-27
Publication Date
2025-05-23
Estimated Expiration
2044-04-27

AI Technical Summary

Technical Problem

When multiple running processes are in the running state, dynamic load changes affect the allocation of CPU memory resources, resulting in waste of resources and low utilization.

Method used

By obtaining the storage frequency and memory size of each running process, comparing the storage frequency with the preset frequency threshold, determining the target memory allocation strategy based on the memory size and segmentation interval, using the regression analysis algorithm to estimate CPU memory consumption, and adjusting CPU memory according to the consumption and strategy.

Benefits of technology

Dynamically adjust the memory allocation strategy to improve the utilization rate of CPU memory resources, avoid unnecessary waste, and improve the overall performance of the system.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118312320B_ABST
    Figure CN118312320B_ABST
Patent Text Reader

Abstract

The present application relates to the field of storage technology, and in particular to a memory management method, system, desktop computer and computer storage medium. The present application obtains the storage frequency and memory size of multiple running data corresponding to each running process in the N running processes and obtains the total CPU memory of the computer CPU when receiving a memory request from N running processes in the computer CPU, compares the storage frequency with a preset frequency threshold, and when it is determined that the storage frequency is greater than the preset frequency threshold, determines the target memory allocation strategy according to the memory size and the memory size segmentation interval, further estimates the CPU memory consumption corresponding to the N running processes in the computer CPU using a regression analysis algorithm, and allocates the total CPU memory to each running process in the N running processes according to the CPU memory consumption and the target memory allocation strategy, thereby improving the CPU memory resource utilization.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of storage technology, and in particular to a memory management method, system, desktop computer and computer storage medium. Background Art

[0002] With the rapid development of computer hardware capabilities, the Internet, computer programming languages ​​and other related technologies, more and more users are using laptop CPUs on desktop computers. The main function of the CPU is to interpret machine instructions and process data. To a large extent, the performance of the CPU determines the performance of the desktop computer.

[0003] Memory management is the technology of computer memory allocation and use when the computer system is running. The purpose of memory management is to allocate memory more efficiently and quickly, and recycle the allocated memory for next use when the memory is no longer in use. When multiple processes are running, dynamic load changes affect the allocation of CPU memory resources, resulting in a waste of resources and low CPU memory resource utilization. Summary of the invention

[0004] In view of the above, the present application provides a memory management method, system, desktop computer and computer storage medium to improve CPU memory resource utilization.

[0005] A first aspect of the present application provides a memory management method, the method comprising:

[0006] When receiving memory requests of N running processes, obtaining the storage frequency and memory size of multiple running data in the computer CPU corresponding to each running process in the N running processes, and the CPU memory of the computer CPU, wherein N is an integer greater than or equal to 1;

[0007] comparing the stored frequency with a preset frequency threshold;

[0008] When it is determined that the storage frequency is greater than the preset frequency threshold, determining a target memory allocation strategy according to the memory size and the memory size segmentation interval, wherein the memory size segmentation interval includes multiple memory size intervals, and each memory size interval corresponds to a memory allocation strategy;

[0009] estimating CPU memory consumption of the computer CPU using a regression analysis algorithm;

[0010] The CPU memory is adjusted according to the CPU memory consumption and the target memory allocation policy.

[0011] In an optional implementation, adjusting the CPU memory of the computer CPU according to the CPU memory consumption and the target memory allocation strategy includes:

[0012] Grouping based on the historical load corresponding to each running process and the CPU memory consumption;

[0013] Determine the allocation granularity of the CPU memory corresponding to each running process based on the grouping result after grouping;

[0014] The CPU memory is adjusted according to the memory allocation strategy and the allocation granularity to the CPU memory corresponding to each running process.

[0015] In an optional embodiment, the method further comprises:

[0016] When it is determined that the storage frequency is less than the preset frequency threshold, identifying the importance of each running process;

[0017] The memory allocation ratio corresponding to the CPU memory is set according to the importance, and the CPU memory is allocated to each running process according to the memory allocation ratio.

[0018] In an optional embodiment, the method further comprises:

[0019] Get the average CPU utilization and response time of each server on the server side;

[0020] Determining the load state of the computer CPU according to the CPU average utilization and a preset utilization threshold, wherein the load state includes a high load state and a low load state;

[0021] When it is determined that the load state is the high load state, comparing the response time with a preset response time threshold;

[0022] When it is determined that the response time is greater than the preset response time threshold, increasing the memory allocation ratio;

[0023] When it is determined that the load state is the low load state, the memory allocation ratio is reduced.

[0024] In an optional embodiment, the method further comprises:

[0025] Determine the memory access pattern and cache hit rate of the computer CPU at the current moment;

[0026] Using a pre-trained target prediction model to predict a target memory access pattern and a target cache hit rate at a next moment based on the memory access pattern and the cache hit rate, wherein the current moment and the next moment are adjacent moments;

[0027] Adjusting the pre-stored cache management strategy according to the target memory access mode and the target cache hit rate to obtain the target cache management strategy that meets the next moment;

[0028] A plurality of operation data of the target operation process corresponding to the next moment is stored according to the target cache management strategy.

[0029] In an optional embodiment, the method further comprises:

[0030] Acquire a plurality of operation data corresponding to each of the operation processes, and add a redundant check code to each of the plurality of operation data;

[0031] Using the redundant check code to detect whether a memory error occurs in the target operating data, wherein the target operating data is any one of the multiple operating data;

[0032] When it is determined that the memory error occurs in the target operating data, an alarm is issued according to the target alarm mode, and the memory error is automatically corrected using the redundant check code.

[0033] In an optional embodiment, the method further comprises:

[0034] Determine the running process corresponding to the running data whose storage frequency is greater than the preset frequency threshold as a common running process;

[0035] When receiving an access request of the commonly used running process, determining a plurality of access data corresponding to the access request;

[0036] sorting the plurality of access data from high to low according to the access frequency corresponding to each access data in the plurality of access data;

[0037] A memory buffer for loading target access data in a preset sequence interval from among the sorted plurality of access data;

[0038] When an access request for the target access data is received, the target access data is loaded from the memory buffer.

[0039] A second aspect of the present application provides a memory management system, the system comprising:

[0040] an acquisition module, configured to acquire, when receiving memory requests from N running processes, a storage frequency and a memory size of a plurality of running data in a computer CPU corresponding to each running process in the N running processes, and a CPU memory of the computer CPU, wherein N is an integer greater than or equal to 1;

[0041] A comparison module, used for comparing the stored frequency with a preset frequency threshold;

[0042] A determination module, configured to determine a target memory allocation strategy according to the memory size and the memory size segmentation interval when it is determined that the storage frequency is greater than the preset frequency threshold, wherein the memory size segmentation interval includes multiple memory size intervals, and each memory size interval corresponds to a memory allocation strategy;

[0043] An estimation module, for estimating the CPU memory consumption of the computer CPU using a regression analysis algorithm;

[0044] An adjustment module is used to adjust the CPU memory according to the CPU memory consumption and the target memory allocation strategy.

[0045] A third aspect of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the memory management method when executing the computer program.

[0046] A fourth aspect of the present application provides a computer-readable storage medium having a computer program stored thereon, which implements the steps of the above-mentioned memory management method when the computer program is executed by a processor.

[0047] In summary, the memory management method, system, desktop computer and computer storage medium provided by the present application can dynamically adjust the memory allocation strategy according to the current running state by obtaining the storage frequency and memory size of each running process and real-time monitoring of the CPU memory, which helps to use the CPU memory resources more effectively and avoid unnecessary waste. By comparing the storage frequency with the preset frequency threshold, different memory allocation strategies can be adopted when the storage frequency is higher than the preset frequency threshold. It helps to improve the memory access efficiency under high frequency conditions, thereby improving the integrity. Determining the target memory allocation strategy based on the memory size and the memory size segmentation interval can selectively select the memory allocation method that best suits the current situation, which helps to better meet the needs of various running processes. Using the regression analysis algorithm to estimate the CPU memory consumption can more accurately predict the use of CPU memory resources, which helps to make adjustments in advance to cope with the memory pressure of the running process at the next moment. According to the CPU memory consumption and the target memory allocation strategy, the CPU memory can be adjusted in real time to ensure the performance and stability of the computer CPU under different workloads. BRIEF DESCRIPTION OF THE DRAWINGS

[0048] Figure 1 is a flow chart of a memory management method shown in an embodiment of the present application;

[0049] Figure 2 It is a functional module diagram of a memory management system shown in an embodiment of the present application;

[0050] Figure 3 It is a structural schematic diagram of a desktop computer shown in an embodiment of the present application. DETAILED DESCRIPTION

[0051] The terms used in the following embodiments of the present application are only for the purpose of describing specific embodiments, and are not intended to be used as limitations to the present application. As used in the specification of the present application, the singular expressions "one", "a kind of", "said", "above", "the" and "this" are intended to also include plural expressions, unless there is a clear indication to the contrary in the context. It should also be understood that the term "and / or" used in the present application refers to any or all possible combinations comprising one or more of the listed items.

[0052] In the following, the terms "first" and "second" are used for descriptive purposes only and are not to be understood as suggesting or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of the features, and in the description of the embodiments of the present application, unless otherwise specified, "plurality" means two or more.

[0053] Reference Figure 1 , which is a flowchart of a memory management method according to an embodiment of the present application, and the memory management method includes the following steps.

[0054] S11, when receiving memory requests of N running processes, obtaining the storage frequency and memory size of multiple running data in the computer CPU corresponding to each running process in the N running processes, and the CPU memory of the computer CPU.

[0055] Wherein, N is an integer greater than or equal to 1.

[0056] A running process refers to an application process that runs in a desktop computer system without a user interface or an interface visible. It is a task that is silently performed in the background and does not require direct user interaction or monitoring. It is used to perform some system services, automated tasks, data synchronization, regular checks, etc. to provide better user experience and system performance. A running process includes five basic states, namely, creation state, ready state, running state, termination state, and blocking state. Among them, the creation state means that the process has been created, but system resources have not been allocated and it has not been scheduled for execution. The ready state means that the process has obtained the required resources except the CPU and is waiting for the allocation of CPU memory. As long as the CPU memory is allocated, the process can be executed. The running state means that the process is executing instructions and occupies the CPU time slice. The blocked state means that the process cannot be executed temporarily due to some reasons. The process in the blocked state does not occupy CPU time. All resources of the process in the terminated state will be released and no longer occupy system resources.

[0057] In some embodiments, the desktop computer can obtain the running process in the running state through Linux command line tools, system monitoring software, scripts or programs.

[0058] S12: Compare the stored frequency with a preset frequency threshold.

[0059] In some embodiments, a frequency threshold may be preset to compare the storage frequency of each running process for the computer CPU with the preset frequency threshold to determine whether the storage frequency is greater than or less than the preset frequency threshold.

[0060] In an optional embodiment, the method further comprises:

[0061] When it is determined that the storage frequency is less than the preset frequency threshold, identifying the importance of each running process;

[0062] The memory allocation ratio corresponding to the CPU memory is set according to the importance, and the CPU memory is allocated to each running process according to the memory allocation ratio.

[0063] In some embodiments, the corresponding operation data in each operation process can be obtained, and an operation data matrix can be generated according to the operation data. The operation data matrix is ​​subjected to feature calculation to obtain multiple eigenvalues ​​and eigenvectors corresponding to each of the multiple eigenvalues, and the multiple eigenvalues ​​are sorted, and the cumulative contribution of the operation data corresponding to each of the sorted multiple eigenvalues ​​is calculated, and the importance of each operation process is determined according to the cumulative contribution and the pre-set cumulative contribution grade segmentation interval. Among them, the preset contribution threshold segmentation interval may include multiple contribution threshold intervals, each contribution threshold interval corresponds to a level of importance, and different contribution threshold intervals correspond to different levels of importance. For example, a first contribution threshold interval, a second contribution threshold interval, and a third contribution threshold interval can be pre-set, wherein the first contribution threshold interval corresponds to the first level of importance, the second contribution threshold interval corresponds to the second level of importance, and the third contribution threshold interval corresponds to the third level of importance.

[0064] After determining the importance of each running process based on the cumulative contribution, the memory allocation ratio corresponding to the CPU memory can also be set according to the different levels of importance. For running processes with higher importance, more CPU memory can be allocated accordingly, that is, a higher memory allocation ratio is set, and for running processes with lower importance, less CPU memory can be allocated accordingly, that is, a lower memory allocation ratio is set. For example, the first level of importance corresponds to a first memory allocation ratio, the second level of importance corresponds to a second memory allocation ratio, and the third level of importance corresponds to a third memory allocation ratio.

[0065] In other embodiments, the importance of each running process may also be identified based on the performance requirements or behavior patterns of the running process.

[0066] In some embodiments, the system can periodically identify the importance of each running process according to a preset time period so that the memory allocation ratio can be adjusted in time after the importance changes, so as to more reasonably allocate CPU memory resources and avoid memory waste or shortage.

[0067] By setting the memory allocation ratios of different levels according to the importance through the above optional implementation, it is possible to better respond to the running processes with higher performance requirements, which helps to improve the overall performance of the system. Secondly, by dynamically adjusting the memory allocation, it is possible to avoid the waste of CPU resources. For the running processes with lower importance, less CPU resources are allocated, so that more CPU resources can be used for the running processes with higher importance.

[0068] S13: When it is determined that the storage frequency is greater than the preset frequency threshold, a target memory allocation strategy is determined according to the memory size and the memory size segmentation interval.

[0069] The memory size segmentation interval includes multiple memory size intervals, and each memory size interval corresponds to a memory allocation strategy.

[0070] In some embodiments, multiple memory size intervals may be pre-set, each memory size interval corresponds to a memory allocation strategy, and different memory size intervals correspond to different memory allocation strategies. For example, a first memory size interval, a second memory size interval, and a third memory size interval may be pre-set, wherein the first memory size interval corresponds to a first memory allocation strategy, the second memory size interval corresponds to a second memory allocation strategy, and the third memory size interval corresponds to a third memory allocation strategy.

[0071] Exemplarily, assuming that 0≤memory size≤256MB, the first memory allocation strategy is used to allocate CPU memory, such as a fixed memory allocation strategy, that is, each running process corresponds to the same CPU memory. Assuming that 256MB<memory size≤1024MB, the second memory allocation strategy is used to allocate CPU memory, such as a dynamic memory allocation strategy, that is, each running process dynamically applies for and releases memory according to the memory size during operation. Assuming that the memory size>1024MB, the third memory allocation strategy is used to allocate CPU memory, such as a virtual memory allocation strategy, that is, the memory size of infrequently used running processes is stored on the hard disk to release memory.

[0072] It should be noted that the above memory size, memory size segmentation interval and memory allocation strategy are only examples and shall be determined according to the actual application scenario.

[0073] S14, estimating the CPU memory consumption of the computer CPU using a regression analysis algorithm.

[0074] In the embodiment of the present application, the regression analysis algorithm refers to the partial least squares algorithm (PLS), which has the characteristics of allowing regression modeling with a small number of samples and improving the estimation accuracy of the model. When estimating the CPU memory consumption of the computer CPU, it is first necessary to use the system probe to obtain the log information of the server online according to the preset time period, and obtain the operation data recorded in the log information through a fixed time interval (also called a monitoring window), including the average CPU utilization of the server, the response time and the throughput corresponding to each running process.

[0075] Assuming that the server has N running processes, according to the utility law, the average CPU utilization A can be expressed as the product of throughput and service time. CPU,N , as shown in the following formula:

[0076]

[0077] Among them, A CPU,M Indicates the average CPU utilization on server M during the monitoring window recording time, N n Indicates the number of transactions completed by the nth running process within the monitoring window, T n,M It represents the average time of all transactions completed by the nth running process on server M, and t is the length of the monitoring window, where 1≤n≤N.

[0078] Since it is difficult to obtain the exact service time T n,M , use T' n,M Indicates T n,M The approximate value of A can be determined by the following formulaCPU,M The approximate value of A' CPU,M :

[0079]

[0080] To reduce A CPU,M With A' CPU,M To improve the measurement accuracy, the PLS algorithm can be used to perform regression modeling on the transaction throughput, response time and other parameters recorded in the monitoring window to calculate T n,M . Service time T n,M The modeling is as follows:

[0081] T n,M =BX+e

[0082] Among them, T n,M is an N×1 matrix, representing the average service time of N running processes, e is a constant, B is a 1×m regression coefficient matrix, and X is an N×K matrix.

[0083] Obtain K records of N running processes through the monitoring window. A record contains m items of data. The explanatory variable of the kth record is Including data items such as the throughput of each running process, the average response time and the transaction probability of the load. The coefficient matrix B is calculated according to the PLS algorithm, and according to the formula T n,M =BX+e can determine the service time T n,M , further according to the formula The average CPU utilization, i.e. CPU memory consumption, can be estimated.

[0084] In other embodiments, the system can pre-train a regression model (e.g., linear regression, random forest, etc.) based on PLS and historical CPU memory consumption to obtain an estimation model to estimate the CPU memory consumption of the computer CPU. When the memory size of each running process is determined, it can be input into the estimation model, and the CPU memory consumption can be output using the estimation model.

[0085] S15, adjusting the CPU memory according to the CPU memory consumption and the target memory allocation strategy.

[0086] After the target memory allocation strategy is determined and the CPU memory consumption of the computer CPU is estimated, the CPU memory of the computer CPU can be adjusted based on the CPU memory consumption and the target memory allocation strategy.

[0087] The CPU memory consumption refers to the memory size of each running process, that is, the memory occupancy, which may include the current memory usage, the allocated memory size, and the memory release status.

[0088] In an optional implementation, adjusting the CPU memory of the computer CPU according to the CPU memory consumption and the target memory allocation strategy includes:

[0089] Grouping based on the historical load corresponding to each running process and the CPU memory consumption;

[0090] Determine the allocation granularity of the CPU memory corresponding to each running process based on the grouping result after grouping;

[0091] The CPU memory is adjusted according to the memory allocation strategy and the allocation granularity to the CPU memory corresponding to each running process.

[0092] The allocation granularity is a measure that determines how to divide and allocate available CPU memory to different running processes. For example, the allocation granularity of CPU memory changes from allocation in units of CPU cores to allocation in units of CPU time slices, or the allocation granularity of CPU memory changes from allocation in units of GB to allocation in units of MB.

[0093] In some embodiments, a decoupled resource management system for serverless computing is used to decouple the allocation of CPU resources from memory resources in terms of resource allocation, and automatically configure appropriate CPU resources for each running process. Specifically, each running process is grouped based on its usage characteristics, historical load information, and CPU memory consumption, and the CPU memory is divided into multiple subspaces according to the grouping results after grouping. According to the same embodiment in step S14, the historical load corresponding to each running process can be obtained from the running data recorded in the log information.

[0094] To solve the problem of memory allocation mismatch, a grouping model based on the usage characteristics of each running process can be constructed. Based on the grouping results and the allocation granularity of the CPU memory corresponding to each running process, the memory allocation objects are distinguished, and CPU memory is allocated to each running process respectively. By distinguishing the resource allocation objects, not only the problem of mismatch between CPU memory and the number of running processes is solved, but also the problem of performance degradation caused by competition for shared CPU memory can be alleviated.

[0095] In some embodiments, a memory allocation model may be constructed in advance using Bayesian optimization and a weighted scoring function, and the scoring function may be used to guide the model to search in the right direction in the memory configuration space, thereby reducing search time overhead.

[0096] In an optional implementation, the average CPU utilization and response time corresponding to each server in the server are obtained;

[0097] Determining the load state of the computer CPU according to the CPU average utilization and a preset utilization threshold, wherein the load state includes a high load state and a low load state;

[0098] When it is determined that the load state is the high load state, comparing the response time with a preset response time threshold;

[0099] When it is determined that the response time is greater than the preset response time threshold, increasing the memory allocation ratio;

[0100] When it is determined that the load state is the low load state, the memory allocation ratio is reduced.

[0101] According to the same embodiment as step S14, the average CPU utilization and response time of the server are obtained from the operation data recorded in the log information. The average CPU utilization refers to the ratio of the time when the CPU is executing a task to the total time.

[0102] The obtained average CPU utilization is compared with the preset utilization threshold. When it is determined that the average CPU utilization is greater than the preset utilization threshold, it can be determined that the load state of the computer CPU at the current moment is a high load state. When it is determined that the load state of the computer CPU is a high load state, the obtained response time of the server is compared with the preset response time threshold. When it is determined that the response time is greater than the preset response time threshold, it means that the high load may cause the current slow response. The corresponding memory allocation ratio of the running process in the server can be increased to improve the response speed. For example, if the CPU utilization of a Web server in a certain time period is greater than the utilization threshold of 80%, and the response time is greater than the response time of 60s, the memory allocation ratio of the Web service running on the server can be increased, that is, the CPU memory of the Web service running on the server can be increased. When it is determined that the response time is less than the preset response time threshold, it means that the high load does not cause the current slow response, and the corresponding memory allocation ratio of the running process in the server can be adjusted.

[0103] When the average CPU utilization is less than the preset utilization threshold, it can be determined that the computer CPU load state at the current moment is a low load state, indicating that there are fewer processes running in the server. The corresponding memory allocation ratio of the running processes in the server can be reduced to release some unnecessary CPU memory to avoid wasting resources.

[0104] Through the above optional implementation, by regularly monitoring the system's CPU utilization, the system load can be understood in real time. High CPU utilization requires adjustment of the memory allocation ratio to cope with high load, while low CPU utilization means that memory usage can be optimized to avoid resource waste, which helps to maintain high performance and effectively utilize CPU memory resources under different load conditions.

[0105] In an optional embodiment, the method further comprises:

[0106] Determine the memory access pattern and cache hit rate of the computer CPU at the current moment;

[0107] Using a pre-trained target prediction model to predict a target memory access pattern and a target cache hit rate at a next moment based on the memory access pattern and the cache hit rate, wherein the current moment and the next moment are adjacent moments;

[0108] Adjusting the pre-stored cache management strategy according to the target memory access mode and the target cache hit rate to obtain the target cache management strategy that meets the next moment;

[0109] According to the target cache management strategy, multiple running data of the target running process corresponding to the next moment are stored.

[0110] Since the cache management policy has been pre-stored in the system, the system usually caches data according to the cache management policy. Since there is no next adjustment instruction, the system still caches data according to the cache management policy at the current moment. If the same cache management policy is always used for data caching, there may be problems such as resource waste or over-consumption.

[0111] According to the same embodiment as step S14, the memory access mode and cache hit rate of the computer CPU are obtained from the operation data recorded in the log information. The memory access mode may include a random access mode, a sequential access mode, a mixed access mode, etc.

[0112] In some embodiments, training can be performed based on historical memory access patterns, historical cache hit rates, and machine learning models (e.g., neural networks, decision trees, support vector machines, etc.) to obtain a target prediction model. The memory access pattern and cache hit rate obtained at the current moment are input into the target prediction model to output a prediction result, namely, the memory access pattern and cache hit rate at the next moment, which are respectively referred to as the target memory access pattern and the target cache hit rate. According to the prediction result, the system adjusts the pre-stored cache management policy to make it more consistent with the data cache at the next moment. According to the adjusted target cache management policy, multiple running data of the target running process corresponding to the next moment are stored. Exemplarily, assuming that the historical access pattern indicates that in the sequential access mode, when the historical cache hit rate is high, the next moment will usually continue to maintain the sequential access mode, and the cache hit rate may also remain at a high level. After learning the law, the target prediction model can predict that the next moment will continue the sequential access mode and the target cache hit rate will remain at a high level when it is monitored in real time that the current moment is in sequential access mode and the cache hit rate is high. The system adjusts the cache management policy according to this to better adapt to future memory access patterns.

[0113] In an optional embodiment, the method further comprises:

[0114] Acquire a plurality of operation data corresponding to each of the operation processes, and add a redundant check code to each of the plurality of operation data;

[0115] Using the redundant check code to detect whether a memory error occurs in the target operating data, wherein the target operating data is any one of the multiple operating data;

[0116] When it is determined that the memory error occurs in the target operating data, an alarm is issued according to the target alarm mode, and the memory error is automatically corrected using the redundant check code.

[0117] According to the same embodiment mode in step S14, multiple operation data corresponding to each operation process are determined from the operation data recorded in the log information. In some embodiments, a coding verification algorithm (for example, a cyclic redundancy check algorithm CRC (Cyclic Redundancy Check, CRC), Reed-Solomon codes (Reed-solomon codes, RS) etc.) can be used to add a redundant check code in each operation data, which can not only detect whether there is a memory error in any operation data in multiple operation data and automatically correct the operation data where the memory error occurs. When it is determined that there is a target operation data with a memory error in the operation data, the system automatically triggers an alarm and alarms according to the target alarm mode. For example, an error message is sent to the terminal device (for example, a mobile phone) of the relevant personnel.

[0118] In other embodiments, the memory error information may also be recorded in the log information for monitoring and analysis.

[0119] In an optional embodiment, the method further comprises:

[0120] Determine the running process corresponding to the running data whose storage frequency is greater than the preset frequency threshold as a common running process;

[0121] When receiving an access request of the commonly used running process, determining a plurality of access data corresponding to the access request;

[0122] sorting the plurality of access data from high to low according to the access frequency corresponding to each access data in the plurality of access data;

[0123] A memory buffer for loading target access data in a preset sequence interval from among the sorted plurality of access data;

[0124] When an access request for the target access data is received, the target access data is loaded from the memory buffer.

[0125] In some embodiments, by detecting the storage frequency of each running process within a preset time period, and by comparing the storage frequency with a preset frequency threshold, the running process corresponding to the storage frequency greater than the preset storage frequency threshold is marked as a frequently used running process. For access requests of frequently used running processes, the system obtains multiple access data related to the access request, such as memory addresses, memory data blocks, etc. For the multiple access data obtained, they are sorted from high to low according to the access frequency of each access data. By comparing the sorting order corresponding to the sorted multiple access data with a preset sequence interval, it is determined whether it is within the preset sequence interval, and the access data with the sorting order within the preset sequence interval is marked as the target access data, and the target access data is preferentially loaded into the memory buffer to speed up access to the target access data. When an access request for the target access data in the memory buffer is received, the target access data is directly loaded from the memory buffer without accessing the computer CPU.

[0126] Through the above-mentioned optional implementation, the access efficiency to commonly used data in frequently used running processes is improved by analyzing and sorting the storage frequency of frequently used running processes and loading target access data in a preset sequence interval among multiple access data into a memory buffer before access.

[0127] Reference Figure 2 , which is a functional module diagram of a memory management system shown in an embodiment of the present application.

[0128] In some embodiments, the memory management system 20 may include multiple functional modules composed of computer program segments. The computer programs of the various program segments of the memory management system 20 may be stored in the memory of the electronic device and executed by at least one processor to perform (see Figure 1 Description) Memory management functions.

[0129] In this embodiment, the memory management system 20 can be divided into multiple functional modules according to the functions it performs. The functional modules may include: an acquisition module 201, a comparison module 202, a determination module 203, an estimation module 204, an adjustment module 205, an allocation module 206, a correction module 207 and a loading module 208. The module referred to in this application refers to a series of computer program segments that can be executed by at least one processor and can complete fixed functions, which are stored in a memory. In this embodiment, the functions of each module will be described in detail in subsequent embodiments.

[0130] The acquisition module 201 is used to obtain the storage frequency and memory size of multiple running data in the computer CPU corresponding to each of the N running processes, and the CPU memory of the computer CPU when receiving memory requests from N running processes, where N is an integer greater than or equal to 1.

[0131] The comparison module 202 is configured to compare the stored frequency with a preset frequency threshold.

[0132] The determination module 203 is used to determine the target memory allocation strategy according to the memory size and the memory size segmentation interval when it is determined that the storage frequency is greater than the preset frequency threshold, wherein the memory size segmentation interval includes multiple memory size intervals, and each memory size interval corresponds to a memory allocation strategy.

[0133] The estimation module 204 is used to estimate the CPU memory consumption of the computer CPU using a regression analysis algorithm.

[0134] The adjustment module 205 is used to adjust the CPU memory according to the CPU memory consumption and the target memory allocation strategy.

[0135] The adjustment module 205 is further specifically used for:

[0136] Grouping based on the historical load corresponding to each running process and the CPU memory consumption;

[0137] Determine the allocation granularity of the CPU memory corresponding to each running process based on the grouping result after grouping;

[0138] The CPU memory is adjusted according to the memory allocation strategy and the allocation granularity to the CPU memory corresponding to each running process.

[0139] The allocation module 206 is used to:

[0140] When it is determined that the storage frequency is less than the preset frequency threshold, identifying the importance of each running process;

[0141] The memory allocation ratio corresponding to the CPU memory is set according to the importance, and the CPU memory is allocated to each running process according to the memory allocation ratio.

[0142] The allocation module 206 is further used for:

[0143] Get the average CPU utilization and response time of each server on the server side;

[0144] Determining the load state of the computer CPU according to the CPU average utilization and a preset utilization threshold, wherein the load state includes a high load state and a low load state;

[0145] When it is determined that the load state is the high load state, comparing the response time with a preset response time threshold;

[0146] When it is determined that the response time is greater than the preset response time threshold, increasing the memory allocation ratio;

[0147] When it is determined that the load state is the low load state, the memory allocation ratio is reduced.

[0148] The adjustment module 205 is further used for:

[0149] Determine the memory access pattern and cache hit rate of the computer CPU at the current moment;

[0150] Using a pre-trained target prediction model to predict a target memory access pattern and a target cache hit rate at a next moment based on the memory access pattern and the cache hit rate, wherein the current moment and the next moment are adjacent moments;

[0151] Adjusting the pre-stored cache management strategy according to the target memory access mode and the target cache hit rate to obtain the target cache management strategy that meets the next moment;

[0152] According to the target cache management strategy, multiple running data of the target running process corresponding to the next moment are stored.

[0153] The correction module 207 is used to:

[0154] Acquire a plurality of operation data corresponding to each of the operation processes, and add a redundant check code to each of the plurality of operation data;

[0155] Using the redundant check code to detect whether a memory error occurs in the target operating data, wherein the target operating data is any one of the multiple operating data;

[0156] When it is determined that the memory error occurs in the target operating data, an alarm is issued according to the target alarm mode, and the memory error is automatically corrected using the redundant check code.

[0157] The loading module 208 is used to:

[0158] Determine the running process corresponding to the running data whose storage frequency is greater than the preset frequency threshold as a common running process;

[0159] When receiving an access request of the commonly used running process, determining a plurality of access data corresponding to the access request;

[0160] sorting the plurality of access data from high to low according to the access frequency corresponding to each access data in the plurality of access data;

[0161] A memory buffer for loading target access data in a preset sequence interval from among the sorted plurality of access data;

[0162] When an access request for the target access data is received, the target access data is loaded from the memory buffer.

[0163] It should be understood that the various variations and specific embodiments of the memory management method provided in the above embodiments are also applicable to the memory management system of this embodiment. Through the above detailed description of the memory management method, those skilled in the art can clearly know the implementation method of the memory management system in this embodiment. For the sake of brevity of the specification, it will not be described in detail here.

[0164] See also Figure 3 , which is a schematic diagram of the structure of a desktop computer shown in an embodiment of the present application. In a preferred embodiment of the present application, the desktop computer 3 includes a memory 31, at least one processor 32 and at least one communication bus 33.

[0165] Those skilled in the art should understand that Figure 3 The structure of the electronic device shown does not constitute a limitation of the embodiments of the present application, and can be either a bus structure or a star structure. The desktop computer 3 can also include more or less other hardware or software than shown in the figure, or a different component arrangement.

[0166] In some embodiments, the desktop computer 3 is a device that can automatically perform numerical calculations and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application-specific integrated circuits, programmable gate arrays, digital processors, and embedded devices.

[0167] It should be noted that the desktop computer 3 is only an example, and other existing or future electronic products that are suitable for the present application should also be included in the protection scope of the present application and included here by reference.

[0168] In some embodiments, the memory 31 stores a computer program, and when the computer program is executed by the at least one processor 32, all or part of the steps in the memory management method described above are implemented. The memory 31 includes a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), a one-time programmable read-only memory (OTPROM), an electronically erasable rewritable read-only memory (EEPROM), a compact disc read-only memory (CD-ROM) or other optical disc storage, magnetic disk storage, magnetic tape storage, or any other computer-readable medium that can be used to carry or store data. Further, the computer-readable storage medium may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application required for at least one function, etc.; the data storage area may store data created according to the use of the blockchain node, etc. The blockchain referred to in this application is a new application model of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, and encryption algorithm.

[0169] In some embodiments, the at least one processor 32 is the control core (ControlUnit) of the desktop computer 3, and uses various interfaces and lines to connect various components of the entire desktop computer 3, and executes various functions and processes data of the desktop computer 3 by running or executing programs or modules stored in the memory 31, and calling data stored in the memory 31. For example, when the at least one processor 32 executes the computer program stored in the memory, it implements all or part of the steps of the memory management method described above in the embodiment of the present application; or implements all or part of the functions of the memory management system. The at least one processor 32 can be composed of an integrated circuit, for example, it can be composed of a single packaged integrated circuit, or it can be composed of multiple integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and a combination of various control chips.

[0170] In some embodiments, the at least one communication bus 33 is configured to realize connection and communication between the memory 31 and the at least one processor 32, etc. Although not shown, the desktop computer 3 may also include a power supply (such as a battery) for powering each component. Preferably, the power supply may be logically connected to the at least one processor 32 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 may also include any components such as one or more DC or AC power supplies, recharging systems, power failure detection circuits, power converters or inverters, power status indicators, etc. The desktop computer 3 may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.

[0171] The above-mentioned integrated unit implemented in the form of a software function module can be stored in a computer-readable storage medium. The above-mentioned software function module is stored in a storage medium, including a number of instructions for enabling an electronic device (which can be a personal computer, electronic device, or network device, etc.) or a processor to execute part of the method described in each embodiment of the present application.

[0172] In the several embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.

[0173] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, and may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0174] The above are all preferred embodiments of the present application, and the protection scope of the present application is not limited thereto. Therefore, any equivalent changes made according to the structure, shape, and principle of the present application should be included in the protection scope of the present application.

Claims

1. A memory management method, characterized in that: The method includes: when receiving memory requests from N running processes in a computer CPU, obtaining the storage frequency of target running data, the memory size occupied by the target running data and the total CPU memory of the computer CPU, wherein N is an integer greater than or equal to 1, and the target running data is any one of the multiple running data corresponding to a first target running process, and the first target running process is any one of the N running processes, wherein the storage frequency refers to the rate of reading or writing data from a main memory (RAM); when it is determined that the storage frequency is greater than a preset frequency threshold, determining a target memory allocation strategy according to the memory size and the memory size segmentation interval, wherein the memory size segmentation interval includes multiple memory size intervals, each memory size interval corresponds to a memory allocation strategy, and different memory size intervals correspond to different memory allocation strategies; using a regression analysis algorithm to estimate the computer CPU The CPU memory consumption corresponding to the N running processes in the regression analysis algorithm is pre-trained based on PLS and historical CPU memory consumption, the CPU memory consumption refers to the memory size of each running process, that is, the memory occupancy, including the current memory usage, the allocated memory size and the memory release status; according to the CPU memory consumption and the target memory allocation strategy, the total CPU memory is allocated to each of the N running processes; the total CPU memory is allocated to each of the N running processes according to the CPU memory consumption and the target memory allocation strategy, including: grouping based on the historical load corresponding to each running process and the CPU memory consumption; determining the CPU memory allocation granularity corresponding to each running process based on the grouping result after grouping; allocating the total CPU memory to each running process according to the memory allocation strategy and the CPU memory allocation granularity.

2. The memory management method according to any one of claim 1, characterized in that: The method also includes: when it is determined that the storage frequency is less than the preset frequency threshold, identifying the importance of each running process; setting the memory allocation ratio corresponding to the CPU memory according to the importance, and allocating the CPU memory to each running process according to the memory allocation ratio.

3. The memory management method according to claim 2, characterized in that: The method also includes: obtaining the average CPU utilization and response time of each running process in the previous preset cycle of the current cycle; determining the load state of each running process in the preset cycle according to the average CPU utilization and the preset utilization threshold, wherein the load state includes a high load state and a low load state; when there is a second target running process whose load state is a high load state among the N running processes, comparing the response time corresponding to the second target running process with a preset response time threshold; when it is determined that the response time is greater than the preset response time threshold, increasing the memory allocation ratio corresponding to the second target running process; when there is a third target running process whose load state is a low load state among the N running processes, reducing the memory allocation ratio corresponding to the third target running process.

4. The memory management method according to any one of claims 1 to 3, characterized in that: The method also includes: determining the memory access pattern and cache hit rate of the computer CPU at the current moment; using a pre-trained target prediction model to predict the target memory access pattern and target cache hit rate at the next moment based on the memory access pattern and cache hit rate; adjusting the pre-stored cache management strategy according to the target memory access pattern and the target cache hit rate to obtain a target cache management strategy that conforms to the next moment; determining a fourth target running process to be run at the next moment; and caching multiple running data of the fourth target running process at the next moment according to the target cache management strategy.

5. The memory management method according to claim 4, characterized in that: The method also includes: obtaining multiple operating data corresponding to each operating process, and adding a redundant check code to each operating data in the multiple operating data; using the redundant check code to detect whether there is erroneous operating data due to cache errors in the multiple operating data; when it is determined that the erroneous operating data exists in the multiple operating data, an alarm is issued according to the target alarm method, and the erroneous operating data is automatically corrected using the redundant check code.

6. The memory management method according to claim 5, characterized in that: The method also includes: determining the running process corresponding to the running data whose storage frequency is greater than the preset frequency threshold as a commonly used running process; when receiving an access request for the commonly used running process, determining multiple access data corresponding to the access request; sorting the multiple access data from high to low according to the access frequency corresponding to each access data in the multiple access data; loading target access data in a preset sequence interval among the sorted multiple access data into a memory buffer; and when receiving an access request for the target access data, loading the target access data from the memory buffer.

7. A memory management system, characterized in that: The system includes: an acquisition module, which is used to acquire the storage frequency of target running data, the memory size occupied by the target running data and the total CPU memory of the computer CPU when receiving memory requests from N running processes in the computer CPU, wherein N is an integer greater than or equal to 1, and the target running data is any one of the multiple running data corresponding to the first target running process, and the first target running process is any one of the N running processes, wherein the storage frequency refers to the rate of reading or writing data from the main memory (RAM); a determination module, which is used to determine the target memory allocation strategy according to the memory size and the memory size segmentation interval when it is determined that the storage frequency is greater than a preset frequency threshold, wherein the memory size segmentation interval includes multiple memory size intervals, each memory size interval corresponds to a memory allocation strategy, and different memory size intervals correspond to different memory allocation strategies; an estimation module, which uses regression analysis to calculate the target memory allocation strategy. The algorithm estimates the CPU memory consumption corresponding to the N running processes in the computer CPU, the regression analysis algorithm is pre-trained based on PLS and historical CPU memory consumption, the CPU memory consumption refers to the memory size of each running process, that is, the memory occupancy, including the current memory usage, the allocated memory size and the memory release status; the allocation module is used to allocate the total CPU memory to each of the N running processes according to the CPU memory consumption and the target memory allocation strategy; wherein the allocation module includes: a grouping submodule, which is used to group based on the historical load corresponding to each running process and the CPU memory consumption; an allocation granularity determination submodule, which is used to determine the CPU memory allocation granularity corresponding to each running process based on the grouping result after grouping; a CPU memory allocation submodule, which is used to allocate the total CPU memory to each running process according to the memory allocation strategy and the CPU memory allocation granularity.

8. A desktop computer, characterized in that: The method comprises a memory, a processor and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps of the memory management method according to any one of claims 1 to 6 when executing the computer program.

9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the memory management method according to any one of claims 1 to 6 are implemented.

Citation Information

Patent Citations

  • Memory allocation method and device, electronic equipment, storage medium and product

    CN115269190A