The caching method and system of data perception are eliminated under a kind of mixing memory environment
Technical field
The invention belongs to memory calculating fields, more particularly, to superseded data perception under a kind of mixing memory environment
Caching method and caching system, main target are that the service life of non-volatile main memory is promoted under the premise of guaranteeing caching performance.
Background technique
The rapid development of memory computing technique, cause it is existing based on the main storage system of DRAM scalability, in terms of
It has been difficult to adapt to further develop, and the appearance of novel non-volatile main memory provides newly to optimize existing memory system
Chance because non-volatile main memory has that non-volatile, low energy consumption and better advantages such as scalability when as memory, but want
Think to replace existing DRAM completely, writing rate, dynamic energy consumption and in terms of non-volatile main memory also at a distance of DRAM very
Far, so a kind of relatively common internal storage structure is to take DRAM and non-volatile main memory as mixing main memory, wherein DRAM makees
Cached for the upper layer of non-volatile main memory, in this way can preferably the complementation of advantage disadvantage to promote whole performance and reliable
Property.
When non-volatile main memory is as memory, one of them important problem is exactly restricted lifetime.For example, phase change memory,
Its write operation principle is that resistive material changes between low-resistance crystalline state (logic 1) and high resistant amorphous state (logical zero), to lead
Phase change memory is caused to be difficult to bear a large amount of write operation, the write operation service life of phase change memory only has 108-1012 for the DRAM that compares
It is secondary, poorer than DRAM several orders of magnitude, if concentrating and writing, it is only necessary to very short time (100 days or so, based on typical
SPECCPU application) certain phase change memory units in phase change memory can be write it is bad, therefore, in order to make full use of it is non-easily
The performance of the property lost main memory, needs to focus on solving the life problems of non-volatile main memory
Current generation existing research work is concentrated mainly on following three classes: non-volatile main memory number is write in reduction, such as
It is write again after write-after-read, overturning, coset mapping write-in and traditional caching level improve hit rate and write to reduce accordingly
Return the number of data;Abrasion equilibrium, from section, the page, memory line, the exchange and overturning for carrying out than top grade different grain size data;
Error correction and the multiplexing of bad block carry out hardware view and misread errored bit and be grouped progress mistake after being write badly mainly for local page
Accidentally restore and other blocks is assisted to carry out hardware error correction using normal bit remaining in bad block.
The write request that the studies above scheme is sent mainly for caching is handled to optimize, actual writeback request quantity
It is not reduced, and brings the expenses such as additional record, migration, it can be considered to carry out optimization request from caching level to write
The problem of entering non-volatile main memory.Existing research work is mainly concentrated on based on data cached apoplexy involving the solid organs in caching system at present
Data need to write back non-volatile main memory when eliminating and clean data are then not necessarily to the difference write back, need to eliminate number in spatial cache
According to when the intentional clean data of preferentially selection it is superseded to carry out, ratio shared by dirty data in data of eliminating is reduced, to reach
The purpose that spatial cache writes back dirty data number to non-volatile main memory is reduced, or passes through analysis concrete application specific procedure
The clean data that the access hit rate distribution of section carrys out the intentional low hit rate of selection are superseded to carry out.Although above-mentioned work is from totality
On reduce the number for writing back non-volatile main memory, but this strategy for deliberately reducing dirty data written-back operation number being brought
Following problem: (1) clean data are deliberately eliminated retain dirty data will affect data distribution in spatial cache, and then damage
To the hit rate of upper access caching system, adverse effect is brought to the overall performance of system.(2) work of caching performance is considered
It needs first to be analyzed and then selected specific strategy execution to concrete application operation characteristic in different time periods, it cannot be fine
Ground adapts to the cache environment of not homologous ray.
Summary of the invention
For the disadvantages described above of the prior art, the present invention provides a kind of caching system of superseded data perception, purposes
Be guarantee caching access hit rate to effectively reduce under the premise of caching system performance is unaffected write back it is non-volatile
Property main memory number to promoting the non-volatile main memory service life, thus solve that the non-volatile main memory write operation longevity can not be promoted simultaneously
The technical issues of life and guarantee caching performance.
To achieve the above object, it is an aspect of this invention to provide that providing a kind of caching method of superseded data perception, packet
Containing following steps:
(1) it after being determined wait eliminate the page, caches and eliminates the corresponding metadata information of the data monitoring method acquisition page, packet
It containing page address, eliminates time and superseded number etc., and initializes or update to cache and eliminate corresponding in set of records ends wash in a pan
Eliminate record;When being not hit by generation, monitoring method eliminates the locality characteristic of record based on the metadata information analysis being collected into
(temporal locality and spatial locality) and the superseded weight that the corresponding caching page is calculated based on features described above;
(2) page frame replacement strategy determines different method of replacing based on the type of superseded data, if it is nearest to eliminate object
Do not eliminated the clean page that then preferential selection did not eliminated in page type recently carry out it is superseded, and if eliminating object most
Closely occurred to eliminate, and based on the superseded weight that monitoring obtains, calculated corresponding superseded threshold value, and combine the visit of the page itself
Ask that feature preferentially selects the clean page as superseded object in superseded threshold range, it is non-volatile with reduction writing back additionally
Hosting operations select the containing dirty pages face of minimal weight as superseded object if without the corresponding clean page, guarantee to delay to reach
Sustainability can and promote the target in non-volatile main memory service life;
(3) when adaptive space partition mechanism occurs mainly in request and is not hit by, if request page eliminates record in caching
There is corresponding record then to illustrate that the record occurred to eliminate recently in set, then selects the caching page that there is no eliminating excessively recently
As superseded object;And if request page is eliminated set of records ends in caching and is not recorded, and illustrates the record recently without interviewed
It asked, was not more eliminated, so selecting the page once eliminated recently as superseded object.
Contemplated above technical scheme through the invention, compared with prior art, system of the invention have below
Advantage and technical effect:
1, due to using step (1), it can be obtained in time when eliminating operation and executing and analyze eliminating for the page
Feature provides the theory support that whether can be eliminated when the page is stored in caching again for it;
2, due to using step (2), the superseded page can be down to most the performance negative effect of caching next stage
It is small and can be reduced unnecessary written-back operation, to improve the non-volatile main memory write operation service life;
3, due to using step (3), the data distribution of spatial cache can more meet the spy of current generation access request
Point, thus corresponding access hit rate can also be promoted, to be further ensured that the performance of caching system.
It is another aspect of this invention to provide that additionally providing a kind of caching system for mixing and eliminating data perception under memory environment
System, including eliminate data monitoring module, page frame replacement module and adaptive space division module.Monitoring module, for caching
In the data record eliminated carry out metadata collecting and superseded weight analysis, to support following page frame replacement and space to divide;
Page frame replacement module is when request occurs for caching system to be not hit by, and selection is influenced minimum and is not required to as far as possible on caching performance
Write back non-volatile main memory the page carry out it is superseded;Adaptive space division module is mainly in view of in caching and did not eliminated
Influence of the page crossed to caching performance determines to eliminate page in conjunction with the data of request and monitoring module using adaptive thought
The type in face, to achieve the purpose that space divides.
It eliminates data monitoring module and is carrying out superseded when progress when caching selected specific webpage, be mainly used to monitor nearest one
The section time caches the page record eliminated, and goes out its position in superseded set of records ends especially by address calculation to judge to be
It is no to have had corresponding superseded record, if recording the metadata record information of the page without then initializing, if having then more
The relevant metadata information (eliminating time, superseded number etc.) of the new record;When needing to replace the page, all washed in a pan is analyzed
The locality weight of the corresponding superseded record of the page was eliminated, mainly eliminates the weight of time and superseded frequency, and based on above-mentioned
Weight obtains the superseded weight of the corresponding caching page.
Page frame replacement module is carried out when request miss occurs for each caching, for selecting final superseded object, first
It determines whether the page to be eliminated defaulted and chosen belongs to and the superseded page once occurred, and is superseded and naughty recently for not occurring respectively
The page eliminated implements different Replacement Strategies, wherein the page that do not eliminated is preferentially selected completely to eliminate, and it is right
The superseded weight of the page is then based in the page eliminated recently to select, and the lesser clean page of preoption weight is as superseded
Object, to achieve the purpose that guarantee cache access hit rate and reduce to write back.
Adaptive space division module determines that the type of superseded data, specifically basis are asked when request is not hit by first
State and the data record of monitoring module are asked to judge that the which type of page is more likely to be accessed recently, and adaptive
It selects the another type of page as superseded object, is divided by the space of two types data to adapt to upper access request
Variation.
Contemplated above technical scheme through the invention, compared with prior art, system of the invention have below
Advantage and technical effect:
1, data monitoring module is eliminated due to using, it being capable of accurately each page in detection and analysis buffered packet
Eliminate weight size, and carry out the storage of low spatial expense, thus page-out next stage be accessed again can energy range
Degree divides for following page frame replacement and space and provides effective support;
2, due to using page frame replacement module, the access for eliminating weight and the page itself based on the page monitored is special
Sign, the write operation service life of the performance of caching system itself and non-volatile main memory can be combined, because will not be because of
It pursues to reduce and writes back and bring big negative effect to caching performance;
3, due to that the page that do not eliminated in caching can be taken into account using adaptive space division module,
So that the distribution of Various types of data meets the tendency requested access at this stage in spatial cache, so that the performance of caching obtains further
Promotion.
In general, through the invention it is contemplated above technical scheme is compared with the prior art, due to eliminate data when
The size for combining the superseded weight of the page selects to eliminate target with the feature requested access to, enables to guaranteeing caching performance
The service life of non-volatile main memory is effectively promoted under the premise of being substantially unaffected.
Detailed description of the invention
Fig. 1 is the data monitoring method flow chart of the embodiment of the present invention;
Fig. 2 is the flow chart of the page frame replacement strategy of the embodiment of the present invention;
Fig. 3 is the flow chart of the adaptive space partition mechanism of the embodiment of the present invention;
Fig. 4 is the system module block diagram of the embodiment of the present invention.
Specific embodiment
In order to make the objectives, technical solutions, and advantages of the present invention clearer, with reference to the accompanying drawings and embodiments, right
The present invention is further elaborated.It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, and
It is not used in the restriction present invention.As long as in addition, technical characteristic involved in the various embodiments of the present invention described below
Not constituting a conflict with each other can be combined with each other.
The present invention provides a kind of caching methods of superseded data perception, comprising the following steps:
(1) it as shown in Figure 1, eliminating data monitoring method, is carried out during the entire process of system operation, specifically comprising as follows
Several sub-steps:
(1.1) when the selected specific webpage of caching carries out superseded, the position of its storage data collection: is gone out by address calculation
It sets, then judges whether there has been corresponding superseded record, if recording the page address of the page without then initializing, having washed in a pan
Eliminate number (being set as 1) and superseded time (current time), if having, take out the record of the data, update its eliminate time be
Current time eliminates number increase by one.
(1.2) data are analyzed: when needing to replace the page, analysis is all to have eliminated the corresponding superseded record of the page.One
It is the weight for eliminating the time, by all records to eliminate time-sequencing, and according to the successive assignment weight (1- of sequence from small to large
n);Second is that eliminating the weight of frequency, all records are sorted from small to large according to superseded number, and is weighed according to this sequence assignment
Weight (1-n).Finally, each page corresponding time and frequency weight are summed to obtain corresponding superseded weight, and according to superseded
Weight sorts from small to large cached in once eliminate the page superseded weight sequencing.
(2) it as shown in Fig. 2, page frame replacement strategy, caching occurs to carry out when request miss every time, specifically includes following several
Sub-steps:
(2.1) page to be eliminated chosen to default judges whether the page has record in the data of monitoring module.
(2.2) it if having record then to illustrate that the page belongs to once occurs the superseded page, is then analyzed based on monitoring module
To weight further judged, if do not record then enter (2.4).
(2.3) threshold value of the superseded page based on weight at this stage once occurred to all, and selected to eliminate object, if weight
Less than there are clean data in the page of threshold value, then the page is preferentially selected to eliminate, if existing without clean data, then selected
The smallest dirty data page of weight carries out superseded.
(2.4) if the page did not occurred to eliminate, illustrate that the page belongs to and the superseded page does not occur.According to default
LRU rule select to eliminate the page, while paying the utmost attention to the clean page to be selected.
(3) as shown in figure 3, adaptive space partition mechanism, specifically include following several sub-steps:
(3.1) the access cache request that upper layer is sent, judges whether to hit.
(3.2) if hit, continues access operation, if miss, whether query monitor module has corresponding wash in a pan
Record is eliminated, if otherwise entering (3.4) in the presence of then (3.3) are entered.
(3.3) page once occurred to eliminate recently, then explanation results in being not hit by for this, institute to the superseded of the page
To need to expand the affiliated space size for once occurring to eliminate the page, i.e., it is suitable never to occur to select in the superseded page
The page carries out superseded.
(3.4) page then illustrates that the page is not visited recently and is not more washed in a pan recently there is no excessively superseded
It eliminated, so the space size for not occurring to eliminate the page belonging to needing to expand, i.e., from once occurring to select in the superseded page
The suitable page is as superseded object.
As shown in figure 4, the present invention provides the caching system of data perception is eliminated under a kind of mixing memory environment, including wash in a pan
Eliminate data monitoring module, page frame replacement module and adaptive space division module.Monitoring module, for the number eliminated in caching
Metadata collecting and superseded weight analysis are carried out according to record, to support following page frame replacement and space to divide;Page frame replacement mould
Block is when being not hit by for caching system generation request, and selection influences minimum and do not need to write back as far as possible non-easy on caching performance
The page of the property lost main memory carries out superseded;Adaptive space division module is mainly in view of the page pair that do not eliminated in caching
The influence of caching performance determines the type for eliminating the page using adaptive thought in conjunction with the data of request and monitoring module,
To achieve the purpose that space divides.
It eliminates data monitoring module and is carrying out superseded when progress when caching selected specific webpage, be mainly used to monitor nearest one
The section time caches the page record eliminated, and goes out its position in superseded set of records ends especially by address calculation to judge to be
It is no to have had corresponding superseded record, if recording the metadata record information of the page without then initializing, if having then more
The relevant metadata information (eliminating time, superseded number etc.) of the new record;When needing to replace the page, all washed in a pan is analyzed
The locality weight of the corresponding superseded record of the page was eliminated, mainly eliminates the weight of time and superseded frequency, and based on above-mentioned
Weight obtains the superseded weight of the corresponding caching page.
Page frame replacement module is carried out when request miss occurs for each caching, for selecting final superseded object, first
It determines whether the page to be eliminated defaulted and chosen belongs to and the superseded page once occurred, and is superseded and naughty recently for not occurring respectively
The page eliminated implements different Replacement Strategies, wherein the page that do not eliminated is preferentially selected completely to eliminate, and it is right
The superseded weight of the page is then based in the page eliminated recently to select, and the lesser clean page of preoption weight is as superseded
Object, to achieve the purpose that guarantee cache access hit rate and reduce to write back.
Adaptive space division module determines that the type of superseded data, specifically basis are asked when request is not hit by first
State and the data record of monitoring module are asked to judge that the which type of page is more likely to be accessed recently, and adaptive
It selects the another type of page as superseded object, is divided by the space of two types data to adapt to upper access request
Variation.
The present invention provides the caching methods that data perception is eliminated under a kind of mixing memory environment, due to using step
(1), the superseded feature that can obtain and analyze the page in time when eliminating operation and executing, when the page is stored in caching again
The theory support that whether can be eliminated is provided when middle for it;It, can be next to caching by the superseded page due to using step (2)
The performance negative effect in stage minimizes and can be reduced unnecessary written-back operation, to improve non-volatile main memory write operation
Service life;Due to using step (3), the characteristics of data distribution of spatial cache can more meet current generation access request, because
And corresponding access hit rate can also be promoted, to be further ensured that the performance of caching system.
For eliminating the caching system of data perception under mixing memory environment provided by the invention, number is eliminated due to using
According to monitoring module, can accurately in detection and analysis buffered packet each page superseded weight size, and carry out low spatial
The storage of expense, therefore the possibility degree that page-out is accessed again in next stage is obtained, it is following page frame replacement and space
Division provides effective support;Due to using page frame replacement module, weight and page sheet are eliminated based on the page monitored
The access feature of body can combine the write operation service life of the performance of caching system itself and non-volatile main memory, because
Big negative effect is brought to caching performance for that will not write back because of reduction is pursued;Mould is divided due to using adaptive space
Block can take into account the page that do not eliminated in caching, so that the distribution of Various types of data meets existing rank in spatial cache
The tendency that section requests access to, so that the performance of caching is further promoted.
As it will be easily appreciated by one skilled in the art that the foregoing is merely illustrative of the preferred embodiments of the present invention, not to
The limitation present invention, any modifications, equivalent substitutions and improvements made within the spirit and principles of the present invention should all include
Within protection scope of the present invention.