CN112380017B - Memory management system based on loose memory release - Google Patents

Memory management system based on loose memory release Download PDF

Info

Publication number
CN112380017B
CN112380017B CN202011373302.5A CN202011373302A CN112380017B CN 112380017 B CN112380017 B CN 112380017B CN 202011373302 A CN202011373302 A CN 202011373302A CN 112380017 B CN112380017 B CN 112380017B
Authority
CN
China
Prior art keywords
memory
allocator
task
module
distributor
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202011373302.5A
Other languages
Chinese (zh)
Other versions
CN112380017A (en
Inventor
况忠强
王汉瑛
吴生勇
谢旭东
苏德财
李尤兵
曹茜
冯治龙
明玉琢
李文彬
许雄基
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Chengdu Xugu Weiye Technology Co ltd
Original Assignee
Chengdu Xugu Weiye Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Chengdu Xugu Weiye Technology Co ltd filed Critical Chengdu Xugu Weiye Technology Co ltd
Priority to CN202011373302.5A priority Critical patent/CN112380017B/en
Publication of CN112380017A publication Critical patent/CN112380017A/en
Application granted granted Critical
Publication of CN112380017B publication Critical patent/CN112380017B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5016Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals the resource being the memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/50Allocation of resources, e.g. of the central processing unit [CPU]
    • G06F9/5005Allocation of resources, e.g. of the central processing unit [CPU] to service a request
    • G06F9/5011Allocation of resources, e.g. of the central processing unit [CPU] to service a request the resources being hardware resources other than CPUs, Servers and Terminals
    • G06F9/5022Mechanisms to release resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System (AREA)

Abstract

The invention discloses a memory management system based on loose memory release, which comprises an interface module, a memory allocation module and a memory allocation module, wherein the interface module is used for uniformly formulating interface standards and calling memory allocation functions; the memory allocation module is used for creating a temporary memory allocator and allocating memory from the appointed memory allocator according to task execution requirements; the thread binding module is used for binding the thread and the memory distributor before executing the task and designating the memory distributor to execute the task; the memory release module is used for releasing the temporary memory distributor after the task execution is completed and restoring the current memory distributor of the thread; and the memory separation module is used for separating memory areas with different purposes. The invention designs the unified interface to enable each task and subtask to have private memory allocation context, centralizes the private memory of each task, performs loose processing on task memory allocation and release, reduces the mutual interference in the execution process of each concurrent task, and improves the multiplexing efficiency of the system memory.

Description

Memory management system based on loose memory release
Technical Field
The invention relates to the field of computer memory management, in particular to a memory management system based on loose memory release.
Background
The current memory pool management method results in a relatively large period of memory allocation and release, thus increasing the load of the processor and limiting the users that each baseband board can handle. The current general chain memory pool management method mainly adopts the following mechanism: and respectively hanging the idle blocks into different idle queues according to different sizes. The operation of the idle memory block linked list needs to be protected by a mutual exclusion lock so as to solve the problem of the consistency of the linked list in a multi-task environment. In memory pool management, the concept of object mutex lock is introduced to ensure the integrity of memory resource operations. At any one time, only one task can access the memory pool, while other tasks cannot allocate and release the memory pool. The use of mutual exclusion locks is itself a time consuming operation and increases the inter-task coupling. This greatly increases the time consuming allocation and release of memory blocks, and the uncertainty in time consuming is greatly increased, resulting in inefficient memory reuse. The phenomenon of scattered system memory images is easy to cause after the system operates for a long time, the fault tolerance rate of short memory access errors is low, the memory release is not strict enough, and the phenomenon of memory leakage is also easy to occur.
Disclosure of Invention
The invention aims to overcome the defects of the prior art and provides a memory management system based on loose memory release.
The aim of the invention is realized by the following technical scheme:
a memory management system based on loose memory release comprises an interface module, a memory allocation module, a thread binding module, a memory release module and a memory separation module. The interface module is used for uniformly making interface standards and calling a memory allocation function; the memory allocation module is used for creating a temporary memory allocator and allocating memory from the appointed memory allocator according to task execution requirements; the thread binding module is used for binding the thread and the memory distributor before executing the task and designating the memory distributor to execute the task; the memory release module is used for releasing the temporary memory distributor after the task execution is completed and restoring the current memory distributor of the thread; the memory separation module is used for separating memory areas with different purposes, and the maintenance system operates for a long time.
Specifically, the interface module includes a distribution function interface, a reassignment function interface, a release function interface, a function interface for initializing the distributor, and a clear distributor function interface.
Specifically, the temporary memory allocator includes an upper memory allocator, a BIN memory allocator, a stacked memory allocator, and a concatenated memory allocator; the upper memory allocator is used for representing father type memory of the whole memory management system, allocating larger memory areas from the operating system, and then delivering the allocated larger memory areas to other allocators for memory allocation; the BIN memory distributor is used for distributing smaller memory areas; the stacked memory allocator is used for automatically selecting the position of the allocated memory area according to the memory size required by the user; the tandem memory allocator is used for fusing the small memory area into the large memory area.
Specifically, the memory area includes a dictionary memory area, a session memory area, a lock resource memory area, and a task memory area.
The invention has the beneficial effects that:
1. the system of the invention has the self-description functions of whether to quote, whether to own the intrinsic block, whether to object, whether to own the memory size, whether the data is real and has scale, etc.;
2. the dynamic memory expansion capability is provided, so that the task is allowed to carry out loose processing on memory allocation and release, and the mutual interference between memory application and release operation in the execution process of each concurrent task is reduced;
3. the memory multiplexing capability is provided, the memory consumption can be adaptively and dynamically applied and adjusted, and the cost of dynamically applied memory is greatly reduced.
Drawings
Fig. 1 is a functional block diagram of a system of the present invention.
Detailed Description
For a clearer understanding of technical features, objects, and effects of the present invention, a specific embodiment of the present invention will be described with reference to the accompanying drawings.
In this embodiment, as shown in fig. 1, a memory management system based on loose memory release includes an interface module, a memory allocation module, a thread binding module, a memory release module, and a memory separation module. The interface module is used for uniformly making interface standards and calling a memory allocation function; the memory allocation module is used for creating a temporary memory allocator and allocating memory from the appointed memory allocator according to task execution requirements; the thread binding module is used for binding the thread and the memory distributor before executing the task and designating the memory distributor to execute the task; the memory release module is used for releasing the temporary memory distributor after the task execution is completed and restoring the current memory distributor of the thread; the memory separation module is used for separating memory areas with different purposes, and the maintenance system operates for a long time.
Wherein, when the memory allocator binds with the thread, the function: memcontext_mem_context (); and the memory allocator is used for taking out the memory allocator bound on the current thread structure from the current thread structure.
Function: and the device is used for setting a memory allocator into the current thread structure to be bound with the current thread.
Binding memory allocators to threads allows a current thread to allocate memory from an internal allocator bound to the current thread when the current thread is performing local memory allocation, if it is not specified from which memory allocator to allocate memory.
Specifically, the interface module includes an allocation function interface, a reassignment function interface, a release function interface, a function interface for initializing the allocator, and a clear allocator function interface.
Specifically, the temporary memory allocator includes an upper level memory allocator, a BIN memory allocator, a stacked memory allocator, and a concatenated memory allocator. The upper memory allocator is used to represent the father type memory of the whole memory management system, the function is to allocate larger memory area from the operating system, then allocate by other allocators, the memory allocated from the father type memory is called the subtype. The release of all subtype memories will be given back to the parent type memory.
The BIN memory allocator is used for providing the function of allocating smaller memory areas.
The stacked memory allocator is used to automatically select the position of the allocated memory area according to the memory size required by the user.
The serial memory distributor is used to fuse small memory area into large memory area.
The temporary memory allocator has the following partial implementation codes:
higher memory allocator
struct MemContext *parent;
}MemContext;
a/BIN memory allocator (using heap memory allocation algorithm in type C statement)
typedef struct BinMemContext
{
void *(*__alloc)(struct MemContext *_this,size_t si);
void *(*__realloc)(struct MemContext *_this,void *p_old,size_t si);
void *(*__free)(struct MemContext *_this,void *p);
void *(*__reset)(struct MemContext *_this);
void *(*__clear)(struct MemContext *_this);
struct MemContext *parent;
mutex _mutex;
size_t step;
int max_b_i;
MemHeap table_stub;
MemHeap large_stub;
Chunk bins[127];
}BinMemContext;
typedef struct MemBlk{
struct MemBlk *next;
char mem 4,/. Times.true is variable length:/. Times.
}MemBlk;
Stacked memory allocator (increase to top during memory allocation, ignore during release)/(x)
typedef struct BlkMemContext
{
void *(*__alloc)(struct MemContext *_this,size_t si);
void *(*__realloc)(struct MemContext *_this,void *p_old,size_t si);
void *(*__free)(struct MemContext *_this,void *p);
void *(*__reset)(struct MemContext *_this);
void *(*__clear)(struct MemContext *_this);
struct MemContext *parent;
mutex _mutex;
MemBlk *fir_mem_blk;
MemBlk *last_mem_blk;
int blk_size;
int alloc_count;
}BlkMemContext;
typedef struct MemPice
{
struct MemPice *prev;
struct MemPice *next;
}MemPice;
Serial memory allocator (concatenating allocated memories together for unified release)
typedef struct LinkMemContext
{
void *(*__alloc)(struct MemContext *_this,size_t si);
void *(*__realloc)(struct MemContext *_this,void *p_old,size_t si);
void *(*__free)(struct MemContext *_this,void *p);
void *(*__reset)(struct MemContext *_this);
void *(*__clear)(struct MemContext *_this);
struct MemContext *parent。
Specifically, the memory management subsystem has an important function of: the memory areas with different purposes are separated, the memory areas comprise a dictionary memory area, a session memory area, a lock resource memory area, a task memory area and the like, objects in the memory areas have long life, shorter life and extremely short life, and the separation of the objects is beneficial to the maintenance of the clean and orderly memory view of the system after long-term operation of the system, and meanwhile, the damage of certain error programs to the memory in the task processing process to the whole system is prevented, so that the stability of the system is improved. These memory regions may represent different memory usage scenarios for the user.
In the invention, when the memory use condition of a processing process is complex, a temporary memory distributor can be created and bound with the current thread, and when the process is finished, the temporary memory distributor is released and the current memory distributor of the thread is restored.
Some complex structures may themselves have their own memory allocator to store the members of each level together, and simultaneously, when the release of the structure is complete, the memory occupied by the members is released uniformly.
Each task has its own memory allocator, and before the task is executed, the thread will bind with the memory allocator, and during the execution, all the memory allocations of the unspecified allocator are allocated to the allocator, so that the task function is allowed to release the memory without taking excessive care, and when the task is finished, the used memory will be released together.
Although the private memory allocator can prevent memory leakage, if the dynamic memory is used in a process with a large number of cycles, the dynamic memory is released after the use, otherwise, the memory occupation amount of the memory allocator is increased greatly, so that the memory cannot be allocated.
The foregoing has shown and described the basic principles and main features of the present invention and the advantages of the present invention. It will be understood by those skilled in the art that the present invention is not limited to the embodiments described above, and that the above embodiments and descriptions are merely illustrative of the principles of the present invention, and various changes and modifications may be made without departing from the spirit and scope of the invention, which is defined in the appended claims. The scope of the invention is defined by the appended claims and equivalents thereof.

Claims (3)

1. A memory management system based on loose memory release, comprising
The interface module is used for uniformly formulating interface standards and calling a memory allocation function;
the memory allocation module is used for creating a temporary memory allocator and allocating memory from the appointed memory allocator according to task execution requirements;
the thread binding module is used for binding the thread and the memory distributor before executing the task and designating the memory distributor to execute the task;
the memory release module is used for releasing the temporary memory distributor after the task execution is completed and restoring the current memory distributor of the thread;
the memory separation module is used for separating memory areas with different purposes and maintaining long-term operation of the system;
the temporary memory allocator comprises an upper-level memory allocator, a BIN memory allocator, a stacked memory allocator and a tandem memory allocator;
the upper memory allocator is used for representing father type memory of the whole memory management system, allocating larger memory areas from the operating system, and then delivering the allocated larger memory areas to other allocators for memory allocation;
the BIN memory distributor is used for distributing smaller memory areas;
the stacked memory allocator is used for automatically selecting the position of the allocated memory area according to the memory size required by the user;
the tandem memory allocator is used for fusing the small memory area into the large memory area.
2. The memory management system of claim 1, wherein the interface module comprises an allocation function interface, a reassignment function interface, a release function interface, an initialize allocator function interface, and a clear allocator function interface.
3. The memory management system according to claim 1, wherein the memory area comprises a dictionary memory area, a session memory area, a lock resource memory area, and a task memory area.
CN202011373302.5A 2020-11-30 2020-11-30 Memory management system based on loose memory release Active CN112380017B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011373302.5A CN112380017B (en) 2020-11-30 2020-11-30 Memory management system based on loose memory release

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011373302.5A CN112380017B (en) 2020-11-30 2020-11-30 Memory management system based on loose memory release

Publications (2)

Publication Number Publication Date
CN112380017A CN112380017A (en) 2021-02-19
CN112380017B true CN112380017B (en) 2024-04-09

Family

ID=74587573

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011373302.5A Active CN112380017B (en) 2020-11-30 2020-11-30 Memory management system based on loose memory release

Country Status (1)

Country Link
CN (1) CN112380017B (en)

Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1825286A (en) * 2006-03-31 2006-08-30 浙江大学 Threading realizing and threading state transition method for embedded SRAM operating system
CN101196827A (en) * 2007-12-28 2008-06-11 中国科学院计算技术研究所 Parallel simulator and method
JP2011081610A (en) * 2009-10-07 2011-04-21 Internatl Business Mach Corp <Ibm> Device, method and program for object optimal allocation
CN102508638A (en) * 2011-09-27 2012-06-20 华为技术有限公司 Data pre-fetching method and device for non-uniform memory access
CN104375899A (en) * 2014-11-21 2015-02-25 北京应用物理与计算数学研究所 Thread for high-performance computer NUMA perception and memory resource optimizing method and system
WO2016061935A1 (en) * 2014-10-20 2016-04-28 中兴通讯股份有限公司 Resource scheduling method, device and computer storage medium
CN107678780A (en) * 2017-10-26 2018-02-09 深圳乐信软件技术有限公司 A kind of EMS memory management process, device, storage medium and terminal device
CN110502335A (en) * 2019-06-12 2019-11-26 成都虚谷伟业科技有限公司 Distributed data base multilevel memory managing device
CN111309289A (en) * 2019-11-19 2020-06-19 上海金融期货信息技术有限公司 Memory pool management assembly
WO2020219609A1 (en) * 2019-04-22 2020-10-29 Winterrowd Mark William Hardware enforcement of boundaries on the control, space, time, modularity, reference, initialization, and mutability aspects of software

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7194495B2 (en) * 2002-01-11 2007-03-20 Sun Microsystems, Inc. Non-blocking memory management mechanism for supporting dynamic-sized data structures
WO2004017202A2 (en) * 2002-08-16 2004-02-26 Globespanvirata Incorporated Operating system for executing computer software applications
US9495108B2 (en) * 2014-06-26 2016-11-15 International Business Machines Corporation Transactional memory operations with write-only atomicity
US20170286114A1 (en) * 2016-04-02 2017-10-05 Intel Corporation Processors, methods, and systems to allocate load and store buffers based on instruction type
US11194625B2 (en) * 2018-12-05 2021-12-07 BigStream Solutions, Inc. Systems and methods for accelerating data operations by utilizing native memory management
US20200310985A1 (en) * 2019-03-27 2020-10-01 University Of Rochester Lease cache memory devices and methods

Patent Citations (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1825286A (en) * 2006-03-31 2006-08-30 浙江大学 Threading realizing and threading state transition method for embedded SRAM operating system
CN101196827A (en) * 2007-12-28 2008-06-11 中国科学院计算技术研究所 Parallel simulator and method
JP2011081610A (en) * 2009-10-07 2011-04-21 Internatl Business Mach Corp <Ibm> Device, method and program for object optimal allocation
CN102508638A (en) * 2011-09-27 2012-06-20 华为技术有限公司 Data pre-fetching method and device for non-uniform memory access
WO2016061935A1 (en) * 2014-10-20 2016-04-28 中兴通讯股份有限公司 Resource scheduling method, device and computer storage medium
CN104375899A (en) * 2014-11-21 2015-02-25 北京应用物理与计算数学研究所 Thread for high-performance computer NUMA perception and memory resource optimizing method and system
CN107678780A (en) * 2017-10-26 2018-02-09 深圳乐信软件技术有限公司 A kind of EMS memory management process, device, storage medium and terminal device
WO2020219609A1 (en) * 2019-04-22 2020-10-29 Winterrowd Mark William Hardware enforcement of boundaries on the control, space, time, modularity, reference, initialization, and mutability aspects of software
CN110502335A (en) * 2019-06-12 2019-11-26 成都虚谷伟业科技有限公司 Distributed data base multilevel memory managing device
CN111309289A (en) * 2019-11-19 2020-06-19 上海金融期货信息技术有限公司 Memory pool management assembly

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
云计算弹性资源分配与作业调度策略优化研究;凌晓;《中国优秀博硕士学位论文全文数据库(博士)》(第02期);第1-128页 *
面向非易失内存的数据一致性研究综述;肖仁智等;《计算机研究与发展》;第57卷(第1期);第85-101页 *

Also Published As

Publication number Publication date
CN112380017A (en) 2021-02-19

Similar Documents

Publication Publication Date Title
CN109144710B (en) Resource scheduling method, device and computer readable storage medium
US7844853B2 (en) Methods and apparatus for restoring a node state
US8499010B2 (en) Garbage collection in a multiple virtual machine environment
WO2017070900A1 (en) Method and apparatus for processing task in a multi-core digital signal processing system
TW201112118A (en) Mapping processing logic having data-parallel threads across processors
US10013264B2 (en) Affinity of virtual processor dispatching
JP2007115246A (en) Method and apparatus for dynamically allocating resource used by software
US20090006502A1 (en) Application-Specific Heap Management
US9529625B2 (en) Method and system for providing stack memory management in real-time operating systems
EP3239844A1 (en) Processing method and device for memory page in memory
Zheng et al. Deploying high throughput scientific workflows on container schedulers with makeflow and mesos
CN107368367B (en) Resource allocation processing method and device and electronic equipment
KR20070090649A (en) Apparatus and method for providing cooperative scheduling on multi-core system
US8006064B2 (en) Lock-free vector utilizing a resource allocator for assigning memory exclusively to a thread
JP2021530756A (en) Methods and devices for representing activation frames for poseless garbage collection
CN111104219A (en) Binding method, device, equipment and storage medium of virtual core and physical core
Swenson et al. A new approach to zero-copy message passing with reversible memory allocation in multi-core architectures
Winter et al. Ouroboros: virtualized queues for dynamic memory management on GPUs
CN112380017B (en) Memory management system based on loose memory release
CN103959276A (en) Resource allocation prioritization based on knowledge of user intent and process independence
CN111125070A (en) Data exchange method and platform
CN112230901B (en) Network programming framework system and method based on asynchronous IO model
Kahan et al. " MAMA!" a memory allocator for multithreaded architectures
CN111581041A (en) Method and equipment for testing performance of magnetic disk
TWI381315B (en) Synchronization elements for multi-core embedded systems

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant