CN101329655B - Memory management method and device - Google Patents

Memory management method and device Download PDF

Info

Publication number
CN101329655B
CN101329655B CN2008101175084A CN200810117508A CN101329655B CN 101329655 B CN101329655 B CN 101329655B CN 2008101175084 A CN2008101175084 A CN 2008101175084A CN 200810117508 A CN200810117508 A CN 200810117508A CN 101329655 B CN101329655 B CN 101329655B
Authority
CN
China
Prior art keywords
memory
pool
value
memory block
memory pool
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.)
Expired - Fee Related
Application number
CN2008101175084A
Other languages
Chinese (zh)
Other versions
CN101329655A (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 T3G Technology Co Ltd
Original Assignee
Beijing T3G 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 T3G Technology Co Ltd filed Critical Beijing T3G Technology Co Ltd
Priority to CN2008101175084A priority Critical patent/CN101329655B/en
Publication of CN101329655A publication Critical patent/CN101329655A/en
Application granted granted Critical
Publication of CN101329655B publication Critical patent/CN101329655B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Landscapes

  • Memory System (AREA)

Abstract

The invention provides a memory management method and a memory management device used in an embedded real-time operating system. The method comprises the following steps: a memory area of the system is divided into a plurality of memory pools; according to memory application or the size of released memory, corresponding memory pools are determined; the number of memory blocks in a memory pool that is required by the system at the current moment is obtained; the sum of the number of free memory blocks that can be provided by other memory pools at the current moment for the memory pool is obtained; a difference value of the number of the memory blocks in the memory pool that is required by the system at the current moment and the sum of free memory blocks that can be provided by other memory pools at the current moment for the memory pool is calculated; a comparison between the difference value and the current optimal value of the number of the memory blocks in the memory pool is carried out, and the relatively high value in the difference value and the current optimal value is taken as a new current optimal value; after the system operates for a preset time, the obtained current optimal value is taken as an optimal value of the number of the memory blocks in the memory pool; according to the obtained optimal value of the number of the memory blocks in the memory pool, memory allocation is carried out to a memory area. The method and the device of the invention can carry out reasonable setting to the sizes of the memory pools in the embedded real-time operating system.

Description

A kind of EMS memory management process and memory management device
Technical field
The present invention relates to the embedded real-time operating system field, relate in particular to a kind of EMS memory management process and memory management device.
Background technology
Embedded real-time operating system is widely used in various fields, being applied to high-quality precision and sophisticated technology in recent years especially reaches in the exigent field of real-time, as the application in communication system, feasible system performance to embedded real-time operating system has proposed very high requirement, and effectively memory management is one of key factor of safeguards system performance.Effectively memory management depends primarily on rapidity, reliability and the high efficiency of Memory Allocation.The rapidity of Memory Allocation is from the requirement of embedded real-time operating system to real-time, exist in the assigning process fast as much as possible in the requirement, thereby in embedded real-time operating system, can not adopt complicated and loaded down with trivial details Memory Allocation strategy in the general-purpose operating system, generally all adopt simply, Memory Distribution Map fast; The reliability of Memory Allocation then requires the request of Memory Allocation to be met, and in some applications, the consequence that Memory Allocation failure may bringing on a disaster property directly can cause system crash; The high efficiency of Memory Allocation then requires Memory Allocation little waste as much as possible.
In order to satisfy the memory management demand in the embedded real-time operating system, usually the EMS memory management process that adopts is to use the mode of internal memory block management, be about to the set (being memory pool) that Installed System Memory is divided into the memory block that comprises the plurality of fixed size, be illustrated in figure 1 as memory allocation method synoptic diagram in the prior art, this memory allocation method specifically may further comprise the steps:
Step 1: be big memory field of system assignment as required in advance;
Step 2: this memory field is divided into some subareas, i.e. several memory pools, same memory pool is made up of the identical memory block of some sizes.
The memory block of above-mentioned every kind of memory pool all can be organized into formation by static state or dynamic link table, when system's application internal memory, gets a free block from queue heads, is returned to rear of queue when giving back.For the ease of management, each memory pool also comprises a control and management head, and this control and management head comprises: free block formation owner pointer and idle queues tail pointer etc. in the size of memory block, memory block total amount, free memory block number, this memory pool in this memory pool.
As can be seen from Figure 1, the size of a memory pool has the decision of two factors: the size of memory block and memory block number in the memory pool generally are that a large amount of statistics and empirical estimating according to system operator gets to the setting of the size of memory block in the memory pool and memory block number in the prior art.
Above-mentioned memory allocation method has that seek rate is fast, system effectiveness is high, can not produce simultaneously advantages such as memory fragmentation, and the memory management that realizes based on this kind memory allocation method is efficiently simple, can satisfy communication system etc. to the demand of the exigent system of real-time to memory management.But, also there is weak point in this memory allocation method, mainly is to the setting of the size of memory pool difficulty relatively, depends on the experience of system operator, and this set has accounted for very consequence in EMS memory management process, directly influences the rapidity and the high efficiency of Memory Allocation.
Summary of the invention
In view of this, the embodiment of the invention provides a kind of EMS memory management process and memory management device, can reasonably set the size of the memory pool in the embedded real-time operating system.
For achieving the above object, the embodiment of the invention provides a kind of EMS memory management process, is used for embedded real-time operating system, and this method may further comprise the steps:
Steps A is divided into several memory pools with the Installed System Memory zoning, and the size of memory block and number cover all situations of described system to memory requirements in described several memory pools;
Step B when having the operation of internal memory application or internal memory release in described system, according to the size of described internal memory application or internal memory release, determines pairing first memory pool;
Step C, obtain described system current time to described first memory pool in the demand number of memory block, as first numerical value;
Step D obtains the free memory block number sum that the second memory pool current time can provide, and as second value, described second memory pool is the memory pools of all memory blocks greater than memory block in described first memory pool;
Step e is obtained the poor of described first numerical value and described second value, as third value;
Step F, with the current optimal value of memory block number in described third value and described first memory pool relatively, and with the higher value among both as new current optimal value, the third value of the initial value of described current optimal value for getting access to for the first time;
Repeated execution of steps B is to step F, until the described system operation schedule time;
Step G is after system moves the described schedule time, with the current optimal value that the gets access to optimal value as memory block number in described first memory pool;
Step H according to the optimal value of memory block number in all memory pools that get access to, carries out Memory Allocation to described memory field.
Describedly obtain the free memory block number sum that the second memory pool current time can provide, be specially as the method for second value:
Obtain the current optimal value of memory block number in described second memory pool;
Obtain described system current time to described second memory pool in the demand number of memory block;
Obtain above-mentioned both poor, as the free memory block number that offers described first memory pool;
Obtain the free memory block number sum that all described second memory pools can offer described first memory pool, as described second value.
The described schedule time is the time that the application program in the described system has all been moved.
Also comprise before the described step B:
Monitor the step whether described system exists the operation of internal memory application or internal memory release.
Also comprise before the described step H:
When the optimal value of memory block number is zero in described first memory pool, discharge the memory headroom of described first memory pool.
Described several memory pools are arranged in order from small to large according to the size of the memory block that comprises in it.
The computing formula of the optimal value of the memory block number of described first memory pool is:
d i = Max [ &Sigma; j = i j = n a j ( t ) ] - Max [ &Sigma; j = i + 1 j = n a j ( t ) ] , ( 1 &le; i < n )
d n=Max[a n(t)]
Wherein, d iBe the optimal value of memory block number in described first memory pool, a j(t) be described system at current time to memory pool a jThe demand number of middle memory block, i is the sequence number of described first memory pool, and t is described current time, and n is the number of the memory pool of Installed System Memory zoning branch, and j is an integer variable, Max represents to obtain the maximal value in the described schedule time.
The embodiment of the invention also provides a kind of memory management device, is used for embedded real-time operating system, and described device comprises:
Initialization module is used for described Installed System Memory zoning is divided into several memory pools, and the size of memory block and number cover all situations of described system to memory requirements in described several memory pools;
The memory pool determination module when being used for there is the operation that internal memory application or internal memory discharge in described system, according to the size that described internal memory application or internal memory discharge, is determined pairing first memory pool;
First acquisition module is used for obtaining described system in the demand number of current time to the described first memory pool memory block, as first numerical value;
Second acquisition module is used to obtain the free memory block number sum that the second memory pool current time can provide, and as second value, described second memory pool is the memory pools of all memory blocks greater than memory block in described first memory pool;
The 3rd acquisition module is used to obtain the poor of described first numerical value and described second value, as third value;
Update module is used for the current optimal value of described third value and the described first memory pool memory block number relatively, and with the higher value among both as new current optimal value, the third value of the initial value of described current optimal value for getting access to for the first time;
The optimal value determination module was used for after the system operation schedule time, with the current optimal value that the gets access to optimal value as memory block number in described first memory pool;
Memory allocating module is used for the optimal value according to all memory pool memory block numbers that get access to, and described memory field is carried out Memory Allocation.
Described second acquisition module further comprises:
First acquiring unit is used for obtaining the current optimal value of the described second memory pool memory block number;
Second acquisition unit is used for obtaining the demand number of described system current time to the described second memory pool memory block;
The 3rd acquiring unit is used to obtain above-mentioned both poor, as the free memory block number that offers described first memory pool;
The 4th acquiring unit is used to obtain the free memory block number sum that all described second memory pools can offer described first memory pool, as described second value.
The described schedule time is the time that the application program in the described system has all been moved.
Described device also comprises:
The internal memory monitoring module is used to monitor the operation whether described system exists internal memory application or internal memory to discharge.
Described device also comprises:
The internal memory release module is used for discharging the memory headroom of described first memory pool when the optimal value of the described first memory pool memory block number is zero.
Described several memory pools are arranged in order from small to large according to the size of the memory block that comprises in it.
The computing formula of the optimal value of the memory block number of described first memory pool is:
d i = Max [ &Sigma; j = i j = n a j ( t ) ] - Max [ &Sigma; j = i + 1 j = n a j ( t ) ] , ( 1 &le; i < n )
d n=Max[a n(t)]
Wherein, d iBe the optimal value of memory block number in described first memory pool, a j(t) be described system at current time to memory pool a jThe demand number of middle memory block, i is the sequence number of described first memory pool, and t is described current time, and n is the number of the memory pool of Installed System Memory zoning branch, and j is an integer variable, Max represents to obtain the maximal value in the described schedule time.
Embodiments of the invention have following beneficial effect:
In system's operation special time, by repeatedly calculating, obtain the optimal value of memory block number in the memory pool, carry out Memory Allocation according to this optimal value, guaranteed the reliability of Memory Allocation, the setting that has solved the memory pool in the embedded real-time operating system must depend on the problem of the experience of system operator; In addition, the idle big memory block in the memory pool is distributed to little internal memory application use, effectively reduce and alleviated the internal memory waste of memory pool existence, guaranteed the high efficiency of Memory Allocation.
Description of drawings
Fig. 1 is a memory allocation method synoptic diagram in the prior art;
Fig. 2 is the EMS memory management process synoptic diagram of the embodiment of the invention;
Fig. 3 is the memory management device synoptic diagram of the embodiment of the invention.
Embodiment
The embodiment of the invention provides a kind of EMS memory management process and memory management device that is used for embedded real-time operating system, idle big memory block in the memory pool is distributed to little internal memory application to be used, to reach the purpose of internal memory optimization, based on this principle of optimality, in system moves a period of time, calculate the optimal value of memory block number in each memory pool, solved the setting problem of the size of memory pool of the prior art.
Effectively memory management mainly is the optimization of Memory Allocation, promptly is under the prerequisite that does not influence system performance, makes the Installed System Memory district be used as much as possible, that is to say to make the memory field free memory block few more good more.The ultimate principle of internal memory optimization promptly is in the embodiment of the invention: the idle big memory block in the memory pool is distributed to little internal memory application use, to reach the purpose that the memory field is optimized.
Memory Allocation promptly is to determine the size of memory pool in the memory field, and the size of memory pool depends on two factors again: the number of memory block and size in the memory pool.
In the embodiment of the invention, when carrying out the memory pool initializing set, the number of memory block in the memory pool is covered all possible situation with big or small memory requirements according to system, after the memory block size of memory pool is determined, only need to calculate the optimal value of this memory block number, promptly can obtain the preferred plan of Memory Allocation, promptly when the optimal value of the memory block number of a certain memory pool that calculates greater than zero the time, then show the demand that compliance with system is set of memory block size in this memory pool; When the optimal value of the memory block number that calculates a certain memory pool is zero, show that then the size setting of memory block in this memory pool does not meet system requirements, delete this memory pool.
The optimal value of the memory block number of above-mentioned memory pool is: in system moves the schedule time, the maximal value of the memory block number that this memory pool need provide for system, the time that this schedule time can all have been moved for the application program in the system, the time that can certainly all move greater than the application program in the system is to obtain result of calculation more accurately;
Principle according to above-mentioned internal memory optimization, this memory pool need equal for the memory block number that system provides: first numerical value and second value poor, described first numerical value is: system current time to this memory pool in the demand number of memory block, described second value can offer the free memory block number sum of this memory pool greater than all memory pools of the memory block of this memory pool for all memory blocks, therefore only the maximal value of memory block number in this schedule time that this memory pool need provide for system need be calculated, the optimal value of memory block number in this memory pool can be obtained.
Below in conjunction with drawings and Examples, the specific embodiment of the present invention is described in further detail.
The EMS memory management process of the embodiment of the invention may further comprise the steps as shown in Figure 2:
Step 201 is divided into several memory pools with the Installed System Memory zoning, and the size of memory block and number covering system are to all situations of memory requirements in described several memory pools.
The operation whether step 202, supervisory system exist internal memory application or internal memory to discharge, if, enter step 203, otherwise, execution in step 202 continued.
Step 203 when having the operation of internal memory application or internal memory release in system, according to the size of internal memory application or internal memory release, is determined pairing first memory pool.
Step 204, obtain system current time to first memory pool in the demand number of memory block, as first numerical value.
Step 205 is obtained the free memory block number sum that the second memory pool current time can provide, and as second value, described second memory pool is the memory pools of all memory blocks greater than the memory block of first memory pool.
When memory block length in first memory pool is maximum, then there are not other memory pools can offer the first memory pool free memory block, promptly second memory pool does not exist; When the memory block length in first memory pool was not maximum, second memory pool was the memory pool of memory block greater than the memory block of first memory pool, and second memory pool is one or more.
Step 206 is obtained the poor of first numerical value and second value, as third value.
The memory block number that described third value need provide for system for this memory pool current time.
Step 207, with the current optimal value of memory block number in the described third value and first memory pool relatively, and with the higher value among both as new current optimal value, the third value of the initial value of described current optimum solution for getting access to for the first time.
Step 208 judges whether system moves the schedule time, if, enter step 209, otherwise, step 202 returned.
The time that the described schedule time has all been moved more than or equal to the application program in the system, promptly in this schedule time, can obtain the memory requirements of all application programs in the system.
Step 209 is after system moves the schedule time, with the optimal value of current optimal value as memory block number in first memory pool.
Step 210, the optimal value according to the memory block number of all memory pools that get access to is provided with the memory pool in the described memory field.
Said method also comprises:
When the optimal value of memory block number is zero in first memory pool, discharge the step of the memory headroom of first memory pool.
Above-mentioned steps 205 specifically may further comprise the steps:
Obtain the current optimal value of the memory block number of second memory pool;
Obtain system current time to second memory pool in the demand number of memory block;
Obtain above-mentioned both poor, as the free memory block number that offers first memory pool;
Obtain the free memory block number sum that all second memory pools can offer first memory pool, as second value.
Said method is elaborated and discusses below in conjunction with specific embodiment.
At first with the initialization of Installed System Memory district: the memory field is divided into n memory pool, for convenience of description, suppose that this n group memory pool is that size according to the memory block that comprises in it is arranged in order from small to large, the memory block number of those memory pools and size can cover all possible situation according to the memory requirements of system, for example, size that can memory block is set to memory pool a iThe function f (i) of sequence number i, supposing the system is 4byte to the minimum essential requirement of internal memory, then is the memory pool a of i for sequence number i, can be with the big or small l of its memory block iBe l i=f (i)=4i can certainly be according to different demands, and the size of memory block is set to other functions of sequence number i.
For above-mentioned Installed System Memory district with n group memory pool, system at moment t to memory pool a iThe number of middle memory block demand is designated as a i(t), wherein, memory pool a nThe length maximum of middle memory block, memory pool a 1The length minimum of middle memory block.
For memory pool a n, there is not other bigger memory block can offer its use, therefore, memory pool a nThe optimal value d of memory block number nBe exactly a n(t) maximal value that occurs in the operation schedule time in system, optimal value d nWith a n(t) relation is as shown in Equation (1):
d n=Max[a n(t)] (1)
For memory pool a N-1, have only memory pool a nIn free memory block can offer its use, therefore, at moment t, memory pool a n(t) can offer a N-1The memory block number be (d n-a n(t)), therefore, memory pool a N-1The memory block number p that only need provide for system at moment t N-1(t) be (a N-1(t)-(d n-a n(t))), can satisfy system to memory pool a N-1The demand of middle memory block, p N-1(t) can be expressed as formula (2):
p n-1(t)=a n-1(t)-(d n-a n(t)) (2)
Memory pool a N-1The optimal value d of memory block number N-1Be p N-1(t) maximal value that occurs in the given time, d N-1Computing formula as follows:
d n-1=Max[p n-1(t)]=Max[a n-1(t)-(d n-a n(t))]
(3)
=Max[a n-1(t)+a n(t)]-Max[a n(t)]
For the either memory pond a in this n group memory pool k, all sequence numbers are greater than memory pool a kMemory pool in free memory block can offer memory pool a kUse memory pool a kThe optimal value d of memory block number kBe p k(t) maximal value that occurs in the given time, d kComputing formula as follows:
d k = Max [ p k ( t ) ]
= Max [ &Sigma; j = k j = n a j ( t ) ] - Max [ &Sigma; j = k + 1 j = n a j ( t ) ] - - - ( 4 )
For convenience of description, will ( Max [ &Sigma; j = k j = n a j ( t ) ] ) Be designated as c k, that is:
c k = Max [ &Sigma; j = k j = n a j ( t ) ] - - - ( 5 )
For this reason, only need proof memory pool a K-1The optimal value d of memory block number K-1Also satisfy formula (4), the optimal value that can draw memory block number in each memory pool in this n group all satisfies formula (4).
Obtain memory pool a K-1The method of the optimal value of middle memory block number is as follows:
For memory pool a K-1, sequence number is than its big some memory pool a K-1+lCan offer memory pool a at moment t K-1The free memory block number q that uses K-1+l(t) be designated as formula (6):
q k-1+l(t)=d k-1+l-a k-1+l(t)=c k-1+l-c k+l-a k-1+l(t) (6)
All sequence numbers are than memory pool a K-1Big memory pool can offer the free memory block of its use at moment t total number is:
&Sigma; l = 1 l = n - k + 1 q k - 1 + l ( t ) = ( c k - c k + 1 - a k ( t ) ) + ( c k + 1 - c k + 2 - a k + 1 ( t ) ) + . . . + c n - a n ( t )
= c k - &Sigma; l = 1 l = n - k + 1 a k - 1 + l ( t ) - - - ( 7 )
At moment t, system is to memory pool a K-1The requirements a of middle memory block K-1(t), equal memory pool a K-1The memory block number p that need provide for system K-1(t), add that other memory pool can offer memory pool a K-1The free memory block number of using is in conjunction with above-mentioned formula (7), p K-1(t) can be expressed as:
p k - 1 ( t ) = a k - 1 ( t ) - &Sigma; l = 1 l = n - k + 1 q k - 1 + l ( t ) - - - ( 8 )
= &Sigma; l = 0 l = n - k + 1 a k - 1 + l ( t ) - c k
Memory pool a K-1The optimal value d of memory block number K-1Be p K-1(t) maximal value that occurs in the given time, d K-1Computing formula as follows:
d k - 1 = Max [ p k - 1 ( t ) ] = Max [ &Sigma; l = 0 l = n - k + 1 a k - 1 + l ( t ) - c k ]
= Max [ &Sigma; l = 0 l = n - k + 1 a k - 1 + l ( t ) ] - c k - - - ( 9 )
= c k - 1 - c k
Can draw from above-mentioned inference, the optimal value of memory block number all satisfies formula (4) in each memory pool in this n group.
Can draw thus for n group memory pool, wherein any memory pool a to be optimized iThe optimal value d of memory block number iAll can be expressed as:
d i = Max [ &Sigma; j = i j = n a j ( t ) ] - Max [ &Sigma; j = i + 1 j = n a j ( t ) ] , ( 1 &le; i < n ) - - - ( 10 )
And for the memory pool a of memory block length maximum n, the optimal value d of its memory block number nCan be expressed as:
d n=Max[a n(t)] (11)
The memory management device of the embodiment of the invention comprises as shown in Figure 3:
Initialization module 101 is used for the Installed System Memory zoning is divided into several memory pools, and the size of the memory block in described several memory pools and number covering system are to all situations of memory requirements.
Internal memory monitoring module 102 is used for the operation whether supervisory system exists internal memory application or internal memory to discharge.
Memory pool determination module 103 when being used for there is the operation that internal memory application or internal memory discharge in system, according to the size that internal memory application or internal memory discharge, is determined pairing first memory pool.
First acquisition module 104 is used for the system that obtains in the demand number of current time to the first memory pool memory block, as first numerical value.
Second acquisition module 105 is used to obtain the free memory block number sum that the second memory pool current time can provide, and as second value, described second memory pool is the memory pools of all memory blocks greater than memory block in first memory pool.
The 3rd acquisition module 106 is used to obtain the poor of first numerical value and second value, as third value.
Update module 107 is used for the current optimal value comparison with the memory block number of the described third value and first memory pool, and as new current optimal value, the initial value of described current optimal value is the third value that gets access to for the first time with the higher value among both.
Optimal value determination module 108 is used in system after the operation schedule time, with the optimal value of current optimal value as memory block number in first memory pool.
Internal memory release module 109 is used for discharging the memory headroom of first memory pool when the optimal value of the first memory pool memory block number is zero.
Memory setting module 110 is used for the optimal value according to the memory block number of all memory pools that get access to, and the memory field is carried out Memory Allocation.
Above-mentioned second acquisition module 104 further comprises:
First acquiring unit is used for obtaining the current optimal value of the second memory pool memory block number.
Second acquisition unit is used for obtaining the demand number of system's current time to the described second memory pool memory block.
The 3rd acquiring unit is used to obtain above-mentioned both poor, as the free memory block number that offers first memory pool.
The 4th acquiring unit is used to obtain the free memory block number sum that all second memory pools can offer first memory pool, as second value.
According to above-mentioned inference, when described several memory pools were arranged in order from small to large according to the size of the memory block that comprises in it, the computing formula of the optimal value of the memory block number of first memory pool was:
d i = Max [ &Sigma; j = i j = n a j ( t ) ] - Max [ &Sigma; j = i + 1 j = n a j ( t ) ] , ( 1 &le; i < n )
d n=Max[a n(t)]
Wherein, d iBe the optimal value of memory block number in first memory pool, a j(t) be system at current time to memory pool a jThe demand number of middle memory block, i is the sequence number of first memory pool, and t is a current time, and n is the number of the memory pool of Installed System Memory zoning branch, and j is an integer variable, Max represents to obtain the maximal value in the schedule time.
The above only is a preferred implementation of the present invention; should be pointed out that for those skilled in the art, under the prerequisite that does not break away from the principle of the invention; can also make some improvements and modifications, these improvements and modifications also should be considered as protection scope of the present invention.

Claims (14)

1. an EMS memory management process is used for embedded real-time operating system, it is characterized in that, may further comprise the steps:
Steps A is divided into several memory pools with the Installed System Memory zoning; Wherein, memory pool a iThe size of middle memory block is memory pool a iThe function f (i) of sequence number i, the number of memory block is the function a of t constantly i(t);
Step B when having the operation of internal memory application or internal memory release in described system, according to the size of described internal memory application or internal memory release, determines pairing first memory pool;
Step C, obtain described system current time to described first memory pool in the demand number of memory block, as first numerical value;
Step D obtains the free memory block number sum that the second memory pool current time can provide, and as second value, described second memory pool is the memory pools of all memory blocks greater than memory block in described first memory pool;
Step e is obtained the poor of described first numerical value and described second value, as third value;
Step F, with the current optimal value of memory block number in described third value and described first memory pool relatively, and with the higher value among both as new current optimal value, the third value of the initial value of described current optimal value for getting access to for the first time;
Repeated execution of steps B is to step F, until the described system operation schedule time;
Step G is after system moves the described schedule time, with the current optimal value that the gets access to optimal value as memory block number in described first memory pool;
Step H according to the optimal value of memory block number in all memory pools that get access to, carries out Memory Allocation to described memory field.
2. EMS memory management process according to claim 1 is characterized in that, describedly obtains the free memory block number sum that the second memory pool current time can provide, and is specially as the method for second value:
Obtain the current optimal value of memory block number in described second memory pool;
Obtain described system current time to described second memory pool in the demand number of memory block;
Obtain above-mentioned both poor, as the free memory block number that offers described first memory pool;
Obtain the free memory block number sum that all described second memory pools can offer described first memory pool, as described second value.
3. EMS memory management process according to claim 1 is characterized in that, the described schedule time is the time that the application program in the described system has all been moved.
4. EMS memory management process according to claim 1 is characterized in that, also comprises before the described step B:
Monitor the step whether described system exists the operation of internal memory application or internal memory release.
5. EMS memory management process according to claim 1 is characterized in that, also comprises before the described step H:
When the optimal value of memory block number is zero in described first memory pool, discharge the memory headroom of described first memory pool.
6. EMS memory management process according to claim 1 is characterized in that, described several memory pools are arranged in order from small to large according to the size of the memory block that comprises in it.
7. EMS memory management process according to claim 6 is characterized in that, the computing formula of the optimal value of the memory block number of described first memory pool is:
d n=Max[a n(t)]
Wherein, d iBe the optimal value of memory block number in described first memory pool, a j(t) be described system at current time to memory pool a jThe demand number of middle memory block, i is the sequence number of described first memory pool, and t is described current time, and n is the number of the memory pool of Installed System Memory zoning branch, and j is an integer variable, Max represents to obtain the maximal value in the described schedule time.
8. a memory management device is used for embedded real-time operating system, it is characterized in that, comprising:
Initialization module is used for described Installed System Memory zoning is divided into several memory pools; Wherein, memory pool a iThe size of middle memory block is memory pool a iThe function f (i) of sequence number i, the number of memory block is the function a of t constantly i(t);
The memory pool determination module when being used for there is the operation that internal memory application or internal memory discharge in described system, according to the size that described internal memory application or internal memory discharge, is determined pairing first memory pool;
First acquisition module is used for obtaining described system in the demand number of current time to the described first memory pool memory block, as first numerical value;
Second acquisition module is used to obtain the free memory block number sum that the second memory pool current time can provide, and as second value, described second memory pool is the memory pools of all memory blocks greater than memory block in described first memory pool;
The 3rd acquisition module is used to obtain the poor of described first numerical value and described second value, as third value;
Update module is used for the current optimal value of described third value and the described first memory pool memory block number relatively, and with the higher value among both as new current optimal value, the third value of the initial value of described current optimal value for getting access to for the first time;
The optimal value determination module was used for after the system operation schedule time, with the current optimal value that the gets access to optimal value as memory block number in described first memory pool;
Memory allocating module is used for the optimal value according to all memory pool memory block numbers that get access to, and described memory field is carried out Memory Allocation.
9. memory management device according to claim 8 is characterized in that, described second acquisition module further comprises:
First acquiring unit is used for obtaining the current optimal value of the described second memory pool memory block number;
Second acquisition unit is used for obtaining the demand number of described system current time to the described second memory pool memory block;
The 3rd acquiring unit is used to obtain above-mentioned both poor, as the free memory block number that offers described first memory pool;
The 4th acquiring unit is used to obtain the free memory block number sum that all described second memory pools can offer described first memory pool, as described second value.
10. memory management device according to claim 8 is characterized in that, the described schedule time is the time that the application program in the described system has all been moved.
11. memory management device according to claim 8 is characterized in that, also comprises:
The internal memory monitoring module is used to monitor the operation whether described system exists internal memory application or internal memory to discharge.
12. memory management device according to claim 8 is characterized in that, also comprises:
The internal memory release module is used for discharging the memory headroom of described first memory pool when the optimal value of the described first memory pool memory block number is zero.
13. memory management device according to claim 8 is characterized in that, described several memory pools are arranged in order from small to large according to the size of the memory block that comprises in it.
14. memory management device according to claim 13 is characterized in that, the computing formula of the optimal value of the memory block number of described first memory pool is:
Figure RE-FSB00000570379500011
d n=Max[a n(t)]
Wherein, d iBe the optimal value of memory block number in described first memory pool, a j(t) be described system at current time to memory pool a jThe demand number of middle memory block, i is the sequence number of described first memory pool, and t is described current time, and n is the number of the memory pool of Installed System Memory zoning branch, and j is an integer variable, Max represents to obtain the maximal value in the described schedule time.
CN2008101175084A 2008-07-31 2008-07-31 Memory management method and device Expired - Fee Related CN101329655B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN2008101175084A CN101329655B (en) 2008-07-31 2008-07-31 Memory management method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN2008101175084A CN101329655B (en) 2008-07-31 2008-07-31 Memory management method and device

Publications (2)

Publication Number Publication Date
CN101329655A CN101329655A (en) 2008-12-24
CN101329655B true CN101329655B (en) 2011-09-28

Family

ID=40205470

Family Applications (1)

Application Number Title Priority Date Filing Date
CN2008101175084A Expired - Fee Related CN101329655B (en) 2008-07-31 2008-07-31 Memory management method and device

Country Status (1)

Country Link
CN (1) CN101329655B (en)

Families Citing this family (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102317925B (en) * 2009-02-12 2014-07-23 株式会社东芝 Memory system and method of controlling memory system
US8225065B2 (en) * 2010-06-03 2012-07-17 Microsoft Corporation Hierarchical scalable memory allocator
US9218135B2 (en) 2010-06-16 2015-12-22 Microsoft Technology Licensing, Llc Hierarchical allocation for file system storage device
CN101847127B (en) * 2010-06-18 2012-01-25 福建星网锐捷网络有限公司 Memory management method and device
CN101937398B (en) * 2010-09-14 2014-03-12 中兴通讯股份有限公司 Configuration method and device for built-in system memory pool
CN101968772B (en) * 2010-10-22 2013-01-16 烽火通信科技股份有限公司 Method for implementing efficient memory pool of embedded system
CN104008062B (en) * 2013-02-25 2018-03-27 腾讯科技(深圳)有限公司 EMS memory management process and memory management device
WO2016127291A1 (en) * 2015-02-09 2016-08-18 华为技术有限公司 Memory management device and method
CN108108307A (en) * 2016-11-24 2018-06-01 中移(杭州)信息技术有限公司 A kind of method for processing resource and terminal
CN108255608B (en) * 2018-01-10 2020-07-31 武汉斗鱼网络科技有限公司 Management method of memory pool

Also Published As

Publication number Publication date
CN101329655A (en) 2008-12-24

Similar Documents

Publication Publication Date Title
CN101329655B (en) Memory management method and device
EP3483730B1 (en) Resource allocation method and resource manager
CN102222014B (en) Dynamic memory management method based on memory hot plug for virtual machine
CN101702138B (en) Memory management method, memory management system and server
KR101733117B1 (en) Task distribution method on multicore system and apparatus thereof
CN108540568B (en) Computing capacity sharing method and intelligent equipment
CN102902587A (en) Distribution type task scheduling method, distribution type task scheduling system and distribution type task scheduling device
CN104021040A (en) Cloud computing associated task scheduling method and device based on time constraint
CN103049213B (en) A kind of disk-scheduling method and device
CN109074281B (en) Method and device for distributing graphics processor tasks
CN105117285B (en) A kind of nonvolatile memory method for optimizing scheduling based on mobile virtual system
CN101145112A (en) Real-time system task scheduling method
CN102843419A (en) Service resource allocation method and service resource allocation system
CN104050137B (en) The method and device that kernel is run in a kind of OS
CN111638953B (en) Method, device and storage medium for realizing GPU virtualization
CN106445070B (en) Energy consumption optimization scheduling method for hard real-time system resource-limited sporadic tasks
CN103503412A (en) Method and device for scheduling resources
CN103914346A (en) Group-based dual-priority task scheduling and energy saving method for real-time operating system
CN104182356B (en) A kind of EMS memory management process, device and terminal device
CN106528065B (en) A kind of thread acquisition methods and equipment
CN115981863A (en) Intelligent cloud resource elastic expansion method and system combining business characteristics
CN103218254B (en) A kind of AFC (Automatic Fare Collection) data processing method of many queues
CN112905330B (en) Fixed priority hybrid key sporadic task energy consumption sensing method
CN101833450A (en) Timing method and device
CN103412796A (en) Stack allocation method and stack allocation unit for tasks in operating system

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20110928

Termination date: 20180731