CN106354659A - Method on FLASH resource recovery of embedded device - Google Patents
Method on FLASH resource recovery of embedded device Download PDFInfo
- Publication number
- CN106354659A CN106354659A CN201610749987.6A CN201610749987A CN106354659A CN 106354659 A CN106354659 A CN 106354659A CN 201610749987 A CN201610749987 A CN 201610749987A CN 106354659 A CN106354659 A CN 106354659A
- Authority
- CN
- China
- Prior art keywords
- cleaning cycle
- flash
- load factor
- cpu
- availability ratio
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F12/00—Accessing, addressing or allocating within memory systems or architectures
- G06F12/02—Addressing or allocation; Relocation
- G06F12/0223—User address space allocation, e.g. contiguous or non contiguous base addressing
- G06F12/023—Free address space management
- G06F12/0253—Garbage collection, i.e. reclamation of unreferenced memory
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Memory System (AREA)
Abstract
The invention relates to a method on FLASH resource recovery of embedded device, comprising the steps of real-time detection of CUP load rate and space utilization rate of Flash; Determine cleaning cycle (time interval for cleaning) for back-end resource recovery based on CUP load rate and space utilization rate of Flash; the less CUP load rate, the shorter corresponding cleaning cycle. The more CUP load rate, the larger corresponding cleaning cycle, and the higher space utilization rate of Flash, the shorter corresponding cleaning cycle. The lower space utilization rate of Flash, the larger corresponding cleaning cycle; Conduct trash recycling according to determined cleaning cycle. Through adjusts the cleaning cycle for back-end resource recovery on a real time basis, the method on FLASH resource recovery of embedded deviceconducts timing recovery cleaning for FLASH resource so as to avoid abnormal operation of the equipment caused by inadequate effective resource.
Description
Technical field
The present invention relates to a kind of method of the flash resource reclaim of embedded device, belong to embedded device technology field.
Background technology
Embedded device is high to the reliability requirement of itself, finds when some unpredictable factors or not
Potential danger lead to flash waste resources to reclaim not in time, file operation can be caused to take the abnormal conditions such as long, or even meeting
Cause certain operations cannot normally run, ultimately result in embedded device and produce unpredictable danger.In this case, will
It is difficult to ensure that equipment reliability of operation and safety, or even whole system can be caused with serious consequence.
Therefore, in time flash resource is reclaimed, avoid the equipment causing because equipment efficient resource is not enough as far as possible
The unusual condition being not normally functioning, becomes the major issue in embedded device application.
Content of the invention
The purpose of the present invention is to propose to a kind of method of the flash resource reclaim of embedded device, for solving due to setting
Standby backstage resource reclaim leads to the technical problem that equipment is not normally functioning not in time.
For solving above-mentioned technical problem, the method that the present invention proposes a kind of flash resource reclaim of embedded device, bag
Include:
Step 1, real-time detection cpu load factor and flash space availability ratio;
Step 2, determines the cleaning cycle of backstage resource reclaim according to described cpu load factor and flash space availability ratio;Institute
State the more low corresponding cleaning cycle of cpu load factor less, the more high corresponding cleaning cycle of described cpu load factor is bigger;Institute
State the more high corresponding cleaning cycle of flash space availability ratio less, the more low corresponding cleaning cycle of flash space availability ratio is more
Greatly;
Step 3, the cleaning cycle according to described determination carries out garbage reclamation.
Further, in step 2, corresponding described cleaning cycle scope is judged according to described cpu load factor, according to described
Flash space availability ratio determines specific cleaning cycle in the range of the corresponding cleaning cycle of described judgement.
Further, the size of described cleaning cycle is also relevant with device characteristics, described device characteristics include cpu speed,
Cpu average load, flash space size and flash space availability ratio.
Further, the meansigma methodss of the more low corresponding described cleaning cycle scope of cpu load factor described in step 2 are lower,
The meansigma methodss of the more high corresponding described cleaning cycle scope of described cpu load factor are higher.
Further, in step 2 when described flash space availability ratio is higher than to set threshold values, equipment is reported to the police.
The invention has the beneficial effects as follows:
Load according to cpu and the situation of flash residue efficient resource, automatically adjustment flash waste resources recovery
Speed Effec-tive Function in the state of efficient resource abundance it is ensured that equipment is tried one's best.During built-in equipment operation, according to
Cpu loading condition and efficient resource Spatial Residual situation adjust to the cleaning cycle of waste resources recovery, in real time not
Ensure that efficient resource space is sufficient in the case of affecting other task runs, it is to avoid the exception causing due to inadequate resource as far as possible
Situation.
Once the unusual condition of efficient resource wretched insufficiency occurs it is also possible to and alarm it is ensured that equipment run peace
Full property and reliability.
Brief description
Fig. 1 is cleaning cycle and the schematic diagram of cleaning cycle scope;
Fig. 2 is the flow chart of the flash its recovery method as resource of embedded device;
Fig. 3 is cpu load detecting task schematic diagram;
Fig. 4 is the schematic diagram of cleaning cycle scope under different cpu load.
Specific embodiment
Below in conjunction with the accompanying drawings the present invention is described in detail.
A kind of method of the flash resource reclaim of embedded device that the present invention provides, is born by the cpu that real-time detection arrives
Load rate and flash space availability ratio determining the cleaning cycle of backstage resource reclaim, between the time that is, equipment clears up internal memory every time
Every, and internal memory is cleared up according to this specific cleaning cycle timing.
Before specifically introducing the method, first cleaning cycle scope is described in detail.
As shown in figure 1, the cleaning cycle of embedded device backstage resource reclaim is arranged in order according to size order, specifically often
The size of individual cleaning cycle is by device characteristics such as cpu speed, cpu average load, flash space size and flash space utilization
Rate is determining.Wherein, the determination of cleaning cycle does not have specifically theoretic formula, is drawn based on the application of a large amount of concrete engineerings
Empirical equation is expressed as:
Wherein t represents cleaning cycle, and coefficient is an empirical coefficient relevant with concrete engineering application, free_
Block represents efficient resource surpluses, and complexity represents the system complexity of different business, and erase_speed represents block
Erasing speed, gc_ability represents the garbage reclamation ability of system itself, and fcpu represents cpu basic frequency, need_space table
Show flash remaining space size.
Cleaning cycle Range Representation, for the multiple cleaning cycle values being arranged according to size order, takes wherein one section model
The set that multiple cleaning cycle values closed in enclosing are formed.
The meansigma methodss defining cleaning cycle scope are expressed as the average of all cleaning cycle values in the range of this cleaning cycle
Value.During built-in equipment operation, the change of the cpu load factor that the meansigma methodss of cleaning cycle scope arrive according to real-time detection
Situation is changed, and the meansigma methodss of the more low corresponding cleaning cycle scope of cpu load factor are lower, cpu load factor higher right
The meansigma methodss of the cleaning cycle scope answered are higher.
The size defining cleaning cycle scope is expressed as the number of all cleaning cycle values in the range of this cleaning cycle.?
During built-in equipment operation, the size of cleaning cycle scope determines according to the size of cpu load factor excursion.Example
As: during embedded device uses, cpu load excursion is big, and when idle, load factor is 10%, negative when busy
Load rate is up to 99%, and now corresponding cleaning cycle scope ratio is larger, comprises more to clear up week in the range of this cleaning cycle
Time value;During embedded device uses, cpu load excursion is little, and when idle, load factor is 60%, when busy
Load factor is 70%, and now corresponding cleaning cycle scope is smaller, comprises less cleaning week in the range of this cleaning cycle
Time value.
In the embodiment in figure 1, the size of cleaning cycle scope is 11, comprises 11 kinds of cleanings in the range of this cleaning cycle
In the cycle, the higher limit of this cleaning cycle scope is 2000, and lower limit is 500.During embedded device uses, if cpu bears
The scope substantially constant of load rate change, then in this constant excursion, if cpu load factor is changed from small to big, corresponding
Cleaning cycle scope can move right;If cpu load factor is from large to small, corresponding cleaning cycle scope can be moved to the left.
During embedded device uses, if the scope of cpu load factor change changes, then corresponding cleaning week
The size of phase scope also will accordingly adjust.If now the excursion of cpu load factor becomes big, cleaning cycle scope big
Little also can mutually strain big, may be equivalent for 12,13 or 14;If the excursion of cpu load factor diminishes, cleaning cycle scope
Size also can accordingly diminish, may be equivalent for 10,9 or 8.
A kind of method of the flash resource reclaim of embedded device, with reference to Fig. 2, specifically includes:
Step 1, real-time detection cpu load factor and flash space availability ratio;
Step 2, determines the cleaning cycle of backstage resource reclaim according to described cpu load factor and flash space availability ratio;Institute
State the more low corresponding cleaning cycle of cpu load factor less, the more high corresponding cleaning cycle of described cpu load factor is bigger;Institute
State the more high corresponding cleaning cycle of flash space availability ratio less, the more low corresponding cleaning cycle of flash space availability ratio is more
Greatly;
Step 3, the cleaning cycle according to described determination carries out garbage reclamation.
For step 1, in running, the load factor of cpu is continually changing embedded device, needs real-time detection
The loading condition of cpu, the method wherein implementing cpu load detecting task is as shown in Figure 3:
In the initial phase of Detection task, first record the time interval of one section of constant time lag, due to now other tasks
All do not start to run, so the time interval of this constant time lag is a more accurate standard reference time interval.
In Detection task run duration, record the standard reference time interval of one section of constant time lag, this standard reference time
As being spaced the time interval being recorded with Detection task initial phase.In equipment run duration, excellent due to Detection task
First level is minimum, as long as so there being other task runs, will interrupt this Detection task and going to execute other tasks, until other tasks
It is carried out finishing and is in suspended state, this Detection task just can continue to execute.So cpu task is more, execution is more frequent,
Interval actual time needed for time interval of record constant time lag is longer.Between the actual time that equipment run duration is obtained
It is compared, every being spaced with standard reference time, the occupation rate that just can obtain cpu, and then calculate the load of cpu, and
According to the loading condition of cpu, the threshold value of adjustment programme code segment self-inspection.After the completion of each Detection task of cpu load, detection
Task enters dormancy, and ready for next Detection task.
For step 2, if cpu load factor excursion is constant, the size of corresponding cleaning cycle scope is constant, then
In the range of this fixing cleaning cycle, if cpu load factor ratio is relatively low, the meansigma methodss of corresponding cleaning cycle scope are also accordingly relatively
Low, that is, the value of the cleaning cycle in the range of this cleaning cycle is relatively small, with reduce backstage resource reclaim Detection task when
Between, improve garbage reclamation speed;If cpu load factor is higher, the meansigma methodss of corresponding cleaning cycle scope are also accordingly higher, that is,
The value of the cleaning cycle in the range of this cleaning cycle is relatively large, to increase the time of backstage resource reclaim Detection task, fall
Low garbage reclamation speed, mitigates cpu load.
For the cleaning cycle scope of a determination, which cleaning cycle in the range of this corresponding cleaning cycle specifically chosen
Value be then by real-time detection to flash space availability ratio to determine, the wherein acquisition of flash space availability ratio can be according to existing
In technology, the detection method of flash space availability ratio is realized.
In the case that flash space availability ratio is higher, cleaning cycle selects in the range of corresponding cleaning cycle relatively
Little cleaning cycle value, in flash space availability ratio ratio in the case of relatively low, cleaning cycle selects in corresponding cleaning cycle scope
Interior larger cleaning cycle value.
For step 3, equipment needs to realize the Detection task of resource reclaim, when Detection task initializes, needs to define
The default value of garbage reclamation cleaning cycle, such as: reclaim cleaning cycle and be set as 400ms, then one will be carried out every 400ms
The garbage reclamation on secondary backstage.In Detection task run duration, when arriving the garbage-cleaning time, backstage collection process starts, and leads to
Cross the relevant parameter of search file system, realize resource reclaim.After the completion of resource reclaim task, loaded according to real-time detection cpu
Rate and the specific cleaning cycle value of flash space availability ratio determination, the time interval that the next background garbage of adjustment reclaims.
In the case that the excursion of cpu load factor will not change, the size of corresponding cleaning cycle scope is constant,
Lower mask body, explains the change with cpu load factor taking Fig. 4 as a example, and cleaning cycle specifically determines method:
Cpu low-load state: when cpu occupation rate is less than 30%, now cpu duty factor is relatively low, cleaning cycle scope
Meansigma methodss less it can be seen that cleaning cycle scope now is 100ms to 900ms, include 11 cleaning cycles altogether, specifically
Select which cleaning cycle value is accomplished by being determined by remaining efficient resource, that is, need according to the remaining degree of efficient resource at this
Corresponding cleaning cycle is selected in the range of cleaning cycle.When efficient resource surpluses are more, resource is described enough, rubbish
The demand reclaiming is not urgent, can select the cleaning cycle of 900ms;When efficient resource surpluses are fewer, garbage reclamation
Demand just relatively more urgent, the cleaning cycle of 100ms can be selected, accelerate garbage reclamation.
Load condition in cpu: when cpu occupation rate is 60% about, now cpu loads larger, cleaning cycle model
The meansigma methodss enclosed become big and include 11 cleaning cycles altogether it can be seen that cleaning cycle scope now is 300ms to 1600ms,
Which cleaning cycle value specifically chosen is accomplished by being determined by remaining efficient resource.When efficient resource surpluses are more,
Resource is described enough, the demand of garbage reclamation is not urgent, can select the cleaning cycle of 1600ms;Efficient resource surpluses compare
When few, the demand of garbage reclamation is just relatively more urgent, can select the cleaning cycle of 300ms, accelerates garbage reclamation.
Cpu high load condition: when cpu occupation rate is more than 90%, now cpu load is very big, cleaning cycle scope
Meansigma methodss are relatively large it can be seen that cleaning cycle scope now is 600ms to 2200ms, include 11 cleaning cycles altogether,
Which cleaning cycle value specifically chosen is accomplished by being determined by remaining efficient resource.When efficient resource surpluses are more,
Resource is described enough, the demand of garbage reclamation is not urgent, can select the cleaning cycle of 2200ms;Efficient resource surpluses compare
When few, the demand of garbage reclamation is just relatively more urgent, can select the cleaning cycle of 600ms, accelerates garbage reclamation.
Certainly, the cleaning cycle in Fig. 4 and cleaning cycle scope are only a kind of specific embodiment, need in practical application
More accurately to be set according to the demand of embedded device and business.
In addition, during built-in equipment operation, resource reclaim specific cleaning cycle in backstage can also account for according to cpu
Rate and flash space availability ratio situation is had directly to be calculated or table look-up to obtain.
Claims (5)
1. a kind of method of the flash resource reclaim of embedded device is it is characterised in that comprise the following steps:
Step 1, real-time detection cpu load factor and flash space availability ratio;
Step 2, determines the cleaning cycle of backstage resource reclaim according to described cpu load factor and flash space availability ratio;Described
The more low corresponding cleaning cycle of cpu load factor is less, and the more high corresponding cleaning cycle of described cpu load factor is bigger;Described
The more high corresponding cleaning cycle of flash space availability ratio is less, and the more low corresponding cleaning cycle of flash space availability ratio is bigger;
Step 3, the cleaning cycle according to described determination carries out garbage reclamation.
2. the method for the flash resource reclaim of embedded device according to claim 1 is it is characterised in that root in step 2
Judge corresponding described cleaning cycle scope according to described cpu load factor, determined according to described flash space availability ratio and sentence described
Specific cleaning cycle in the range of fixed cleaning cycle.
3. the method for the flash resource reclaim of embedded device according to claim 1 is it is characterised in that described cleaning
The size in cycle is also relevant with device characteristics, and described device characteristics include cpu speed, cpu average load, flash space size
With flash space availability ratio.
4. the method for the flash resource reclaim of embedded device according to claim 2 is it is characterised in that institute in step 2
The meansigma methodss stating the more low corresponding described cleaning cycle scope of cpu load factor are lower, and described cpu load factor is more high corresponding described
The meansigma methodss of cleaning cycle scope are higher.
5. the method for the flash resource reclaim of embedded device according to claim 1 is it is characterised in that in step 2
When described flash space availability ratio is higher than to set threshold values, equipment is reported to the police.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610749987.6A CN106354659B (en) | 2016-08-29 | 2016-08-29 | A kind of method of the FLASH resource reclaim of embedded device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201610749987.6A CN106354659B (en) | 2016-08-29 | 2016-08-29 | A kind of method of the FLASH resource reclaim of embedded device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN106354659A true CN106354659A (en) | 2017-01-25 |
CN106354659B CN106354659B (en) | 2019-07-19 |
Family
ID=57855545
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201610749987.6A Active CN106354659B (en) | 2016-08-29 | 2016-08-29 | A kind of method of the FLASH resource reclaim of embedded device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN106354659B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106959823A (en) * | 2017-03-13 | 2017-07-18 | 许继集团有限公司 | It is a kind of to improve the implementation method that FLASH parameter preserves number of times |
CN107450985A (en) * | 2017-07-27 | 2017-12-08 | 北京珠穆朗玛移动通信有限公司 | EMS memory management process, mobile terminal and storage medium |
CN109086223A (en) * | 2018-08-21 | 2018-12-25 | 郑州云海信息技术有限公司 | A kind of method and apparatus controlling garbage reclamation |
CN109324983A (en) * | 2017-07-31 | 2019-02-12 | 武汉斗鱼网络科技有限公司 | A kind of method, storage medium, equipment and the system of automatic cleaning cache file |
CN111930735A (en) * | 2020-08-14 | 2020-11-13 | 中国工商银行股份有限公司 | Data cleaning method and device and electronic equipment |
CN114675792A (en) * | 2022-05-30 | 2022-06-28 | 苏州云途半导体有限公司 | Asynchronous time-sharing erasing method controlled by FLASH software |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101833512A (en) * | 2010-04-22 | 2010-09-15 | 中兴通讯股份有限公司 | Method and device thereof for reclaiming memory |
CN102968297A (en) * | 2012-10-25 | 2013-03-13 | 北京奇虎科技有限公司 | Software management system and method for mobile terminal |
CN105095529A (en) * | 2015-09-30 | 2015-11-25 | 深圳天珑无线科技有限公司 | Method and device for cleaning garbage content of software as well as terminal |
CN105867834A (en) * | 2015-01-22 | 2016-08-17 | 深圳市硅格半导体有限公司 | Data arrangement method of storage device |
-
2016
- 2016-08-29 CN CN201610749987.6A patent/CN106354659B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN101833512A (en) * | 2010-04-22 | 2010-09-15 | 中兴通讯股份有限公司 | Method and device thereof for reclaiming memory |
CN102968297A (en) * | 2012-10-25 | 2013-03-13 | 北京奇虎科技有限公司 | Software management system and method for mobile terminal |
CN105867834A (en) * | 2015-01-22 | 2016-08-17 | 深圳市硅格半导体有限公司 | Data arrangement method of storage device |
CN105095529A (en) * | 2015-09-30 | 2015-11-25 | 深圳天珑无线科技有限公司 | Method and device for cleaning garbage content of software as well as terminal |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106959823A (en) * | 2017-03-13 | 2017-07-18 | 许继集团有限公司 | It is a kind of to improve the implementation method that FLASH parameter preserves number of times |
CN106959823B (en) * | 2017-03-13 | 2020-04-17 | 许继集团有限公司 | Implementation method for increasing FLASH parameter storage times |
CN107450985A (en) * | 2017-07-27 | 2017-12-08 | 北京珠穆朗玛移动通信有限公司 | EMS memory management process, mobile terminal and storage medium |
CN109324983A (en) * | 2017-07-31 | 2019-02-12 | 武汉斗鱼网络科技有限公司 | A kind of method, storage medium, equipment and the system of automatic cleaning cache file |
CN109086223A (en) * | 2018-08-21 | 2018-12-25 | 郑州云海信息技术有限公司 | A kind of method and apparatus controlling garbage reclamation |
CN109086223B (en) * | 2018-08-21 | 2021-10-29 | 郑州云海信息技术有限公司 | Method and device for controlling garbage recovery |
CN111930735A (en) * | 2020-08-14 | 2020-11-13 | 中国工商银行股份有限公司 | Data cleaning method and device and electronic equipment |
CN114675792A (en) * | 2022-05-30 | 2022-06-28 | 苏州云途半导体有限公司 | Asynchronous time-sharing erasing method controlled by FLASH software |
Also Published As
Publication number | Publication date |
---|---|
CN106354659B (en) | 2019-07-19 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN106354659A (en) | Method on FLASH resource recovery of embedded device | |
US9846601B2 (en) | Method and apparatuses for determining a leak of resource and predicting usage of resource | |
CN109539473B (en) | Fault type determination method of air conditioning system and electronic equipment | |
CN102799471B (en) | Method and system for process recycling of operating system | |
CN106956610B (en) | Charging pile group power control method and device | |
CN107526641A (en) | A kind of method and device for reclaiming internal memory | |
WO2020211253A1 (en) | Elastic scaling method and apparatus for number of hosts in distributed system, and computer device | |
CN104656021A (en) | Method and device for predicting remaining capacity of battery | |
CN108491965B (en) | State prediction method and device for stamping equipment, electronic equipment and storage medium | |
CN110389822A (en) | The node scheduling method, apparatus and server of execution task | |
CN109324983A (en) | A kind of method, storage medium, equipment and the system of automatic cleaning cache file | |
WO2012006920A1 (en) | System and method for self-adaptive garbage object collection | |
CN103593232A (en) | Task scheduling method and device of data warehouse | |
CN111831467A (en) | Method, system and electronic equipment for java process memory overflow self-fusing | |
CN104935523A (en) | Load balancing processing method and equipment | |
CN114511284A (en) | BIM-based overall process informatization monitoring method, system, device and storage medium | |
CN109254850A (en) | memory resource management method and system | |
CN111078382B (en) | Command overtime processing method and device | |
CN117519973A (en) | Resource adjusting method, device and equipment | |
CN103729613A (en) | Method and device for detecting video image | |
CN106201358A (en) | A kind of method and device of internal memory garbage reclamation | |
CN110365028B (en) | Method for judging influence of primary frequency modulation on power oscillation | |
CN111274667A (en) | Cross-scale material calculation software integrated calculation system and method | |
CN115923762A (en) | Method and device for controlling generated power of range extender, electronic equipment and storage medium | |
CN113290864B (en) | Feed control method, device, printing equipment and readable storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | 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 |