A memory dynamic management method, device, equipment and storage medium
By dynamically managing memory regions, the problems of low efficiency and deadlock in shared memory under multithreaded programming are solved, and memory utilization is optimized.
Patent Information
- Application Number
- CN202210417021.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-20
- Publication Date
- 2026-02-03
- Estimated Expiration
- 2042-04-20
AI Technical Summary
In multithreaded programming, traditional data transfer methods using shared memory are inefficient, prone to deadlocks, and have low memory utilization efficiency.
Create a corresponding number of memory regions based on the number of tasks, allocate memory according to preset memory values, obtain memory usage values cyclically at preset intervals, determine whether they are within the valid range, and dynamically manage memory regions through a validity coefficient.
It improves memory utilization efficiency, avoids deadlock, and achieves optimal memory usage in multitasking scenarios.
Smart Images

Figure CN114706686B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] Embodiments of the present application relate to data processing technology, and particularly relate to a memory dynamic management method, device, equipment and storage medium. BACKGROUND
[0002] In a computer system, memory is one of the most important resources. Its capacity directly affects the overall performance of the system. Assuming that multiple services need to be performed at the same time, one service is responsible for producing data, and the remaining services consume data, since there are multiple services consuming data, a buffer needs to be created, which is also called shared memory.
[0003] In multi-thread programming, the traditional data sharing method is to read and write data on a block of memory by using a locking method to allow multiple services to read and write data on the block of memory. The reading position of each thread is different, and the writing position needs to be in front of the reading position. When the buffer is full, the number of rounds needs to be recorded and compared with the number of reading rounds. However, after the number of services increases, the method of sharing a block of memory is not efficient, is prone to deadlocks, and the use efficiency of the memory cannot be optimized. SUMMARY
[0004] The present application provides a memory dynamic management method, device, equipment and storage medium to dynamically monitor the memory usage of each task, dynamically manage the memory, and optimize the use efficiency of the memory.
[0005] In a first aspect, the embodiments of the present application provide a memory dynamic management method, comprising:
[0006] According to the number of preset tasks, a corresponding number of memory areas are created, and each memory area is allocated memory according to a preset memory value;
[0007] At intervals of a preset time, the used memory value of each memory area is cyclically obtained;
[0008] It is judged whether the used memory value is within a preset effective range, and if not, the memory of the memory area is dynamically managed according to the used memory value of the memory area and an effective coefficient.
[0009] Optionally, before the used memory value of each memory area is obtained, it further comprises:
[0010] A monitoring thread is created to monitor the used memory value of each memory area.
[0011] Optionally, the preset effective range is determined by the preset memory value and an effective threshold value, the minimum value of the preset effective range is the product of the preset memory value and the minimum value of the effective range, and the maximum value of the preset effective range is the product of the preset memory value and the maximum value of the effective range.
[0012] Optionally, the dynamic management of the memory region based on the used memory value and the effective coefficient of the memory region includes:
[0013] The newly allocated memory value is calculated based on the used memory value of the memory region and the minimum value of the effective range;
[0014] The memory of the corresponding memory region is reallocated based on the newly allocated memory value.
[0015] Optionally, the step of dynamically managing the memory value of the memory region based on the used memory value and the effective coefficient of the memory region further includes:
[0016] The memory in the memory region is reallocated according to the preset task priority order.
[0017] Optionally, a dynamic memory management method also includes:
[0018] Reclaim the memory space corresponding to the preset tasks that have been completed.
[0019] Secondly, embodiments of the present invention also provide a memory dynamic management device, comprising:
[0020] The initial memory allocation module is used to create a corresponding number of memory regions according to the number of preset tasks, and allocate memory to each memory region according to the preset memory value.
[0021] The memory dynamic monitoring module is used to cyclically acquire the used memory value of each memory region at preset time intervals.
[0022] The memory usage determination module is used to determine whether the used memory value is within a preset valid range;
[0023] The dynamic management module is used to dynamically manage the memory value of the memory region based on the used memory value and the effective coefficient of the memory region.
[0024] Thirdly, embodiments of the present invention also provide a dynamic memory management device, the dynamic memory management device comprising:
[0025] One or more processors;
[0026] Storage device for storing one or more programs.
[0027] When the one or more programs are executed by the one or more processors, the one or more processors implement the memory dynamic management method as described in any of the first aspects.
[0028] Thirdly, embodiments of the present invention also provide a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the memory dynamic management method as described in any of the first aspects.
[0029] This invention provides a dynamic memory management method, comprising: creating a corresponding number of memory regions based on the number of preset tasks; allocating memory to each memory region according to a preset memory value; cyclically acquiring the used memory value of each memory region at preset time intervals; determining whether the used memory value is within a preset valid range; and dynamically managing the memory of the memory regions based on the used memory value and a valid coefficient. This addresses the problem of low efficiency and deadlocks when sharing memory with a large number of tasks, thereby improving memory utilization efficiency. In multi-tasking scenarios, dynamic memory management optimizes memory utilization and avoids deadlocks. Attached Figure Description
[0030] Figure 1 This is a flowchart illustrating a dynamic memory management method provided in Embodiment 1 of the present invention;
[0031] Figure 2 This is a schematic diagram of the structure of a memory dynamic management device provided in an embodiment of the present invention;
[0032] Figure 3 This is a schematic diagram of the structure of a memory dynamic management device provided in Embodiment 3 of the present invention. Detailed Implementation
[0033] The present invention will now be described in further detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and not intended to limit it. Furthermore, it should be noted that, for ease of description, the accompanying drawings show only the parts relevant to the present invention, and not all of the structures.
[0034] Example 1
[0035] Figure 1 This is a flowchart illustrating a dynamic memory management method provided in Embodiment 1 of the present invention. This embodiment is applicable to situations where multiple tasks need to use shared memory, and the method can be executed by a dynamic memory management device.
[0036] As shown in the figure, a dynamic memory management method specifically includes the following steps:
[0037] Step 110: Create a corresponding number of memory regions according to the number of preset tasks, and allocate memory to each memory region according to the preset memory value.
[0038] When multiple tasks need to use data generated by the same business process, i.e., when shared memory is required, a corresponding number of memory regions are created based on the number of preset tasks. Memory is allocated to each of these memory regions according to a preset memory value, and the generated data is cached in the memory regions corresponding to each preset task. Each task only needs to retrieve data from its own corresponding memory region without needing to interact with other modules, thus improving the speed and accuracy of data retrieval and caching for each task. When creating the memory region corresponding to each preset task, memory is allocated to each region according to a preset memory value, initially allocating the same amount of memory. In practical applications, considering that actual embedded memory space is limited, MEM_CONSUMERS_MAX is used to limit the size of the shared memory.
[0039] Furthermore, after a memory region is allocated a preset memory, there is a certain difference between the actual allocated memory and the allocated memory. The actual allocated memory (MemTotal) is determined by the preset memory value and a preset valid range, NiceRange(nice_min, nice_max), where nice_min and nice_max are decimals greater than 0 and less than 1. The preset valid range is determined by the preset memory value and a valid threshold. The minimum value of the preset valid range is the product of the preset memory value and the minimum value of the valid range, and the maximum value of the preset valid range is the product of the preset memory value and the maximum value of the valid range. Therefore, the minimum value of a memory allocation's preset valid range is NiceMin = MemTotal * nice_min; the maximum value of a memory allocation's preset valid range is NiceMax = MemTotal * nice_max.
[0040] Step 120: At preset time intervals, repeatedly obtain the used memory value of each memory region.
[0041] Each task's execution is significantly affected by other factors, and the speed of memory access may vary. The memory usage of each task's corresponding memory region differs at different times. Therefore, to dynamically manage each memory region and achieve optimal memory utilization, the used memory value of each memory region is retrieved cyclically at preset time intervals. The preset time interval is a unit of time, such as 1 second.
[0042] Prior to step 120, the process also includes: creating a monitoring thread to monitor the used memory value of each of the memory regions.
[0043] Create a monitoring thread to monitor the used memory value of each memory region, specifically to monitor the memory data used and the remaining memory size of the memory region corresponding to each task within a unit of time.
[0044] Step 130: Determine whether the used memory value is within a preset valid range.
[0045] The amount of cached data required for each task may not be the same, and the amount of memory used in the memory area corresponding to different tasks may also be different. Some tasks use less memory and the initially allocated memory is not fully utilized, while some tasks use more memory and the initially allocated memory may not be enough. In order to improve memory usage efficiency, it is necessary to determine the memory usage of each task.
[0046] The determination of whether the used memory value is within a preset valid range includes determining whether the used memory value is greater than the maximum value of the valid range and determining whether the used memory value is less than the minimum value of the valid range.
[0047] When the used memory value (MemUsed) of a task's memory region is consistently less than the minimum effective range value (NiceMin), it indicates that the task has a relatively large amount of memory remaining, and the currently allocated memory can be appropriately reduced. When the used memory value (MemUsed) of a task's memory region is consistently greater than the maximum effective range value (NiceMax), it indicates that the task has a relatively small amount of memory remaining, and the currently allocated memory can be appropriately increased. When the used memory value of a task's memory region is between the minimum and maximum effective range values, it indicates that the memory usage of the task is normal and no adjustment is needed. In this case, return to step 120.
[0048] Step 140: Dynamically manage the memory of the memory region based on the used memory value and effective coefficient of the memory region.
[0049] Based on the used memory value of the memory region, reduce the region with more remaining memory and increase the region with less remaining memory.
[0050] Step 140 includes:
[0051] Step 141: Calculate the newly allocated memory value based on the used memory value of the memory region and the minimum value of the effective range.
[0052] Step 142: Reallocate memory in the corresponding memory region according to the newly allocated memory value.
[0053] The formula for calculating the newly allocated memory value (NewMem) is: NewMem = MemUsed / nice_min, which is calculated by dividing the used memory value by the minimum effective range, ensuring that the used memory value is within the effective range of the reallocated memory value.
[0054] Furthermore, after memory is reallocated, the monitoring thread continues to monitor the memory usage of the memory regions corresponding to each task, and adjusts the memory allocation in a loop according to the memory usage, thereby achieving the effect of dynamic memory allocation.
[0055] For example, three preset tasks correspond to three memory regions, each allocated a preset memory value, such as 200M for each region, with an effective range of NiceRange(0.8, 0.9) and a preset effective range of [160, 180]. Q1, Q2, and Q3 represent the memory allocation of the three tasks. After running for a period of time t1, the first task's memory Q1 only uses 100M, leaving 100M of memory. Since the used memory is less than the minimum value of the preset effective range, memory allocation can be reduced, with a new allocated memory value NewMem = 100 / 0.8 = 125. The second task's memory Q2 uses 200M, leaving no memory. Since the used memory is greater than the maximum value of the preset effective range, memory allocation needs to be increased, with a new allocated memory value NewMem = 200 / 0.8 = 250. The third task's memory Q3 uses 170M, which is within the preset effective range, and no memory adjustment is needed. After adjustment, the effective range of memory Q1 for the first task is [125*0.8, 125*0.9], which is [100, 112]; the effective range of memory Q2 for the second task is [250*0.8, 250*0.9], which is [200, 225]. After time t2, the actual memory usage of Q1 for the first task is 115M, exceeding the effective range, requiring additional memory. The newly allocated memory value NewMem = 115 / 0.8 = 143; the actual memory usage of Q2 for the second task is 210M, within the effective range, and tending to stabilize, requiring no further adjustment; Q3 remains stable and requires no adjustment. After two memory adjustments, the memory allocation of the memory regions for the second and third tasks tends to stabilize. Continued monitoring and adjustment of the memory allocation for the first task's memory region are still needed. After memory reallocation, the monitoring thread continues to monitor memory usage, running in a loop to achieve dynamic memory allocation and optimize memory utilization.
[0056] Furthermore, step 142 also includes: reallocating the memory of the memory region according to the priority order of preset tasks.
[0057] The priorities of each task may differ. Priority order can be set for each task. According to real-time requirements, memory can be dynamically managed first for high-priority tasks to meet the memory allocation needs of urgent tasks and improve the efficiency of task execution.
[0058] Furthermore, it also includes: reclaiming the memory space corresponding to the preset tasks that have been completed.
[0059] In embedded systems, multiple tasks do not necessarily exist simultaneously. When a task needs data from the producer, shared memory can be dynamically created. When it is no longer needed, the shared memory can also be dynamically released, so that the system's memory space can be used efficiently.
[0060] When a task has been completed, it can be dynamically destroyed to prevent it from consuming too much memory, and the corresponding memory space can be reclaimed and dynamically allocated to improve memory usage efficiency.
[0061] The technical solution of this embodiment provides a dynamic memory management method, including: creating a corresponding number of memory regions based on the number of preset tasks; allocating memory to each memory region according to a preset memory value; cyclically acquiring the used memory value of each memory region at preset time intervals; determining whether the used memory value is within a preset valid range; and dynamically managing the memory of the memory regions based on the used memory value and a valid coefficient. By cyclically acquiring the used memory value of each task and comparing it with the preset valid range, the memory corresponding to tasks with more remaining memory is reduced, while the memory corresponding to tasks with less or insufficient remaining memory is increased. This ensures that each task has adequate memory during execution, addressing the problem of low efficiency and potential deadlocks when sharing memory when there are many tasks. Dynamic management based on the memory usage value of each task at different times improves memory utilization efficiency. In multi-tasking scenarios, dynamic memory management optimizes memory utilization and avoids deadlocks.
[0062] Example 2
[0063] Figure 2 This is a schematic diagram of the structure of a memory dynamic management device provided in an embodiment of the present invention.
[0064] like Figure 2 As shown, a memory dynamic management device includes:
[0065] The initial memory allocation module 210 is used to create a corresponding number of memory regions according to the number of preset tasks, and allocate memory to each memory region according to the preset memory value.
[0066] When multiple tasks need to use data generated by the same business process, i.e., when shared memory is required, a corresponding number of memory regions are created based on the number of preset tasks. Memory is allocated to each of these memory regions according to a preset memory value, and the generated data is cached in the memory regions corresponding to each preset task. Each task only needs to retrieve data from its own corresponding memory region without needing to interact with other modules, thus improving the speed and accuracy of data retrieval and caching for each task. When creating the memory region corresponding to each preset task, memory is allocated to each region according to a preset memory value, initially allocating the same amount of memory. In practical applications, considering that actual embedded memory space is limited, MEM_CONSUMERS_MAX is used to limit the size of the shared memory.
[0067] Furthermore, after a memory region is allocated a preset memory, there is a certain difference between the actual allocated memory and the allocated memory. The actual allocated memory (MemTotal) is determined by the preset memory value and a preset valid range, NiceRange(nice_min, nice_max), where nice_min and nice_max are decimals greater than 0 and less than 1. The preset valid range is determined by the preset memory value and a valid threshold. The minimum value of the preset valid range is the product of the preset memory value and the minimum value of the valid range, and the maximum value of the preset valid range is the product of the preset memory value and the maximum value of the valid range. Therefore, the minimum value of a memory allocation's preset valid range is NiceMin = MemTotal * nice_min; the maximum value of a memory allocation's preset valid range is NiceMax = MemTotal * nice_max.
[0068] The memory dynamic monitoring module 220 is used to cyclically acquire the used memory value of each memory region at preset time intervals.
[0069] Each task's execution is significantly affected by other factors, and the speed of memory access may vary. The memory usage of each task's corresponding memory region differs at different times. Therefore, to dynamically manage each memory region and achieve optimal memory utilization, the used memory value of each memory region is retrieved cyclically at preset time intervals. The preset time interval is a unit of time, such as 1 second.
[0070] Optionally, a memory dynamic management device may further include: a thread creation monitoring module;
[0071] The monitoring thread creation module is used to create monitoring threads to monitor the used memory value of each of the memory regions.
[0072] Create a monitoring thread to monitor the used memory value of each memory region, specifically to monitor the memory data used and the remaining memory size of the memory region corresponding to each task within a unit of time.
[0073] The memory usage determination module 230 is used to determine whether the used memory value is within a preset valid range.
[0074] The amount of cached data required for each task may not be the same, and the amount of memory used in the memory area corresponding to different tasks may also be different. Some tasks use less memory and the initially allocated memory is not fully utilized, while some tasks use more memory and the initially allocated memory may not be enough. In order to improve memory usage efficiency, it is necessary to determine the memory usage of each task.
[0075] The determination of whether the used memory value is within a preset valid range includes determining whether the used memory value is greater than the maximum value of the valid range and determining whether the used memory value is less than the minimum value of the valid range.
[0076] The dynamic management module 240 is used to dynamically manage the memory value of the memory region based on the used memory value and the effective coefficient of the memory region.
[0077] Based on the used memory value of the memory region, reduce the memory value of tasks with more remaining memory and increase the memory value of tasks with less remaining memory.
[0078] Dynamic management module 240 includes:
[0079] The newly allocated memory value calculation unit is used to calculate the newly allocated memory value based on the used memory value of the memory region and the minimum value of the effective range.
[0080] The memory management unit is used to reallocate memory in the corresponding memory region according to the newly allocated memory value.
[0081] The formula for calculating the newly allocated memory value (NewMem) is: NewMem = MemUsed / nice_min, which is calculated by dividing the used memory value by the minimum effective range, ensuring that the used memory value is within the effective range of the reallocated memory value.
[0082] After memory is reallocated, the monitoring thread continues to monitor the memory usage of the memory regions corresponding to each task, and adjusts the memory allocation in a loop according to the memory usage, thereby achieving the effect of dynamic memory allocation.
[0083] Optionally, the memory management unit includes a sequential management subunit, used to reallocate the memory of the memory region according to the priority order of preset tasks.
[0084] The priorities of each task may differ. Priority order can be set for each task. According to real-time requirements, memory can be dynamically managed first for high-priority tasks to meet the memory allocation needs of urgent tasks and improve the efficiency of task execution.
[0085] Optionally, the memory dynamic management device may also include: a reclamation and allocation module;
[0086] The recycling and allocation module is used to reclaim the memory space corresponding to the preset tasks that have been completed.
[0087] When a task has been completed, it can be dynamically destroyed to prevent it from consuming too much memory, and the corresponding memory space can be reclaimed and dynamically allocated to improve memory usage efficiency.
[0088] The technical solution of this embodiment provides a dynamic memory management method, including: creating a corresponding number of memory regions based on the number of preset tasks; allocating memory to each memory region according to a preset memory value; cyclically acquiring the used memory value of each memory region at preset time intervals; determining whether the used memory value is within a preset valid range; and dynamically managing the memory of the memory regions based on the used memory value and a valid coefficient. By cyclically acquiring the used memory value of each task and comparing it with the preset valid range, the memory corresponding to tasks with more remaining memory is reduced, while the memory corresponding to tasks with less or insufficient remaining memory is increased. This ensures that each task has adequate memory during execution, addressing the problem of low efficiency and potential deadlocks when sharing memory when there are many tasks. Dynamic management based on the memory usage value of each task at different times improves memory utilization efficiency. In multi-tasking scenarios, dynamic memory management optimizes memory utilization and avoids deadlocks.
[0089] The memory dynamic management device provided in the embodiments of the present invention can execute the memory dynamic management method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the method execution.
[0090] Example 3
[0091] Figure 3 This is a schematic diagram of the structure of a memory dynamic management device provided in Embodiment 3 of the present invention, as shown below. Figure 3 As shown, the memory dynamic management device includes a processor 30, a memory 31, an input device 32, and an output device 33; the number of processors 30 in the memory dynamic management device can be one or more. Figure 3 Taking a processor 30 as an example; the processor 30, memory 31, input device 32, and output device 33 in the memory dynamic management device can be connected via a bus or other means. Figure 3 Taking the example of a connection between China and Israel via a bus.
[0092] The memory 31, as a computer-readable storage medium, can be used to store software programs, computer-executable programs, and modules, such as the program instructions / modules corresponding to the memory dynamic management method in this embodiment of the invention (e.g., the memory initial allocation module 210, memory dynamic monitoring module 220, memory usage judgment module 230, and dynamic management module 240 in the memory dynamic management device). The processor 30 executes various functional applications and data processing of the memory dynamic management device by running the software programs, instructions, and modules stored in the memory 31, thereby implementing the aforementioned memory dynamic management method.
[0093] The memory 31 may primarily include a program storage area and a data storage area. The program storage area may store the operating system and at least one application program required for a given function; the data storage area may store data created based on terminal usage. Furthermore, the memory 31 may include high-speed random access memory and non-volatile memory, such as at least one disk storage device, flash memory, or other non-volatile solid-state storage device. In some instances, the memory 31 may further include memory remotely located relative to the processor 30, which can be connected to a memory dynamic management device via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0094] Input device 32 can be used to receive input digital or character information, and to generate key signal inputs related to user settings and function control of the memory dynamic management device. Output device 33 may include display devices such as a display screen.
[0095] Example 4
[0096] Embodiment 4 of the present invention also provides a storage medium containing computer-executable instructions, which, when executed by a computer processor, are used to perform a dynamic memory management method, the method comprising:
[0097] Create a corresponding number of memory regions based on the number of preset tasks, and allocate memory to each memory region according to the preset memory value;
[0098] At preset time intervals, the used memory value of each memory region is obtained cyclically.
[0099] Determine whether the value of the used memory is within a preset valid range;
[0100] The memory of the memory region is dynamically managed based on the used memory value and the effective coefficient of the memory region.
[0101] Of course, the computer-executable instructions provided in the embodiments of the present invention are not limited to the method operations described above, but can also perform related operations in the memory dynamic management method provided in any embodiment of the present invention.
[0102] Based on the above description of the implementation methods, those skilled in the art can clearly understand that the present invention can be implemented using software and necessary general-purpose hardware, and of course, it can also be implemented using hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, read-only memory (ROM), random access memory (RAM), flash memory, hard disk, or optical disk, etc., including several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0103] It is worth noting that in the embodiments of the above-mentioned dynamic memory management device, the various units and modules included are only divided according to functional logic, but are not limited to the above division, as long as the corresponding functions can be achieved; in addition, the specific names of each functional unit are only for easy differentiation and are not used to limit the scope of protection of the present invention.
[0104] Note that the above description is merely a preferred embodiment of the present invention and the technical principles employed. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and various obvious changes, readjustments, and substitutions can be made without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in detail through the above embodiments, the present invention is not limited to the above embodiments, and may include many other equivalent embodiments without departing from the concept of the present invention, the scope of which is determined by the scope of the appended claims.
Claims
1. A dynamic memory management method, characterized in that, include: Create a corresponding number of memory regions based on the number of preset tasks, and allocate memory to each memory region according to the preset memory value; Create a monitoring thread to monitor the used memory value of each of the aforementioned memory regions; At preset time intervals, the used memory value of each memory region is obtained cyclically. Determine whether the value of the used memory is within a preset valid range; The memory value of the memory region is dynamically managed based on the used memory value and the effective coefficient of the memory region; The preset effective range is determined by the preset memory value and the effective threshold. The minimum value of the preset effective range is the product of the preset memory value and the minimum value of the effective range. The maximum value of the preset effective range is the product of the preset memory value and the maximum value of the effective range. The dynamic management of the memory value of the memory region based on the used memory value and the effective coefficient of the memory region includes: The newly allocated memory value is calculated based on the used memory value of the memory region and the minimum value of the effective range; The memory of the corresponding memory region is reallocated according to the newly allocated memory value; The dynamic management of the memory value of the memory region based on the used memory value and the effective coefficient of the memory region further includes: The memory in the memory region is reallocated according to the preset task priority order; The preset tasks are multiple parallel tasks that need to share the same business data.
2. The memory dynamic management method according to claim 1, characterized in that, Also includes: Reclaim the memory space corresponding to the preset tasks that have been completed.
3. A memory dynamic management device, characterized in that, include: The initial memory allocation module is used to create a corresponding number of memory regions according to the number of preset tasks, and allocate memory to each memory region according to the preset memory value. The memory dynamic monitoring module is used to create monitoring threads to monitor the used memory value of each memory region. At preset time intervals, the used memory value of each memory region is obtained cyclically. The memory usage determination module is used to determine whether the used memory value is within a preset valid range; The dynamic management module is used to dynamically manage the memory value of the memory region based on the used memory value and the effective coefficient of the memory region. The preset effective range is determined by the preset memory value and the effective threshold. The minimum value of the preset effective range is the product of the preset memory value and the minimum value of the effective range. The maximum value of the preset effective range is the product of the preset memory value and the maximum value of the effective range. The dynamic management of the memory value of the memory region based on the used memory value and the effective coefficient of the memory region includes: The newly allocated memory value is calculated based on the used memory value of the memory region and the minimum value of the effective range; The memory of the corresponding memory region is reallocated according to the newly allocated memory value; The dynamic management of the memory value of the memory region based on the used memory value and the effective coefficient of the memory region further includes: The memory in the memory region is reallocated according to the preset task priority order; The preset tasks are multiple parallel tasks that need to share the same business data.
4. A memory dynamic management device, characterized in that, The memory dynamic management device includes: One or more processors; Storage device for storing one or more programs. When the one or more programs are executed by the one or more processors, the one or more processors implement the memory dynamic management method as described in any one of claims 1-2.
5. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the dynamic memory management method as described in any one of claims 1-2.
Citation Information
Patent Citations
Memory control method for embedded systems
CN102915276A
Method and system for dynamically adjusting virtual-machine memory in cloud computing environment
CN103605613A
Linux system memory allocation method, system and device and storage medium
CN108920276A