CN105469173A - Method of optimal management on static memory - Google Patents

Method of optimal management on static memory Download PDF

Info

Publication number
CN105469173A
CN105469173A CN201410406639.XA CN201410406639A CN105469173A CN 105469173 A CN105469173 A CN 105469173A CN 201410406639 A CN201410406639 A CN 201410406639A CN 105469173 A CN105469173 A CN 105469173A
Authority
CN
China
Prior art keywords
memory
internal
storage area
fragmentation
state
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.)
Pending
Application number
CN201410406639.XA
Other languages
Chinese (zh)
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.)
Xi'an Huize Intellectual Property Operation Management Co Ltd
Original Assignee
Xi'an Huize Intellectual Property Operation Management 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 Xi'an Huize Intellectual Property Operation Management Co Ltd filed Critical Xi'an Huize Intellectual Property Operation Management Co Ltd
Priority to CN201410406639.XA priority Critical patent/CN105469173A/en
Publication of CN105469173A publication Critical patent/CN105469173A/en
Pending legal-status Critical Current

Links

Landscapes

  • Devices For Executing Special Programs (AREA)

Abstract

The invention discloses a method of optimal management on a static memory. The method is characterized in that a continuous storage area of the memory is allocated to a group of programs and/or data in advance for special use; the storage area comprises a plurality of memory slices with the same size; related information concerning the configuration and the state of the storage area is stored in the memory; when a program and/or data in the group wants to use the memory, addresses of memory slices in an idle state with a corresponding number are acquired according to the related information of the storage area and the memory slices are made in a use state; and according to the memory slice addresses acquired in the last step, the corresponding storage space is allocated to the programs and/or data which want to use the memory. The memory management speed and the efficiency are improved, the problem of memory fragments can be solved, additional expenditure brought by recovery of the memory fragments is avoided, the memory allocation algorithm is simplified, and the stability and the efficiency of the system are ensured.

Description

A kind of static memory is optimized the method for management
Technical field
The present invention relates to a kind of method that static memory is optimized management.
Background technology
Computer system is made up of hardware and software two large divisions.Hardware components is called bare machine, and it comprises main frame and external unit, and main frame is made up of central processing unit (CPU) and internal memory, and wherein CPU is responsible for computing and controls other parts; Internal memory is used for storage program and data.Software section comprises system software and application software, and all resources of operating system to computer system wherein as system software carry out control and management, makes them obtain rationally and fully utilizing.Memory management occupies crucial status in an operating system; its management function mainly comprises Memory Allocation and recovery, the conversion of logical address and physical address, memory protection and memory expansion etc.; the process such as the wherein tracking of internal memory, recovery, debugging and defragmentation are the Focal point and difficult points of memory management always; also be affect whole system to stablize the key with efficiency, this just requires that the operating system (or virtual opetrating system) used can provide efficient, stable EMS memory management process.
In the existing Memory Management of one, memory block be divided into two classes and utilize two chained lists to manage respectively, one of them chained list is free memory chained list, for linking idle memory block; Another is for using chained list, for linking the memory block used.The size of each memory block is irregular (namely size may not wait), when there being internal memory request for utilization, operating system is according to the internal memory use amount of application, from idle chained list, select suitable memory block to put into use chained list to use to distribute to applicant, after use terminates, memory block is released and is placed into idle chained list, and judge whether this memory block can be integrated into one piece of larger memory block with other memory block in idle chained list, if of course, then carry out defragmentation to form larger memory block to integrate.The advantage of this method is can unified approach managing internal memory, shortcoming easily occurs a large amount of fragments in internal memory use procedure, internal memory is caused to be wasted, in addition, defragmentation algorithms complexity and inefficiency, thus the overall performance of influential system, finally, (namely the method still cannot solve problem that internal memory exhausts, when there is RAM leakage in a task or thread, it may exhaust all memory sources of system, and then affects whole system, even causes collapsing >.
Summary of the invention
For solving above-mentioned existing shortcoming, fundamental purpose of the present invention is to provide a kind of static memory of practicality to be optimized the method for management, be conducive to improving memory management speed and efficiency, there will not be the problem of memory fragmentation, avoid memory fragmentation and reclaim the extra expenses brought, simplify memory allocation algorithm, ensure that the stable of system and efficiency.
For reaching above-described object, the method that a kind of static memory of the present invention is optimized management takes following technical scheme:
A kind of static memory is optimized the method for management, it is characterized in that, the a certain Coutinuous store region of internal memory is allocated in advance and uses specially to batch processing and/or data, this storage area comprises some equal-sized internal fragmentations, and in internal memory, preserve the relevant information relating to the configuration of this storage area and state, when having program and/or data for use internal memory in this group, perform following steps:
A () obtains respective numbers according to the relevant information of this storage area and is in the address of the internal fragmentation of idle condition and these internal fragmentations are placed in using state;
B internal fragmentation address that () obtains according to step (1a), gives program and/or the data for using internal memory by the memory allocation of correspondence,
When this group internal program and/or ED internal memory use, perform following steps:
(2a) release terminates the storage space of the internal fragmentation used:
(2b) determine the address of the internal fragmentation terminating use according to the relevant information of this storage area and these internal fragmentations are placed in idle condition.
Described a kind of static memory is optimized the method for management, it is characterized in that, internal fragmentation two ends described in every block arrange the flag byte on its border of mark, by in internal memory for this group program and/or data set up another Coutinuous store region and preserve and relate to this and set up storage area configuration and relevant information of state and increase the internal memory that this group program and/or data use, the described relevant information relating to the configuration of this storage area and state comprises the size of internal fragmentation, be in internal fragmentation quantity and the address of idle condition and using state, the size of this storage area start and end address and this storage area, the address of the internal fragmentation of idle condition and using state is in chained list mode record, and obtain internal fragmentation address by chain table handling and between idle condition and using state, switch the state of internal fragmentation, the described relevant information relating to the configuration of this storage area and state comprises the address setting up storage area further.
Adopt the present invention of as above technical scheme, there is following beneficial effect:
The present invention is owing to distributing special Coutinuous store region for batch processing and/or data, and therefore when there is RAM leakage, the internal memory in this region only exhausts by this group program and/or data, can not involve the operation of system other parts.Secondly, because storage area is continuous print, be therefore conducive to improving memory management speed and efficiency.Finally, this Coutinuous store region comprises some equal-sized internal fragmentations, program and/data use this region in units of internal fragmentation, therefore there will not be the problem of memory fragmentation, avoid memory fragmentation and reclaim the extra expenses brought, simplify memory allocation algorithm, ensure that the stable of system and efficiency.
Accompanying drawing explanation
Fig. 1 is the schematic diagram of one embodiment of the present of invention.
Embodiment
In order to further illustrate the present invention, be described further below in conjunction with accompanying drawing:
Generally, batch processing and/or data are to the service time of internal memory and size being dynamic and random, in the Memory Management of above-mentioned prior art, when it is desired to be used, system distributes corresponding internal memory for it according to using the size of internal memory, then regains the right to use and discharge this memory headroom after use terminates.As mentioned above, this dynamic memory management easily causes that internal memory exhausts, the shortcoming such as system crash and complex management and poor efficiency.For this reason, basic thought of the present invention is, in internal memory, distributing one piece of Coutinuous store region (being also called static memory pond below) for batch processing and/or data in advance supplies it special, static memory pond comprises some equal-sized internal fragmentations, and in units of internal fragmentation, for needing to use the program in static memory pond and/or data to distribute the internal memory of respective numbers, and discharge these internal fragmentations for follow-up use when terminating use.
In the distribution and dispose procedure of internal fragmentation, configuration and the status information in static memory pond will be utilized, the size of such as internal fragmentation and sum and be in the address etc. of internal fragmentation of idle condition and using state.For those skilled in that art, utilize the implementation of these information distribution and releasing memory burst to be known, and have nothing to do with the basic thought of the inventive method, therefore concrete way of thinking should not form the restriction to spirit and scope of the invention.In addition, in the present invention, to the preservation position of these information, there is no particular limitation, as long as ensure that these information are not lost and damage, therefore they both can be kept in static memory pool area, also can be kept at the region beyond static memory pond.
It is worthy of note, here alleged batch processing and/or the implication of data are construed as the set of some programs, the set of some programs and data and the set of some data, although in quite a number of cases, batch processing and/data may be under the jurisdiction of in whole system the modular entity completing certain logic function, and gather between internal program, the relation on actuating logic is there is between data and between program and data, but for basic thought of the present invention itself or its realize, relation on this actuating logic is also nonessential, therefore the restriction to spirit and scope of the invention should do not formed.
In order to prevent crossing its border to when one piece of internal fragmentation write-in program or data, can arrange the flag byte on its border of mark at internal fragmentation two ends described in every block, when reading flag byte, system judges that write operation has arrived the border of internal fragmentation and stopped the write to this internal fragmentation.In addition, although the internal fragmentation size in static memory pond can not be revised after determining when static memory pond creates, can be related to this set up storage area configuration and relevant information of state and increase the internal memory that this group program and/or data use by setting up another Coutinuous store region and preserve in internal memory.
The preferred embodiment of the inventive method is described by accompanying drawing below, in the preferred embodiment, use the batch processing in this static memory pond and/or data membership in a module, Bian static memory pond controll block and internal fragmentation description block group describe static memory pond for information about and realize the management functions such as the distribution of internal fragmentation and release by these relevant informations of change, wherein controll block is used for describing and the current state in record static memory pond, and internal fragmentation description block group is used for describing the state of internal fragmentation.
Fig. 1 shows the data structure of controll block and internal fragmentation description block group and the corresponding relation with internal fragmentation thereof.As shown in Figure 1, static memory pond controll block comprises following message segment:
(1) next memory pool pointer pNextMemPool, it is represent the address pointer specializing in other static memory pond that this module uses;
(2) idle chained list ulFreeList, it links all internal fragmentations being in idle condition, and as shown in Figure 1, the address pointer in chained list points to first and is in the position of internal fragmentation in internal fragmentation description block under idle condition;
(3) use chained list ulUsedList, it links all internal fragmentations being in using state, and the address pointer in chained list points to first and is in the position (not shown) of internal fragmentation in internal fragmentation description block under using state;
(4) burst size ulSliceSize, it represents the size of every block internal fragmentation in this static memory pond;
(5) burst quantity ulSliceNum, it represents the sum of internal fragmentation in this static memory pond;
(6) idle count ulSliceNum, it represents the current quantity being in the internal fragmentation of idle condition;
(7) usage quantity ulUsedNum, it represents the current quantity being in the internal fragmentation of using state;
(8) memory pool start address pBeginAddr, it represents the Jian beginning address in this static memory pond;
(9) memory pool end address pEndAddr, it represents the end address in this static memory pond;
(10) memory pool size ulPoolSize.It represents the capacity in this static memory pond;
(11) module I D ulMid, it represents the identifier of the module using this static memory pond;
(12) description block array pMenDesc, it is one group of internal fragmentation description block address pointer;
(13) controll block service marking ulUsed, it represents whether static memory pond corresponding to this controll block is used.
Internal fragmentation description block group is made up of some internal fragmentation description blocks, internal fragmentation one_to_one corresponding in each internal fragmentation description block and this static memory pond is to represent the using state of correspondence memory burst, it is made up of ulNext and ulUsedization two pointers, wherein ulNext to point in idle chained list next free memory burst or uses in chained list that next uses internal fragmentation position in internal fragmentation description block, and ulUsed points to the physical location of current memory burst in internal memory or physical location.
The establishment of static memory pond, internal fragmentation distribution, internal fragmentation release, internal fragmentation increase and the deletion of static memory pond etc. are comprised to the operation in static memory pond, are described respectively below:
1. static memory pond creation operation
This operation is used for allocating a static memory pond in advance for it before a module uses internal memory, generally realize in interface function mode and can by system call, the size and number that the parameter of input comprises the size ulSliceSize of internal fragmentation and quantity UlSliceNum and uses the module id in this static memory pond to go out her mountain wherein internal fragmentation can be set as that the capacity that may use with this module matches.This handling function generates one by the address pointer returning to this static memory pond and specializes in the static memory pond of a certain module use and generate corresponding static memory pond controll block and internal fragmentation description block group, static memory pond controll block and internal fragmentation description block group are according to input parameter initialization, time wherein initial, idle chained list is full up and use chained list for sky, and internal fragmentation description block is all linked in idle chained list.
2. internal fragmentation batch operation
This operation is used for the application using internal memory according to module, in the static memory pond created, distribute an internal fragmentation, and generally realizing in interface function mode also can by system call, and the parameter of input comprises this address of static memory pond in internal memory.When more than one of the internal memory use amount of module application, realize by repeatedly calling this interface function.This handling function will return to the address of one piece of free memory burst and upgrade the information of static memory pond controll block and internal fragmentation description block group, specifically, this handling function is by next free memory burst position in internal fragmentation description block of the pointed of chained list idle in controll block, use the pointed of chained list by the position of free memory burst in internal fragmentation description block returned, idle count subtracts one and usage quantity adds one ;in internal fragmentation description block group, the description block corresponding with by the free memory burst that returns is placed in using state, that is, its ulNext pointed had previously been arranged in the use internal fragmentation in usage chain heading portion in the position of internal fragmentation description block.
3. internal fragmentation releasing operation
This operation is used for discharging this internal fragmentation when module terminates a use internal fragmentation, it is made to be in the idle condition that can be applied use, generally realizing in interface function mode also can by system call, the parameter of input comprises the address of this static memory pond in internal memory and internal fragmentation address when module terminates more than one of the internal fragmentation used, by repeatedly calling the realization of this interface function.This handling function will discharge this internal fragmentation and upgrades the information of static memory pond controll block and internal fragmentation description block group, specifically, by the pointed of usage chain token in controll block, next uses the position of internal fragmentation in internal fragmentation description block to this handling function, the pointed of idle chained list this terminate the position of internal fragmentation in internal fragmentation description block that use, idle count adds one and usage quantity subtracts one ;in internal fragmentation description block group, the description block corresponding with the internal fragmentation terminating to use is placed in idle condition, that is, its pointed had previously been arranged in the free memory burst in idle chain heading portion in the position of internal fragmentation description block.
4. internal fragmentation increases operation
This operation is used for the internal fragmentation increasing some at static memory pond life span, and generally realizing in interface function mode also can by system call, and the parameter of input comprises the address of this static memory pond in internal memory and the internal fragmentation quantity of increase.This handling function will be set up a new static memory pond and generate corresponding static memory pond controll block and internal fragmentation description block group, new static memory controll block has the burst size identical with former static memory pond and No. D, module I, and idle chained list is full up and use chained list for sky time initial, internal fragmentation description block is all linked in idle chained list, in addition, this new static memory controll block of next static memory pond pointed in the controll block of former static memory pond.
5. static memory pond deletion action
This operation is for deleting the static memory pond of static memory pond and increase, and generally realizing in interface function mode also can by system call, and the parameter of input comprises this address of static memory pond in internal memory.At the end of module, this handling function is by the static memory pool space of this static memory pond of release and increase and delete corresponding controll block and description block group completes deletion action.
Defining static memory pond controll block and internal fragmentation description block structure and method of the present invention can adopted on the basis of static memory pond action type.Concrete process is as follows:
First system may need the amount of memory that uses and memory size according to a module run duration, allocates a static memory pond in advance by calling static memory pond creation operation function for this module.Subsequently, module the term of execution, when needs use internal memory, system is according to the amount of memory of module internal program and/or data application, by several times invoke memory burst batch operation function, the internal fragmentation that in static memory pond, several are in idle condition is distributed to requesting party.When these Memory Allocation terminate to use, system by several times invoke memory burst releasing operation function, discharges these memory headrooms for follow-up use again.If need the capacity increasing static memory pond module the term of execution, then can increase handling function by invoke memory burst, for the static memory pond that this block configuration one is new, as mentioned above, new static memory controll block has the burst size ulSliceSize identical with former static memory pond and module I D ulMid.Finally, when whole module terminates to use, delete static memory pond by calling static memory pond deletion action function.

Claims (2)

1. a static memory is optimized the method for management, it is characterized in that, the a certain Coutinuous store region of internal memory is allocated in advance and uses specially to batch processing and/or data, this storage area comprises some equal-sized internal fragmentations, and in internal memory, preserve the relevant information relating to the configuration of this storage area and state, when having program and/or data for use internal memory in this group, perform following steps:
A () obtains respective numbers according to the relevant information of this storage area and is in the address of the internal fragmentation of idle condition and these internal fragmentations are placed in using state;
B internal fragmentation address that () obtains according to step (1a), gives program and/or the data for using internal memory by the memory allocation of correspondence,
When this group internal program and/or ED internal memory use, perform following steps:
(2a) release terminates the storage space of the internal fragmentation used:
(2b) determine the address of the internal fragmentation terminating use according to the relevant information of this storage area and these internal fragmentations are placed in idle condition.
2. a kind of static memory as claimed in claim 1 is optimized the method for management, it is characterized in that, internal fragmentation two ends described in every block arrange the flag byte on its border of mark, by in internal memory for this group program and/or data set up another Coutinuous store region and preserve and relate to this and set up storage area configuration and relevant information of state and increase the internal memory that this group program and/or data use, the described relevant information relating to the configuration of this storage area and state comprises the size of internal fragmentation, be in internal fragmentation quantity and the address of idle condition and using state, the size of this storage area start and end address and this storage area, the address of the internal fragmentation of idle condition and using state is in chained list mode record, and obtain internal fragmentation address by chain table handling and between idle condition and using state, switch the state of internal fragmentation, the described relevant information relating to the configuration of this storage area and state comprises the address setting up storage area further.
CN201410406639.XA 2014-08-19 2014-08-19 Method of optimal management on static memory Pending CN105469173A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410406639.XA CN105469173A (en) 2014-08-19 2014-08-19 Method of optimal management on static memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410406639.XA CN105469173A (en) 2014-08-19 2014-08-19 Method of optimal management on static memory

Publications (1)

Publication Number Publication Date
CN105469173A true CN105469173A (en) 2016-04-06

Family

ID=55606842

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410406639.XA Pending CN105469173A (en) 2014-08-19 2014-08-19 Method of optimal management on static memory

Country Status (1)

Country Link
CN (1) CN105469173A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106354661A (en) * 2016-09-13 2017-01-25 郑州云海信息技术有限公司 Internal storage distribution method and device for storage software
CN107544964A (en) * 2016-06-24 2018-01-05 吴建凰 A kind of data block storage method for time series database
WO2018018896A1 (en) * 2016-07-29 2018-02-01 华为技术有限公司 Memory management apparatus and method
CN113485822A (en) * 2020-06-19 2021-10-08 中兴通讯股份有限公司 Memory management method, system, client, server and storage medium
CN113535597A (en) * 2020-04-14 2021-10-22 阿里巴巴集团控股有限公司 Memory management method, memory management unit and Internet of things equipment
CN116701243A (en) * 2023-08-03 2023-09-05 烟台东方威思顿电气有限公司 Storage space allocation management method under bare computer

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107544964A (en) * 2016-06-24 2018-01-05 吴建凰 A kind of data block storage method for time series database
WO2018018896A1 (en) * 2016-07-29 2018-02-01 华为技术有限公司 Memory management apparatus and method
CN106354661A (en) * 2016-09-13 2017-01-25 郑州云海信息技术有限公司 Internal storage distribution method and device for storage software
CN113535597A (en) * 2020-04-14 2021-10-22 阿里巴巴集团控股有限公司 Memory management method, memory management unit and Internet of things equipment
CN113535597B (en) * 2020-04-14 2024-05-03 阿里巴巴集团控股有限公司 Memory management method, memory management unit and Internet of things equipment
CN113485822A (en) * 2020-06-19 2021-10-08 中兴通讯股份有限公司 Memory management method, system, client, server and storage medium
CN116701243A (en) * 2023-08-03 2023-09-05 烟台东方威思顿电气有限公司 Storage space allocation management method under bare computer
CN116701243B (en) * 2023-08-03 2023-10-20 烟台东方威思顿电气有限公司 Storage space allocation management method under bare computer

Similar Documents

Publication Publication Date Title
CN105469173A (en) Method of optimal management on static memory
CN101221536B (en) Internal memory managing method and device of embedded system
CN1271524C (en) Static internal storage management method
JP2013513174A (en) Method and system for managing virtual machine storage space and physical hosts
CN104731799A (en) Memory database management device
CN107783812B (en) Virtual machine memory management method and device
CN110032549B (en) Partition splitting method, partition splitting device, electronic equipment and readable storage medium
KR102594657B1 (en) Method and apparatus for implementing out-of-order resource allocation
JP5574464B2 (en) Storage resource hierarchy management method and system
CN105718319B (en) Memory pool layout analysis method and memory pool device
CN107256196A (en) The caching system and method for support zero-copy based on flash array
CN106445835A (en) Memory allocation method and apparatus
CN110109868A (en) Method, apparatus and computer program product for index file
CN104317734A (en) Memory allocation method and device applicable to SLAB
CN103455433A (en) Memory management method and system
CN114327917A (en) Memory management method, computing device and readable storage medium
CN110399096A (en) Metadata of distributed type file system caches the method, apparatus and equipment deleted again
CN105760391B (en) Method, data node, name node and system for dynamically redistributing data
CN105468541A (en) Cache management method for transparent-computing-oriented intelligent terminal
US11119703B2 (en) Utilizing a set of virtual storage units distributed across physical storage units
US20210374048A1 (en) Method, electronic device, and computer program product for storage management
CN110109677B (en) Dynamic object cache pool allocation method
CN107526691B (en) Cache management method and device
CN113778688B (en) Memory management system, memory management method, and memory management device
CN115794417A (en) Memory management method and device

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication