CN108038062A - The EMS memory management process and device of embedded system - Google Patents

The EMS memory management process and device of embedded system Download PDF

Info

Publication number
CN108038062A
CN108038062A CN201711201135.4A CN201711201135A CN108038062A CN 108038062 A CN108038062 A CN 108038062A CN 201711201135 A CN201711201135 A CN 201711201135A CN 108038062 A CN108038062 A CN 108038062A
Authority
CN
China
Prior art keywords
memory
page
management
slab
size
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.)
Granted
Application number
CN201711201135.4A
Other languages
Chinese (zh)
Other versions
CN108038062B (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.)
BEIJING JINHONG XIDIAN INFORMATION TECHNOLOGY Co Ltd
Original Assignee
BEIJING JINHONG XIDIAN INFORMATION 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 BEIJING JINHONG XIDIAN INFORMATION TECHNOLOGY Co Ltd filed Critical BEIJING JINHONG XIDIAN INFORMATION TECHNOLOGY Co Ltd
Priority to CN201711201135.4A priority Critical patent/CN108038062B/en
Publication of CN108038062A publication Critical patent/CN108038062A/en
Application granted granted Critical
Publication of CN108038062B publication Critical patent/CN108038062B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory
    • G06F12/0269Incremental or concurrent garbage collection, e.g. in real-time systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/0292User address space allocation, e.g. contiguous or non contiguous base addressing using tables or multilevel address translation means

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Memory System (AREA)

Abstract

Present invention offer a kind of EMS memory management process and device of embedded system, this method, including:Using page as minimum applying unit, the page application received for user management memory field is asked;Asked according to page application, distribute the page of default size;After being formatted to the page of distribution, each page is divided into the identical Memory slice of size;SLAB management structures are created at the beginning of each page, and Memory slice management table is created after SLAB manages structure;Alternatively, applying for that memory block is used to create SLAB management structures in a default caching in user management memory field, and Memory slice management table is created after SLAB manages structure;SLAB management structure is additionally operable to according to Memory slice management table storage allocation piece to application program.The present invention can carry out continually memory application according to application requests, and memory usage is high.

Description

The EMS memory management process and device of embedded system
Technical field
The present invention relates to the EMS memory management process and dress of embedded system technology field, more particularly to a kind of embedded system Put.
Background technology
Embedded system is that one kind is completely embedded into inside controlled device, the special purpose computer system designed for application-specific System, the application field of embedded system is very extensive, and still, the operational capability and storage capacity of embedded system all cannot and be counted Calculation machine is compared.Therefore, efficient, reliable EMS memory management process is must be provided with embedded system, to improve embedded system Memory usage, ensures the stable operation of controlled device.
The EMS memory management process of existing embedded system mainly includes heap mode and memory pool mode, and heap mode is in system One piece of memory is distributed according to application program actual size on heap space, the allocated memory is concatenated with chained list and managed, still It is elongated with system operation time, substantial amounts of memory fragmentation can be produced.Memory pool mode be according to certain particle size from small to large Divide the memory of different brackets size, the certain quantity of the small memory configurations of each grade size, but it is each due to being not easy statistics The small amount of memory of a grade size, can only configure during operation, so as to cause the waste of memory headroom as far as possible.
Existing managing embedded system memory method, it is difficult to meet needs frequently application, the controlled device of releasing memory Service requirement so that the reliability of controlled device reduces, and maintenance cost becomes higher.
The content of the invention
The present invention provides a kind of EMS memory management process and device of embedded system, to meet that needs carry out frequent memory Shen Please, requirement of the controlled device of release to memory management, improves the memory usage and reliability of controlled device.
In a first aspect, the present invention provides a kind of EMS memory management process of embedded system, the thing in embedded system is applied Manage in memory, the physical memory of the embedded system includes:System management ram area and user management memory field, the system Managing internal memory area is managed by the operating system of embedded system, and the user management memory field refers to can be according to application program Carry out the memory field of pre- first to file distribution;
The described method includes:
Using page as minimum applying unit, the page application received for the user management memory field is asked;
Asked according to the page application, distribute the page of default size;
After being formatted to the page of distribution, each page is divided into the identical Memory slice of size;
SLAB management structures are created at the beginning of each page, and Memory slice management is created after SLAB manages structure Table;Alternatively, apply for that memory block is used to create SLAB management knots in a default caching in the user management memory field Structure, and Memory slice management table is created after SLAB manages structure;
Wherein, the SLAB management structure is used for all Memory slices for managing corresponding page division;The Memory slice pipe The address information for all Memory slices that structure is managed is managed in reason table comprising corresponding SLAB, the SLAB management structure is additionally operable to Table storage allocation piece is managed to application program according to Memory slice.
Alternatively, further include:
Receive the memory application request of application program;
According to the memory size of application requests, to Memory slice described in the application assigned.
Alternatively, using page as minimum applying unit, the page application received for the user management memory field is asked Before asking, further include:
Receive the request input by user initialized to user management memory field;
The user management memory field is divided into several memory pages blockettes of different sizes, each memory pages Blockette includes the page of different number of corresponding size, and the size of the page includes:4K、8K、16K、32K、64K、128K;It is described Page safeguarded by the page control table positioned at fixed position, wherein, size is that the quantity of page of 4K can be adjusted into Mobile state.
Alternatively, using page as minimum applying unit, the page application received for the user management memory field is asked Before asking, further include:
Determine that all Memory slices that the SLAB management structure is managed are all occupied.
Alternatively, after each page of application is divided into the identical Memory slice of size, further include:
Classified according to the size of Memory slice to the Memory slice, the identical Memory slice of size is divided into one kind;
According to the requirement of the quantity and size of default Memory slice, Memory slice is divided into multigroup section, is passed through per pack area Caching retrieval chained list is associated with different types of caching.
Alternatively, the memory size according to application requests, to Memory slice described in the application assigned, bag Include:
According to the memory size of application requests, the caching that respective type is found in chained list is retrieved from the caching, and After obtaining Memory slice by the corresponding SLAB chained lists of the caching, the application program is distributed to;Wherein, the caching search chain Table is used for the size for indicating different type caching, and the control structure of instruction different type caching.
Alternatively, when all Memory slices managed in SLAB management structure are in idle condition, further include:
The information of SLAB management structure described in corresponding SLAB chained lists is deleted, and removes the SLAB management structure management All Memory slices correspond to the control item information of page;Wherein, the SLAB chained lists are used to indicate what is created in same class caching The information of all SLAB management structures, the control information item include:CACHE pointers, and SLAB pointers;
The page is put into the head of free page.
Second aspect, the present invention provide a kind of memory management device of embedded system, apply the thing in embedded system Manage in memory, the physical memory of the embedded system includes:System management ram area and user management memory field, the system Managing internal memory area is managed by the operating system of embedded system, and the user management memory field refers to can be according to application program Carry out the memory field of pre- first to file distribution;
Described device includes:
First receiving module, for using page as minimum applying unit, receiving the memory for the user management memory field Page application request;
First distribution module, for being asked according to the page application, distributes the page of default size;
Burst module, after being formatted to the page of distribution, it is identical to be divided into size by each page Memory slice;
Management module, for creating SLAB management structures at the beginning of each page, and after SLAB manages structure Create Memory slice management table;Alternatively, application memory block is used in a default caching in the user management memory field SLAB management structures are created, and Memory slice management table is created after SLAB manages structure;
Wherein, the SLAB management structure is used for all Memory slices for managing corresponding page division;The Memory slice pipe The address information for all Memory slices that structure is managed is managed in reason table comprising corresponding SLAB, the SLAB management structure is additionally operable to Table storage allocation piece is managed to application program according to Memory slice.
Alternatively, further include:
Second receiving module, the memory application for receiving application program are asked;
Second distribution module, for the memory size according to application requests, into described in the application assigned Deposit piece.
Alternatively, further include:
Pagination module, for using page as minimum applying unit, receiving the page for the user management memory field Before application request, the request input by user initialized to user management memory field is received;
User management memory partitioning initialize when, by the user management memory field be divided into several it is of different sizes in Paging partition block is deposited, each memory pages blockette includes the page of different number of corresponding size, and the size of the page includes: 4K、8K、16K、32K、64K、128K;The page safeguarded by the page control table positioned at fixed position, wherein, size 4K The quantity of page can be adjusted into Mobile state.
Alternatively, the first receiving module, is additionally operable to, using page as minimum applying unit, receive in the user management Before the page application request for depositing area, determine that all Memory slices that the SLAB management structure is managed are all occupied With.
Alternatively, management module, is additionally operable to after each page of application is divided into the identical Memory slice of size, Classified according to the size of Memory slice to the Memory slice, the identical Memory slice of size is divided into one kind;
According to the requirement of the quantity and size of default Memory slice, Memory slice is divided into multigroup section, is passed through per pack area Caching retrieval chained list is associated with different types of caching.
Alternatively, the second distribution module, is specifically used for:According to the memory size of application requests, from the caching inspection Find the caching of respective type in rope chain table, and after obtaining Memory slice by the corresponding SLAB chained lists of the caching, distribute to institute State application program;Wherein, the caching retrieval chained list is used for the size for indicating different type caching, and instruction different type is delayed The control structure deposited.
Alternatively, management module, is additionally operable to be in idle condition in all Memory slices that SLAB management structure is managed When, the information of SLAB management structure described in corresponding SLAB chained lists is deleted, and remove all of the SLAB management structure management Memory slice corresponds to the control item information of page;Wherein, the SLAB chained lists are used to indicate to create in same class caching all SLAB manages the information of structure, and the control information item includes:CACHE pointers, and SLAB pointers;
The page is put into the head of free page.
The third aspect, the present invention provide a kind of memory management equipment of embedded system, including:
Memory, for storage program;
Processor, for performing the described program of the memory storage, when described program is performed, the processor For performing any method in first aspect.
Fourth aspect, the present invention provide a kind of computer-readable recording medium, including:Instruction, when it is transported on computers During row so that computer performs any method in first aspect.
The memory management of embedded system provided by the invention and device, pass through the use of the physical memory to embedded system Family managing internal memory area carries out paging, burst processing, and is directed to the user management memory field by minimum applying unit, reception of page Page application request, asked according to the page application, distribute the page of default size.Based on SLAB managers Method, SLAB management structures are created at the beginning of each page, and Memory slice management table is created after SLAB manages structure;Or Person, applies for that memory block is used to create SLAB management structures in a default caching in the user management memory field, and Memory slice management table is created after SLAB manages structure;Structure is managed by SLAB to be given according to Memory slice management table storage allocation piece Application program.Method in the present invention can carry out continually memory application according to application requests, and memory usage is high.
Brief description of the drawings
In order to illustrate more clearly about the embodiment of the present invention or technical scheme of the prior art, below will be to embodiment or existing There is attached drawing needed in technology description to be briefly described, it should be apparent that, drawings in the following description are this hairs Some bright embodiments, for those of ordinary skill in the art, without having to pay creative labor, can be with Other attached drawings are obtained according to these attached drawings.
Fig. 1 is the schematic diagram of the physical memory of vxWorks embedded OSs;
Fig. 2 is the flow chart of the EMS memory management process for the embedded system that the embodiment of the present invention one provides;
Fig. 3 is the flow chart of the EMS memory management process of embedded system provided by Embodiment 2 of the present invention;
Fig. 4 is the flow chart of the EMS memory management process for the embedded system that the embodiment of the present invention three provides;
Fig. 5 is the internal memory initialization flow diagram that the embodiment of the present invention one provides;
Fig. 6 is the flow chart of the EMS memory management process for the embedded system that the embodiment of the present invention four provides;
Fig. 7 is the memory application process schematic diagram that the embodiment of the present invention one provides;
Fig. 8 is the flow chart of the EMS memory management process for the embedded system that the embodiment of the present invention five provides;
Fig. 9 is the structure diagram of the memory management device for the embedded system that the embodiment of the present invention one provides;
Figure 10 is the structure diagram of the memory management device of embedded system provided by Embodiment 2 of the present invention;
Figure 11 is the structure diagram of the memory management device for the embedded system that the embodiment of the present invention three provides;
Figure 12 is the structure diagram of the memory management equipment for the embedded system that the embodiment of the present invention one provides.
Embodiment
To make the purpose, technical scheme and advantage of the embodiment of the present invention clearer, below in conjunction with the embodiment of the present invention In attached drawing, the technical solution in the embodiment of the present invention is clearly and completely described, it is clear that described embodiment is Part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, those of ordinary skill in the art All other embodiments obtained without making creative work, belong to the scope of protection of the invention.
Term " first ", " second ", " the 3rd " " in description and claims of this specification and above-mentioned attached drawing The (if present)s such as four " are for distinguishing similar object, without for describing specific order or precedence.It should manage The data that solution so uses can exchange in the appropriate case, so as to the embodiment of the present invention described herein for example can with except Order beyond those for illustrating or describing herein is implemented.In addition, term " comprising " and " having " and theirs is any Deformation, it is intended that cover it is non-exclusive include, for example, containing the process of series of steps or unit, method, system, production Product or equipment are not necessarily limited to those steps clearly listed or unit, but may include not list clearly or for this The intrinsic other steps of a little process, method, product or equipment or unit.
Technical scheme is described in detail with specifically embodiment below.These specific implementations below Example can be combined with each other, and may be repeated no more for the same or similar concept or process in some embodiments.
Hereinafter, the part term in the application is explained, in order to skilled artisan understands that:
1) vxWorks embedded OSs, refer to that WindRiver companies of the U.S. develop a kind of embedded in nineteen eighty-three Real time operating system, is the key components of embedded-development environment.VxWorks by the kernel of volume very little and some The system module composition that can be customized as needed.
The minimum 8KB of VxWorks kernel.The real-time of VxWorks is done very good, the expense very little of its system in itself, The system utility programs such as process scheduling, interprocess communication, interrupt processing are concise and effective, postpone caused by them very short. Control in the multi-task mechanism that VxWorks provide to task employs priority and seizes (Preemptive Priority Scheduling) and robin scheduling (Round-Robin Scheduling) mechanism, reliable real-time has also been fully ensured that.
2) real time operating system, refers to the function that defined has been performed within the time of restriction, and can be in the time of restriction It is interior to respond to exterior asynchronous event.Real-time System is mainly used in process control, data acquisition, communication, multimedia The occasion to time-sensitive such as information processing.
3)SLAB:It is a kind of Memory Allocation mechanism of (SuSE) Linux OS.Its work is often distributed and released for some The object put, such as process descriptors, the size of these objects is generally smaller, if directly divided using buddy system Match somebody with somebody and discharge, not only result in substantial amounts of memory fragmentation, and processing speed is too slow.And SLAB distributors be based on object into Row management, the object of same type is classified as a kind of (such as process descriptors are exactly one kind), whenever applying for such a object, SLAB distributors just distribute a this level of unit from a SLAB list and go out, and when to be discharged, by it again Preserve in the list, rather than be directly returned to buddy system, so as to avoid these interior fragments.SLAB distributors do not abandon Allocated object, but discharge and they are preserved in memory.When the object that please be look for novelty again later, it is possible to from interior Deposit and directly acquire and initialized without repetition.
The EMS memory management process of embedded system provided by the invention, can apply based on vxWorks embedded operations In system.Fig. 1 is the schematic diagram of the physical memory of vxWorks embedded OSs, as shown in Figure 1, the embedded behaviour of vxWorks The pre- first to file memory field of platform and vxWorks operating system managements memory field can be divided into by making the physical memory of system.Wherein, put down The pre- first to file memory field of platform can be user management, and vxWorks operating system managements memory field is by operating system management.The present invention The EMS memory management process of the embedded system of offer is mainly in the pre- first to file memory field of platform.In existing embedded system Deposit management method, it is difficult to meet needs frequently application, releasing memory controlled device service requirement so that controlled device can Reduced by property, maintenance cost becomes higher.
The EMS memory management process of embedded system provided by the invention, it is intended to solve the as above technical problem of the prior art.
How the technical solution of technical scheme and the application is solved with specifically embodiment below above-mentioned Technical problem is described in detail.These specific embodiments can be combined with each other below, for the same or similar concept Or process may repeat no more in certain embodiments.Below in conjunction with attached drawing, the embodiment of the present invention is described.
Fig. 2 is the flow chart of the EMS memory management process for the embedded system that the embodiment of the present invention one provides, as shown in Fig. 2, Method in the present embodiment is applied in the physical memory of embedded system, and the physical memory of the embedded system includes:System Reason memory field under the overall leadership and user management memory field, the system management ram area carry out pipe by the operating system of embedded system Reason, the user management memory field refer to the memory field that pre- first to file distribution can be carried out according to application program.In the present embodiment Method can include:
S101, using page as minimum applying unit, the page application received for user management memory field is asked.
In the present embodiment, user management memory field is divided into several memory pages blockettes of different sizes in advance, Each memory pages blockette includes the page of different number of corresponding size, and the size of the page includes:4K、8K、16K、32K、 64K、128K;The page safeguarded by the page control table positioned at fixed position, wherein, size is that the quantity of the page of 4K can be into Mobile state adjusts.Using page as minimum applying unit, the page application received for user management memory field is asked.Need to illustrate , application program will use memory cannot directly apply to page management program, it is necessary to pass through piece management program application.Piece pipe Program is managed in units of page to page management program application, application program is then distributed to smaller or greater block again and (i.e. should With program directly to piece management program application memory, piece management program is just as retailer, it is to the wholesale memory of page management person, then zero Sell to user).
S102, ask according to page application, distributes the page of default size.
In the present embodiment, page management program is asked according to the page of piece management program, distributes the memory of default size Page.
After S103, the page to distribution are formatted, each page is divided into the identical Memory slice of size.
In the present embodiment, processing is formatted to the page of page management program distribution first, then will be each interior Deposit page and be divided into the identical Memory slice of size.
S104, create SLAB management structures at the beginning of each page, and creates memory after SLAB manages structure Piece manages table;Alternatively, perform step S105.
In the present embodiment, using in-band management mode, i.e. SLAB management structure, Memory slice management table, Memory slice are same On page, this way to manage is suitable for the management of small size Memory slice, such as when Memory slice is less than 512 byte uses.Wherein, SLAB management structures are used for all Memory slices for managing corresponding page division;Corresponding SLAB is included in the Memory slice management table The address information for all Memory slices that management structure is managed, the SLAB management structure are additionally operable to according to Memory slice management table point With Memory slice to application program.
Apply for that memory block is used to create SLAB management knots in a default caching of the S105 in user management memory field Structure, and Memory slice management table is created after SLAB manages structure.
In the present embodiment, using outband management mode, to apply for fritter memory storage SLAB management structures and Memory slice Table is managed, i.e. SLAB management structure, Memory slice management table, Memory slice be not on same one page.The purpose of this way to manage is to keep away Exempt from excessive memory to waste, such as used when Memory slice is more than or equal to 512 byte.
The present embodiment, paging, burst processing are carried out by the user management memory field of the physical memory to embedded system, And using page as minimum applying unit, the page application received for the user management memory field is asked, according to the memory Page application request, distributes the page of default size.Based on SLAB management methods, SLAB is created at the beginning of each page Structure is managed, and Memory slice management table is created after SLAB manages structure;Alternatively, one in the user management memory field Apply for that memory block is used to create SLAB management structures in default caching, and Memory slice management is created after SLAB manages structure Table;Structure is managed by SLAB table storage allocation piece is managed to application program according to Memory slice.Method in the present invention can root Continually memory application is carried out according to application requests, memory usage is high.
Fig. 3 is the flow chart of the EMS memory management process of embedded system provided by Embodiment 2 of the present invention, as shown in figure 3, On the basis of method shown in Fig. 2, the method in the present embodiment can also include:
S201, using page as minimum applying unit, the page application received for user management memory field is asked.
S202, ask according to page application, distributes the page of default size.
After S203, the page to distribution are formatted, each page is divided into the identical Memory slice of size.
S204, create SLAB management structures at the beginning of each page, and creates memory after SLAB manages structure Piece manages table;Alternatively, perform step S105.
Apply for that memory block is used to create SLAB management knots in S205, a default caching in user management memory field Structure, and Memory slice management table is created after SLAB manages structure.
In the present embodiment, the correlation in the specific implementation process method shown in Figure 2 of step S201- steps S205 is retouched State, details are not described herein again.
S206, the memory application request for receiving application program.
In the present embodiment, piece management program receives the memory application request that application program is sent.
S207, the memory size according to application requests, to memory described in application assigned.
In the present embodiment, according to the memory size of application requests, respective class is found from the caching retrieval chained list The caching of type, and after obtaining Memory slice by the corresponding SLAB chained lists of the caching, distribute to the application program;Wherein, institute State the size that caching retrieval chained list is used to indicate different type caching, and the control structure of instruction different type caching.
The present embodiment, by piece management program (SLAB management methods) to application assigned Memory slice, realizes basis Application program memory size carries out dynamic memory distribution, drastically increases the utilization rate of memory.
Fig. 4 is the flow chart of the EMS memory management process for the embedded system that the embodiment of the present invention three provides, and Fig. 5 is the present invention The internal memory initialization flow diagram that embodiment one provides;As shown in figure 4, it is being directed to institute by minimum applying unit, reception of page Before the page application request for stating user management memory field, further include:
S301, receive the request input by user initialized to user management memory field.
Alternatively, as shown in figure 5, obtaining random access memory (the random access of upper layer software (applications) first Memory, RAM) initial address, determine the initial address of memory pages control table, set the RAM length of upper layer software (applications), determine 128K, 64K, 32K, 16k, 8K size internal memory end-of-page address of layer software, initial address;And determine upper layer software (applications) 4K memories Page initial address, determines the length of memory pages control table, determines the data length of record page control table, determines again Layer software 4K memory pages initial addresses, whole Memory control table are reset;Initialize the interior of 4K, 8K, 16K, 32K, 64K, 128K Page control table entry is deposited, flag bit initialization, initializes the global variable (keme_cache_s) of buffer structure, caches search chain Table (cache_chain), caching retrieval table (cache_size).
S302, by user management memory field be divided into several memory pages blockettes of different sizes.
In the present embodiment, each memory pages blockette includes the page of different number of corresponding size, the size of the page Including:4K、8K、16K、32K、64K、128K;The page safeguarded by the page control table positioned at fixed position, wherein, greatly The quantity of the small page for 4K can be adjusted into Mobile state.
Alternatively, using page as minimum applying unit, the page application received for the user management memory field is asked Before asking, further include:Determine that all Memory slices that the SLAB management structure is managed are all occupied.
The present embodiment, by being initialized to user management memory field, and in initialization procedure, in advance to page Divided, in order to be managed to page, improve page application efficiency.
Fig. 6 is the flow chart of the EMS memory management process for the embedded system that the embodiment of the present invention four provides, as shown in fig. 6, After each page of application is divided into the identical Memory slice of size, further include:
S401, according to the size of Memory slice classify Memory slice, and the identical Memory slice of size is divided into one kind.
In the present embodiment, Memory slice classification is carried out according to the size of Memory slice, the identical Memory slice of size is divided into one kind.It is interior Deposit piece size be respectively 32,64,128,256,512,1k, 2k, 4k, 8k, 16k, 32k, 64k, 128k bytes, each size Memory slice is classified as one kind respectively, is respectively in all kinds of pages, i.e., the piece of 32 bytes, which is in, is exclusively used in this kind of Memory slice In page, the piece of 64 bytes, which is in, to be exclusively used in the page of 64 byte of memory pieces, and so on.
S402, according to default Memory slice quantity and size requirement, Memory slice is divided into multigroup section, per pack area It is associated by caching retrieval chained list with different types of caching.
In the present embodiment, by being divided into multigroup section to the Memory slice of different size and quantity, it will pass through per pack area Caching retrieval chained list is associated with different types of caching.
Alternatively, Fig. 7 is the memory application process schematic diagram that the embodiment of the present invention one provides;As shown in fig. 7, receive first The memory application of user, traversal caching retrieval table, the buffer inlet to be applied is found according to memory length, is then obtained corresponding slow The object (Memory slice) managed in the SLAB management structures deposited;Determine whether that SLAB management first object of structure is (interior Deposit piece) application;If so, then:The page for specifying size is obtained from platform software memory field (user management memory field), it is interior to this Deposit page to be formatted, and create SLAB management structures and Object Management group list (Memory slice management table), page control table is set And the control information of page is set (Memory slice that addition SLAB management structure is managed is retrieved in chained list to caching);If it is not, Then:Judge whether SLAB management structure is full (all Memory slices are occupied), if otherwise returning to memory pointer, if so, Shen Please page, SLAB management structures are created on the page applied, memory pointer is directed toward newly-built SLAB management structures.
Fig. 8 is the flow chart of the EMS memory management process for the embedded system that the embodiment of the present invention five provides, as shown in figure 8, On the basis of method shown in Fig. 2, the present embodiment can also include:
When all Memory slices that S501, SLAB management structure are managed are in idle condition, corresponding SLAB chained lists are deleted Described in SLAB management structures information, and all Memory slices for removing SLAB management structure management correspond to the control item of page Information.
In the present embodiment, all SLAB that SLAB chained lists are used to indicate to create in same class caching manage the information of structure. The control information item includes:CACHE pointers, and SLAB pointers;
S501, the head that page is put into free page.
In the present embodiment, the page for removing SLAB management structure management is prevented on the head of free page, in order to When receiving page application request next time, the distribution of page is carried out.
The present embodiment, manages structure by SLAB and the Memory slice in page is managed, when Memory slice is completely in During idle condition, which is discharged in time, so as to improve memory usage.
Fig. 9 is the structure diagram of the memory management device for the embedded system that the embodiment of the present invention one provides, such as Fig. 9 institutes Show, the device in the present embodiment, is applied in the physical memory of embedded system, the physical memory bag of the embedded system Include:System management ram area and user management memory field, the system management ram area by embedded system operating system into Row management, the user management memory field refer to the memory field that pre- first to file distribution can be carried out according to application program;Described device Including:
First receiving module 10, for using page as minimum applying unit, receiving for the interior of the user management memory field Deposit page application request;
First distribution module 20, for being asked according to the page application, distributes the page of default size;
Burst module 30, after being formatted to the page of distribution, it is identical to be divided into size by each page Memory slice;
Management module 40, for creating SLAB management structures at the beginning of each page, and manages structure in SLAB Memory slice management table is created afterwards;Alternatively, apply for that memory block is used in a default caching in the user management memory field Structure is managed in creating SLAB, and Memory slice management table is created after SLAB manages structure;Wherein, the SLAB management structure is used In all Memory slices of the corresponding page division of management;Structure is managed in the Memory slice management table comprising corresponding SLAB to be managed All Memory slices address information, SLAB management structure is additionally operable to according to Memory slice management table storage allocation piece to application Program.
Alternatively, the first receiving module 10, is additionally operable to be directed to the user management by minimum applying unit, reception of page Before the page application request of memory field, determine that all Memory slices that the SLAB management structure is managed are all occupied With.
Alternatively, management module 40, be additionally operable to by each page of application be divided into the identical Memory slice of size it Afterwards, classified according to the size of Memory slice to the Memory slice, the identical Memory slice of size is divided into one kind;
According to the requirement of the quantity and size of default Memory slice, Memory slice is divided into multigroup section, is passed through per pack area Caching retrieval chained list is associated with different types of caching.
Alternatively, management module 40, are additionally operable to be in idle shape in all Memory slices that SLAB management structure is managed During state, the information of SLAB management structure described in corresponding SLAB chained lists is deleted, and removes the institute of the SLAB management structure management There is the control item information that Memory slice corresponds to page;Wherein, the SLAB chained lists are used to indicate the institute created in same class caching There is the information of SLAB management structures, the control information item includes:CACHE pointers, and SLAB pointers;
The page is put into the head of free page.
The present embodiment can perform the technical solution in the method shown in above-mentioned Fig. 2-Fig. 8, it realizes process and technology effect Fruit is similar with the above method, and details are not described herein again.
Figure 10 be embedded system provided by Embodiment 2 of the present invention memory management device structure diagram, such as Figure 10 Shown, the device in the present embodiment, on the basis of Fig. 9 shown devices, can also include:
Second receiving module 50, the memory application for receiving application program are asked;
Second distribution module 60, for the memory size according to application requests, to described in the application assigned Memory slice.
Alternatively, the second distribution module 60, is specifically used for:According to the memory size of application requests, from the caching The caching of respective type is found in retrieval chained list, and after obtaining Memory slice by the corresponding SLAB chained lists of the caching, is distributed to The application program;Wherein, the caching retrieval chained list is used for the size for indicating different type caching, and instruction different type The control structure of caching.
The present embodiment can perform the technical solution in the method shown in above-mentioned Fig. 2-Fig. 8, it realizes process and technology effect Fruit is similar with the above method, and details are not described herein again.
The structure diagram of the memory management device for the embedded system that Figure 11 provides for the embodiment of the present invention three, such as Figure 11 Shown, the device in the present embodiment, on the basis of Fig. 9 shown devices, can also include:
Pagination module 70, for using page as minimum applying unit, receiving the memory for the user management memory field Before page application request, the request input by user initialized to user management memory field is received;
User management memory partitioning initialize when, by the user management memory field be divided into several it is of different sizes in Paging partition block is deposited, each memory pages blockette includes the page of different number of corresponding size, and the size of the page includes: 4K、8K、16K、32K、64K、128K;The page safeguarded by the page control table positioned at fixed position, wherein, size 4K The quantity of page can be adjusted into Mobile state.
The present embodiment can perform the technical solution in the method shown in above-mentioned Fig. 2-Fig. 8, it realizes process and technology effect Fruit is similar with the above method, and details are not described herein again.
The structure diagram of the memory management equipment for the embedded system that Figure 12 provides for the embodiment of the present invention one, this implementation Equipment in example can include:
Memory 80, for storage program;
Processor 90, for performing the described program of the memory storage, when described program is performed, the processing Device 90 is used to perform the technical solution in the method shown in above-mentioned Fig. 2-Fig. 8.
In addition, the embodiment of the present application also provides a kind of computer-readable recording medium, deposited in computer-readable recording medium Computer executed instructions are contained, when at least one processor of user equipment performs the computer executed instructions, user equipment Perform above-mentioned various possible methods.
Wherein, computer-readable medium includes computer storage media and communication media, and wherein communication media includes being easy to Any medium of computer program is transmitted from a place to another place.Storage medium can be universal or special computer Any usable medium that can be accessed.A kind of exemplary storage medium is coupled to processor, so as to enable a processor to from this Read information, and information can be write to the storage medium.Certainly, storage medium can also be the composition portion of processor Point.Pocessor and storage media can be located in ASIC.In addition, the ASIC can be located in user equipment.Certainly, processor and Storage medium can also be present in communication equipment as discrete assembly.
One of ordinary skill in the art will appreciate that:Realizing all or part of step of above-mentioned each method embodiment can lead to The relevant hardware of programmed instruction is crossed to complete.Foregoing program can be stored in a computer read/write memory medium.The journey Sequence upon execution, execution the step of including above-mentioned each method embodiment;And foregoing storage medium includes:ROM, RAM, magnetic disc or Person's CD etc. is various can be with the medium of store program codes.
Finally it should be noted that:The above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Pipe is described in detail the present invention with reference to foregoing embodiments, it will be understood by those of ordinary skill in the art that:Its according to Can so modify to the technical solution described in foregoing embodiments, either to which part or all technical characteristic into Row equivalent substitution;And these modifications or replacement, the essence of appropriate technical solution is departed from various embodiments of the present invention technology The scope of scheme.

Claims (10)

1. a kind of EMS memory management process of embedded system, it is characterised in that apply in the physical memory of embedded system, institute Stating the physical memory of embedded system includes:System management ram area and user management memory field, the system management ram area It is managed by the operating system of embedded system, the user management memory field refers to that advance Shen can be carried out according to application program The memory field that please be distribute;The described method includes:
Using page as minimum applying unit, the page application received for the user management memory field is asked;
Asked according to the page application, distribute the page of default size;
After being formatted to the page of distribution, each page is divided into the identical Memory slice of size;
SLAB management structures are created at the beginning of each page, and Memory slice management table is created after SLAB manages structure; Alternatively, apply for that memory block is used to create SLAB management structures in a default caching in the user management memory field, And Memory slice management table is created after SLAB manages structure;
Wherein, the SLAB management structure is used for all Memory slices for managing corresponding page division;The Memory slice manages table In the address informations of all Memory slices that structure is managed is managed comprising corresponding SLAB, the SLAB management structure is additionally operable to basis Memory slice manages table storage allocation piece to application program.
2. according to the method described in claim 1, it is characterized in that, further include:
Receive the memory application request of application program;
According to the memory size of application requests, to Memory slice described in the application assigned.
3. according to the method described in claim 1, it is characterized in that, it is being directed to the use by minimum applying unit, reception of page Before the page application request in family managing internal memory area, further include:
Receive the request input by user initialized to user management memory field;
The user management memory field is divided into several memory pages blockettes of different sizes, each memory pages subregion Block includes the page of different number of corresponding size, and the size of the page includes:4K、8K、16K、32K、64K、128K;The page by Page control table positioned at fixed position safeguarded, wherein, size is that the quantity of the page of 4K can be adjusted into Mobile state.
4. according to the method described in claim 1, it is characterized in that, it is being directed to the use by minimum applying unit, reception of page Before the page application request in family managing internal memory area, further include:
Determine that all Memory slices that the SLAB management structure is managed are all occupied.
It is 5. according to the method described in claim 2, it is characterized in that, identical each page of application is divided into size After Memory slice, further include:
Classified according to the size of Memory slice to the Memory slice, the identical Memory slice of size is divided into one kind;
According to the requirement of the quantity and size of default Memory slice, Memory slice is divided into multigroup section, passes through caching per pack area Retrieval chained list is associated with different types of caching.
6. according to the method described in claim 5, it is characterized in that, the memory size according to application requests, to institute Memory slice described in application assigned is stated, including:
According to the memory size of application requests, the caching of respective type is found from the caching retrieval chained list, and pass through After the corresponding SLAB chained lists of the caching obtain Memory slice, the application program is distributed to;Wherein, the caching retrieval chained list is used In the size of instruction different type caching, and the control structure of instruction different type caching.
7. according to the method described in claim 6, it is characterized in that, locate in all Memory slices that SLAB management structure is managed When idle condition, further include:
The information of SLAB management structure described in corresponding SLAB chained lists is deleted, and removes all of the SLAB management structure management Memory slice corresponds to the control item information of page;Wherein, the SLAB chained lists are used to indicate to create in same class caching all SLAB manages the information of structure, and the control information item includes:CACHE pointers, and SLAB pointers;
The page is put into the head of free page.
8. the memory management device of a kind of embedded system, it is characterised in that apply in the physical memory of embedded system, institute Stating the physical memory of embedded system includes:System management ram area and user management memory field, the system management ram area It is managed by the operating system of embedded system, the user management memory field refers to that advance Shen can be carried out according to application program The memory field that please be distribute;
Described device includes:
First receiving module, for using page as minimum applying unit, receiving the page Shen for the user management memory field It please ask;
First distribution module, for being asked according to the page application, distributes the page of default size;
Burst module, after being formatted to the page of distribution, the identical memory of size is divided into by each page Piece;
Management module, for creating SLAB management structures at the beginning of each page, and creates after SLAB manages structure Memory slice manages table;Alternatively, apply for that memory block is used to create in a default caching in the user management memory field SLAB manages structure, and Memory slice management table is created after SLAB manages structure;
Wherein, the SLAB management structure is used for all Memory slices for managing corresponding page division;The Memory slice manages table In the address informations of all Memory slices that structure is managed is managed comprising corresponding SLAB, the SLAB management structure is additionally operable to basis Memory slice manages table storage allocation piece to application program.
9. device according to claim 8, it is characterised in that further include:
Second receiving module, the memory application for receiving application program are asked;
Second distribution module, for the memory size according to application requests, to Memory slice described in the application assigned.
10. device according to claim 9, it is characterised in that further include:
Pagination module, for using page as minimum applying unit, receiving the page application for the user management memory field Before request, the request input by user initialized to user management memory field is received;
When user management memory partitioning initializes, the user management memory field is divided into several pages of different sizes Face blockette, each memory pages blockette include the page of different number of corresponding size, and the size of the page includes:4K、8K、 16K、32K、64K、128K;The page safeguarded by the page control table positioned at fixed position, wherein, size is the page of 4K Quantity can be adjusted into Mobile state.
CN201711201135.4A 2017-11-27 2017-11-27 Memory management method and device of embedded system Active CN108038062B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201711201135.4A CN108038062B (en) 2017-11-27 2017-11-27 Memory management method and device of embedded system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711201135.4A CN108038062B (en) 2017-11-27 2017-11-27 Memory management method and device of embedded system

Publications (2)

Publication Number Publication Date
CN108038062A true CN108038062A (en) 2018-05-15
CN108038062B CN108038062B (en) 2021-05-04

Family

ID=62092999

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711201135.4A Active CN108038062B (en) 2017-11-27 2017-11-27 Memory management method and device of embedded system

Country Status (1)

Country Link
CN (1) CN108038062B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815192A (en) * 2019-01-31 2019-05-28 深兰科技(上海)有限公司 A kind of managing embedded system memory method and device
CN109857678A (en) * 2019-01-31 2019-06-07 深兰科技(上海)有限公司 A kind of managing embedded system memory method and device
CN109902032A (en) * 2019-01-31 2019-06-18 泰康保险集团股份有限公司 Out-pile EMS memory management process, device, medium and electronic equipment
WO2021077917A1 (en) * 2019-10-24 2021-04-29 华为技术有限公司 Memory configuration method and device, and storage medium
CN109815192B (en) * 2019-01-31 2024-06-11 深兰机器人(上海)有限公司 Method and device for managing embedded system memory

Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101221536A (en) * 2008-01-25 2008-07-16 中兴通讯股份有限公司 Internal memory managing method and device of embedded system
CN101515247A (en) * 2009-03-30 2009-08-26 福建星网锐捷网络有限公司 Method and device for monitoring memory
CN102063385A (en) * 2010-12-23 2011-05-18 深圳市金宏威实业发展有限公司 Memory management method and system
CN102156675A (en) * 2010-02-12 2011-08-17 中兴通讯股份有限公司 Method and device for allocating memory
CN102193814A (en) * 2010-03-09 2011-09-21 上海拜翰网络科技有限公司 Method and system for dynamically distributing embedded virtual memory
CN102455974A (en) * 2010-10-21 2012-05-16 上海宝信软件股份有限公司 High-speed internal memory application and release management system with controllable internal memory consumption and high-speed internal memory application release management method
CN102915276A (en) * 2012-09-25 2013-02-06 武汉邮电科学研究院 Memory control method for embedded systems
CN103077126A (en) * 2012-12-24 2013-05-01 中兴通讯股份有限公司 Memory management method and device
CN103197979A (en) * 2012-01-04 2013-07-10 阿里巴巴集团控股有限公司 Method and device for realizing data interaction access among processes
US20140122826A1 (en) * 2010-09-30 2014-05-01 Juniper Networks, Inc. Detecting memory corruption
CN104317734A (en) * 2014-11-28 2015-01-28 迈普通信技术股份有限公司 Memory allocation method and device applicable to SLAB
US20150095695A1 (en) * 2011-09-12 2015-04-02 Microsoft Corporation Volatile memory representation of nonvolatile storage device set
CN105302737A (en) * 2015-11-24 2016-02-03 浪潮(北京)电子信息产业有限公司 Memory allocation management method and memory allocation management system
US20170062025A1 (en) * 2015-09-02 2017-03-02 Samsung Electronics Co., Ltd. Memory system including plural memory devices forming plural ranks and memory controller accessing plural memory ranks and method of operating the memory system
CN106503032A (en) * 2016-09-09 2017-03-15 深圳大学 A kind of method and device of data compression
US9753850B1 (en) * 2014-08-15 2017-09-05 Hazelcast, Inc. On-heap huge slab allocator

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101221536A (en) * 2008-01-25 2008-07-16 中兴通讯股份有限公司 Internal memory managing method and device of embedded system
CN101515247A (en) * 2009-03-30 2009-08-26 福建星网锐捷网络有限公司 Method and device for monitoring memory
CN102156675A (en) * 2010-02-12 2011-08-17 中兴通讯股份有限公司 Method and device for allocating memory
CN102193814A (en) * 2010-03-09 2011-09-21 上海拜翰网络科技有限公司 Method and system for dynamically distributing embedded virtual memory
US20140122826A1 (en) * 2010-09-30 2014-05-01 Juniper Networks, Inc. Detecting memory corruption
CN102455974A (en) * 2010-10-21 2012-05-16 上海宝信软件股份有限公司 High-speed internal memory application and release management system with controllable internal memory consumption and high-speed internal memory application release management method
CN102063385A (en) * 2010-12-23 2011-05-18 深圳市金宏威实业发展有限公司 Memory management method and system
US20150095695A1 (en) * 2011-09-12 2015-04-02 Microsoft Corporation Volatile memory representation of nonvolatile storage device set
CN103197979A (en) * 2012-01-04 2013-07-10 阿里巴巴集团控股有限公司 Method and device for realizing data interaction access among processes
CN102915276A (en) * 2012-09-25 2013-02-06 武汉邮电科学研究院 Memory control method for embedded systems
CN103077126A (en) * 2012-12-24 2013-05-01 中兴通讯股份有限公司 Memory management method and device
US9753850B1 (en) * 2014-08-15 2017-09-05 Hazelcast, Inc. On-heap huge slab allocator
CN104317734A (en) * 2014-11-28 2015-01-28 迈普通信技术股份有限公司 Memory allocation method and device applicable to SLAB
US20170062025A1 (en) * 2015-09-02 2017-03-02 Samsung Electronics Co., Ltd. Memory system including plural memory devices forming plural ranks and memory controller accessing plural memory ranks and method of operating the memory system
CN105302737A (en) * 2015-11-24 2016-02-03 浪潮(北京)电子信息产业有限公司 Memory allocation management method and memory allocation management system
CN106503032A (en) * 2016-09-09 2017-03-15 深圳大学 A kind of method and device of data compression

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
JUNWEI ZHANG 等: "A Storage Slab Allocator for Disk Storage Management in File System", 《 2009 IEEE INTERNATIONAL CONFERENCE ON NETWORKING, ARCHITECTURE, AND STORAGE》 *
李毅: "集中式三层交换机设备软件模块的设计与实现", 《中国优秀硕士学位论文全文数据库(电子期刊) 信息科技辑》 *
楼程辉: "Linux下物理内存管理技术探讨", 《计算机应用研究》 *
洪津津等: "LINUX中的Slab分配器", 《计算机应用研究》 *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109815192A (en) * 2019-01-31 2019-05-28 深兰科技(上海)有限公司 A kind of managing embedded system memory method and device
CN109857678A (en) * 2019-01-31 2019-06-07 深兰科技(上海)有限公司 A kind of managing embedded system memory method and device
CN109902032A (en) * 2019-01-31 2019-06-18 泰康保险集团股份有限公司 Out-pile EMS memory management process, device, medium and electronic equipment
CN109902032B (en) * 2019-01-31 2021-05-25 泰康保险集团股份有限公司 Out-of-heap memory management method, device, medium and electronic equipment
CN109815192B (en) * 2019-01-31 2024-06-11 深兰机器人(上海)有限公司 Method and device for managing embedded system memory
WO2021077917A1 (en) * 2019-10-24 2021-04-29 华为技术有限公司 Memory configuration method and device, and storage medium

Also Published As

Publication number Publication date
CN108038062B (en) 2021-05-04

Similar Documents

Publication Publication Date Title
JP3962368B2 (en) System and method for dynamically allocating shared resources
EP2266040B1 (en) Methods and systems for dynamic cache partitioning for distributed applications operating on multiprocessor architectures
US6760826B2 (en) Store data in the system memory of a computing device
CN108038062A (en) The EMS memory management process and device of embedded system
CA2810782C (en) Managing memory across a network of cloned virtual machines
CN113342265B (en) Cache management method and device, processor and computer device
CN107111557A (en) Shared cache memory distribution control is provided in shared high-speed buffer storage system
WO1999067699A3 (en) Dynamic memory space allocation
CN111177019A (en) Memory allocation management method, device, equipment and storage medium
CN112269656A (en) Application configuration method, device and system based on multi-core processor
CN105426322B (en) A kind of forecasting method and device of data
JP6974510B2 (en) Methods, devices, devices and media for processing data
JP2005500620A (en) Memory pool with moving memory blocks
US7904688B1 (en) Memory management unit for field programmable gate array boards
CN115421924A (en) Memory allocation method, device and equipment
CN109062693A (en) A kind of EMS memory management process and relevant device
Winter et al. Ouroboros: virtualized queues for dynamic memory management on GPUs
CN110674051A (en) Data storage method and device
CN111562883B (en) Cache management system, method and device for solid state disk
CN107977265A (en) Internal memory initialization method, apparatus and memory allocation method, device
CN106537321B (en) Method, device and storage system for accessing file
CN105630403B (en) Document storage system and its file storage controlling method and device
CN109086002A (en) Space management, device, computer installation and the storage medium of storage object
CN117435343A (en) Memory management method and device
CN109408412B (en) Memory prefetch control method, device and equipment

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