CN106126443A - Distinguish cache replacement method and the device of dirty degree - Google Patents

Distinguish cache replacement method and the device of dirty degree Download PDF

Info

Publication number
CN106126443A
CN106126443A CN201610465812.2A CN201610465812A CN106126443A CN 106126443 A CN106126443 A CN 106126443A CN 201610465812 A CN201610465812 A CN 201610465812A CN 106126443 A CN106126443 A CN 106126443A
Authority
CN
China
Prior art keywords
memory block
lru
access frequency
dirty
blocks
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201610465812.2A
Other languages
Chinese (zh)
Other versions
CN106126443B (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.)
Tsinghua University
Original Assignee
Tsinghua University
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 Tsinghua University filed Critical Tsinghua University
Priority to CN201610465812.2A priority Critical patent/CN106126443B/en
Publication of CN106126443A publication Critical patent/CN106126443A/en
Application granted granted Critical
Publication of CN106126443B publication Critical patent/CN106126443B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/12Replacement control
    • G06F12/121Replacement control using replacement algorithms
    • G06F12/123Replacement control using replacement algorithms with age lists, e.g. queue, most recently used [MRU] list or least recently used [LRU] list

Landscapes

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

Abstract

The present invention provides a kind of cache replacement method distinguishing dirty degree and device, including: multiple caches set of blocks is set, dirty piece in dirty for high access frequency set of blocks is carried out sub-block classification;When having detected that new memory block is inserted, it is judged that determine that the employing of new memory block reads or writes disappearance incorporation way and inserts, new memory block is inserted in correspondence set;Deposit that memory block is accessed reads hit when detecting, and the affiliated clean set of blocks of low access frequency or the clean set of blocks of high access frequency, memory block is moved in corresponding set;When detect need to replace out deposit memory block time, according to each the LRU chain of dirty piece in the sequence detection set from less to more of dirty sub-block quantity, if be not detected by first non-NULL LRU chain, the LRU block in described LRU chain is replaced out.A kind of cache replacement method distinguishing dirty degree of present invention offer and device, by being further divided into some sub-blocks by dirty for high access frequency piece, provide more protection for the memory block that its apoplexy involving ZANG-organ sub-block quantity is many.

Description

Distinguish cache replacement method and the device of dirty degree
Technical field
The present invention relates to Computer Systems Organization technical field, particularly relate to a kind of cache replacement side distinguishing dirty degree Method and device.
Background technology
Using novel storage material to replace DRAM to be a current study hotspot as internal memory, the most popular is new Shaped material mainly has following three classes: phase transition storage (PCM), magnetic RAM (MRAM) and flash memory (flash).flash Because read-write postpones relatively big, be not suitable for doing internal memory, it is common that for disk buffering.The read-write of MRAM and PCM postpones close to DRAM, Memory density is bigger than DRAM, and non-volatile allows them need not carry out refresh operation frequently as DRAM, saves Power consumption, so being both hopeful to substitute DRAM to become the internal memory material of a new generation.
It is more preferable that PCM compares MRAM integrated level, and from the point of view of industrialization angle, the development of current PCM is more preferable.Due to PCM Erasable number of times limited, if being directly used as internal memory to have the problem that durability is inadequate.
Summary of the invention
The present invention provides a kind of cache replacement method postponing PCM internal memory service life and device, is used for solving existing skill The problem that in art, PCM internal memory service life is too short.
First aspect, the present invention provides a kind of cache replacement method distinguishing dirty degree, including:
Multiple caches block is set, and each memory block is divided into the clean set of blocks of low access frequency, low access frequency The dirty set of blocks of rate, the clean set of blocks of high access frequency and the dirty set of blocks of high access frequency, simultaneously by dirty for high access frequency set of blocks In dirty piece carry out sub-block classification, and obtain the quantity of each dirty piece of apoplexy involving ZANG-organ sub-block;
In every class memory block set, the time that is accessed for for the last time according to memory block is ranked up, it is thus achieved that Mei Gecun Storage LRU chain corresponding to set of blocks, wherein, the memory block that last access time gap current time is nearest in LRU chain For MRU block, the last memory block accessing time gap current time farthest is LRU block;
When having detected that new memory block is inserted, if judging to determine that new memory block uses reading disappearance incorporation way to insert Enter, then new memory block is arranged on the MRU position of low access frequency clean set of blocks LRU chain, and regenerate the LRU of correspondence Chain;If judging to determine that the employing of new memory block is write disappearance incorporation way and inserted, then new memory block is arranged on low access frequency On the MRU position of dirty set of blocks LRU chain, and regenerate the LRU chain of correspondence;
When detect deposit memory block accessed hit time, use read hit mode if having deposited memory block described in judging to determine It is hit, and described has deposited the clean set of blocks of low access frequency belonging to memory block or the clean set of blocks of high access frequency, then by Deposit memory block to move on the MRU position of high access frequency clean block LRU chain, and regenerate the LRU chain of correspondence;If other Situation, then move to depositing memory block on the MRU position of dirty piece of LRU chain of high access frequency, and regenerates the LRU of correspondence Chain;
When detect one need to be replaced out to deposit memory block time, set of blocks clean to low access frequency, low access frequency are dirty successively The LRU chain of set of blocks and the clean set of blocks of high access frequency detects, if first non-NULL LRU chain detected, by described The memory block on LRU position in LRU chain is replaced out, and the memory block set that described LRU chain is corresponding regenerates the LRU of correspondence Chain;If be not detected by first non-NULL LRU chain, then dirty according to dirty sub-block quantity sequence detection high access frequency from less to more Each LRU chain of dirty piece in set of blocks, if first non-NULL LRU chain detected, by the LRU position in described LRU chain Memory block replace out, and corresponding dirty piece of described LRU chain is regenerated the LRU chain of correspondence.
Preferably, when first non-NULL LRU chain being detected, the memory block on the LRU position in described LRU chain is replaced Go out, and the memory block set that described LRU chain is corresponding is regenerated correspondence LRU chain after, also include:
If judging to determine dirty piece of low access frequency belonging to the memory block replaced out, then by clean for high access frequency set of blocks LRU On MRU position during the memory block on LRU position moves to low access frequency clean set of blocks LRU chain in chain, height is visited simultaneously The memory block asked in frequency dirty set of blocks LRU chain on LRU position moves to the MRU position in low access frequency dirty set of blocks LRU chain Put, and regenerate the LRU chain of correspondence.
Preferably, when first non-NULL LRU chain being detected, the memory block on the LRU position in described LRU chain is replaced Go out, and the memory block set that described LRU chain is corresponding is regenerated correspondence LRU chain after, also include:
If judging to determine the clean block of high access frequency belonging to the memory block replaced out, then by dirty for high access frequency set of blocks LRU On MRU position during the memory block on LRU position moves to low access frequency dirty set of blocks LRU chain in chain, and regenerate right The LRU chain answered.
Second aspect, the present invention provides a kind of cache alternative distinguishing dirty degree, including:
Configuration module, is used for arranging multiple caches block, and each memory block is divided into the clean block of low access frequency Set, the dirty set of blocks of low access frequency, the clean set of blocks of high access frequency and the dirty set of blocks of high access frequency, simultaneously according to dirty son In dirty for high access frequency set of blocks dirty piece is carried out dirty sub-block classification by number of blocks;
Order module, in every class memory block, the time that is accessed for for the last time according to memory block is ranked up, and obtains Obtaining the LRU chain corresponding to each memory block set, wherein, in LRU chain, last access time gap current time is nearest Memory block be MRU block, the last memory block accessing time gap current time farthest is LRU block;
Insert module, for when having detected that new memory block is inserted, if judging to determine that new memory block uses reading disappearance to draw Enter mode to insert, then new memory block is arranged on the MRU position of low access frequency clean set of blocks LRU chain, and again Generate corresponding LRU chain;If judging to determine that the employing of new memory block is write disappearance incorporation way and inserted, then new memory block is arranged On the MRU position of low access frequency dirty set of blocks LRU chain, and regenerate the LRU chain of correspondence;
Access modules, for detect deposit memory block accessed hit time, if having deposited memory block described in judging to determine Use and read hit mode and be hit, and described to have deposited the clean set of blocks of low access frequency or high access frequency belonging to memory block clean Set of blocks, then move to depositing memory block on the MRU position of high access frequency clean block LRU chain, and regenerates correspondence LRU chain;If other situations, then move to depositing memory block on the MRU position of dirty piece of LRU chain of high access frequency, and again Generate corresponding LRU chain;
Replace out module, for when detect one need to be replaced out to deposit memory block time, block collection clean to low access frequency successively The LRU chain of conjunction, the dirty set of blocks of low access frequency and the clean set of blocks of high access frequency detects, if first non-NULL being detected During LRU chain, the memory block on the LRU position in described LRU chain is replaced out, and the memory block set weight corresponding to described LRU chain The LRU chain of newly-generated correspondence;If be not detected by first non-NULL LRU chain, then according to dirty sub-block quantity order from less to more Detect each the LRU chain of dirty piece in the dirty set of blocks of high access frequency, if first non-NULL LRU chain detected, by described LRU The memory block on LRU position in chain is replaced out, and corresponding dirty piece of described LRU chain regenerates the LRU chain of correspondence.
Preferably, described module is replaced out to be additionally operable to: if judging to determine dirty piece of low access frequency belonging to the memory block replaced out, then Memory block on LRU position in clean for high access frequency set of blocks LRU chain is moved to low access frequency clean set of blocks LRU chain In MRU position on, the memory block on LRU position in dirty for high access frequency set of blocks LRU chain is moved to simultaneously low access frequency On MRU position in rate dirty set of blocks LRU chain, and regenerate the LRU chain of correspondence.
Preferably, described module is replaced out to be additionally operable to: if judging to determine the clean block of high access frequency belonging to the memory block replaced out, Then the memory block on LRU position in dirty for high access frequency set of blocks LRU chain is moved in low access frequency dirty set of blocks LRU chain MRU position on, and regenerate correspondence LRU chain.
As shown from the above technical solution, the embodiment of the present invention provide a kind of cache replacement method distinguishing dirty degree and Device, by all carrying out the differentiation of height access frequency, simultaneously in all processing procedures of cache block to dirty piece and clean block It is further divided into some dirty sub-blocks by dirty for high access frequency piece, provides more for the memory block that its apoplexy involving ZANG-organ sub-block quantity is many and protect Protect, thus effectively reduce the PCM internal memory amount of writing back, promote durability.
Accompanying drawing explanation
The schematic flow sheet of the cache replacement method distinguishing dirty degree that Fig. 1 provides for one embodiment of the invention;
Fig. 2 is the schematic diagram that dirty piece in the embodiment of the present invention dirty set of blocks of high access frequency carries out sub-block classification;
The structural representation of the cache alternative distinguishing dirty degree that Fig. 3 provides for one embodiment of the invention.
Detailed description of the invention
Below in conjunction with the accompanying drawings and embodiment, the detailed description of the invention of the present invention is described in further detail.Hereinafter implement Example is used for illustrating the present invention, but is not limited to the scope of the present invention.
Fig. 1 shows a kind of cache replacement method distinguishing dirty degree that one embodiment of the invention provides, including:
S11, multiple caches block is set, and each memory block is divided into the clean set of blocks of low access frequency, low visit Ask the dirty set of blocks of frequency, the clean set of blocks of high access frequency and the dirty set of blocks of high access frequency, simultaneously by dirty for high access frequency piece In set dirty piece carries out sub-block classification, and obtains the quantity of each dirty piece of apoplexy involving ZANG-organ sub-block.
In this step, it should be noted that multiple caches block can be there is in system stored procedures (cache block), according to the temperature of the access degree of each memory block, and in memory block, whether data are revised, by each memory block It is divided into the clean set of blocks of low access frequency, the dirty set of blocks of low access frequency, the clean set of blocks of high access frequency and high access frequency Dirty set of blocks.Memory block that can be similar in each memory block set.
It addition, dirty piece in dirty for high access frequency set of blocks to be carried out sub-block classification, and obtain each dirty piece of apoplexy involving ZANG-organ sub-block Quantity.As illustrated in fig. 2, it is assumed that a complete cache block in the dirty set of blocks of high access frequency, its data 64B altogether.Wherein Black part is divided into the data being modified, referred to as dirty data, it may be assumed that dirty sub-block.White portion is be not modified, is referred to as dry Net amount evidence, i.e. clean sub-block.As long as there being dirty data, cache block is exactly dirty piece.
Being averaged in figure and be divided into 8 sub-blocks, each sub-block has 8B data.Only sub-block 3 and sub-block 4 contains black Partly (i.e. dirty data), so the two sub-block is dirty sub-block, other sub-block is all clean sub-block, therefore this cache block Dirty sub-block quantity is 2.
The dirty sub-block quantity being appreciated that in each dirty piece in the dirty set of blocks of high access frequency with this, examines for subsequent order Survey and preparation is made in arrangement.
S12, in every class memory block, the time that is accessed for for the last time according to memory block is ranked up, it is thus achieved that Mei Gecun Storage LRU chain corresponding to set of blocks, wherein, the memory block that last access time gap current time is nearest in LRU chain For MRU block, the last memory block accessing time gap current time farthest is LRU block.
In this step, it should be noted that owing to each memory block set can exist multiple memory block, therefore need to be to often Memory block in individual set is ranked up.The embodiment of the present invention can be accessed for the time for the last time and arrange according to memory block Sequence, embodies access time domain, obtains the LRU chain corresponding to each memory block set simultaneously.Wherein, in LRU chain last The nearer memory block of secondary access time gap current time is MRU block, and this MRU block position is MRU position.Last visit Asking that time gap current time memory block farther out is LRU block, this LRU block position is LRU position.
S13, when having detected that new memory block is inserted, if judge determine new memory block use read disappearance incorporation way carry out Insert, then new memory block is arranged on the MRU position of low access frequency clean set of blocks LRU chain, and regenerate correspondence LRU chain;If judging to determine that the employing of new memory block is write disappearance incorporation way and inserted, then new memory block is arranged on low access frequently On the MRU position of rate dirty set of blocks LRU chain, and regenerate the LRU chain of correspondence.
In this step, it should be noted that in new memory block insertion process, when detecting that new memory block is inserted, First have to judge that this new memory block is to use to read disappearance incorporation way insertion, or disappearance is write in employing, and incorporation way inserts.
When judging to determine that new memory block uses reading disappearance incorporation way to insert, then new memory block is arranged on low access On the MRU position of frequency clean set of blocks LRU chain, and simultaneously the most once the memory block on MRU position be arranged in new memory block it Before.After insertion, this memory block set is regenerated new LRU chain.
When judging to determine that the employing of new memory block is write disappearance incorporation way and inserted, then new memory block is arranged on low access On the MRU position of frequency dirty set of blocks LRU chain, and before once the memory block on MRU position is arranged in new memory block simultaneously. After insertion, this memory block set is regenerated new LRU chain.
S14, when detect deposit memory block accessed hit time, use read hit if having deposited memory block described in judging to determine Mode is hit, and the described clean set of blocks of low access frequency belonging to memory block or the clean set of blocks of high access frequency deposited, then Move to depositing memory block on the MRU position of high access frequency clean block LRU chain, and regenerate the LRU chain of correspondence;If Other situations, then move to depositing memory block on the MRU position of dirty piece of LRU chain of high access frequency, and regenerates correspondence LRU chain.
In this step, it should be noted that in memory block set deposit the accessed hit of memory block during, when When detecting that depositing memory block is accessed hit, first have to judgement determining that this has deposited memory block is to use reading hit mode to be ordered In, still adopt and be hit in other ways.
Deposit memory block described in judge to determine to use and read hit mode and be hit, and described deposit low visit belonging to memory block Ask the clean set of blocks of frequency or the clean set of blocks of high access frequency, then move to the clean block of high access frequency by depositing memory block On the MRU position of LRU chain, and before once the memory block on MRU position is arranged in the memory block of movement simultaneously.Mobile complete After, the memory block set after movement is regenerated new LRU chain.
Except other all situations in the case of above-mentioned, all move to dirty piece of LRU chain of high access frequency by depositing memory block On MRU position, and before once the memory block on MRU position is arranged in the memory block of movement, after moving, to shifting simultaneously Memory block set after Dong regenerates new LRU chain.
S15, when detect one need to be replaced out to deposit memory block time, successively set of blocks clean to low access frequency, low access frequency The LRU chain of the dirty set of blocks of rate and the clean set of blocks of high access frequency detects, if first non-NULL LRU chain detected, and will The memory block on LRU position in described LRU chain is replaced out, and the memory block set to described LRU chain is corresponding regenerates correspondence LRU chain;If be not detected by first non-NULL LRU chain, then access according to dirty sub-block quantity sequence detection height from less to more Each LRU chain of dirty piece in the dirty set of blocks of frequency, if first non-NULL LRU chain detected, by the LRU in described LRU chain Memory block on position is replaced out, and corresponding dirty piece of described LRU chain regenerates the LRU chain of correspondence.
In this step, it should be noted that deposit during memory block replaced out in memory block set, need successively Set of blocks clean to low access frequency, the dirty set of blocks of low access frequency, the clean set of blocks of high access frequency and high access frequency are dirty The LRU chain of set of blocks detects.When first non-NULL LRU chain being detected, by depositing on the LRU position in described LRU chain Storage block replaces out, and the memory block set that described LRU chain is corresponding regenerates the LRU chain of correspondence.
In step s 11 in set of blocks dirty to high access frequency each dirty piece carry out sub-block classification, will high access frequency Each dirty piece in dirty set of blocks is divided into multiple sub-block, can there is the data quilt in some dirty sub-blocks in these multiple dirty sub-blocks Revising, the data in other dirty sub-blocks are not modified.Now be appreciated that in the dirty set of blocks of high access frequency is each Dirty sub-block quantity in dirty piece.If be not detected by first non-NULL LRU chain, then according to dirty sub-block quantity order from less to more Detect each the LRU chain of dirty piece in the dirty set of blocks of high access frequency, if first non-NULL LRU chain detected, by described LRU The memory block on LRU position in chain is replaced out.It is placed on backmost so that having the many memory blocks of dirty sub-block, then have dirty The memory block that sub-block is few can preferentially be selected, it is to avoid increases when the memory block that dirty sub-block is many is replaced out and writes back PCM internal memory Amount.
For this step, the situation to may occur below also is needed to explain:
If A judges to determine dirty piece of low access frequency belonging to the memory block replaced out, then by clean for high access frequency set of blocks On MRU position during the memory block on LRU position moves to low access frequency clean set of blocks LRU chain in LRU chain, and the most once Before the memory block on MRU position is arranged in the memory block of movement, after moving, to the memory block set weight after movement Newly-generated new LRU chain.
Memory block on LRU position in dirty for high access frequency set of blocks LRU chain is moved to the dirty set of blocks of low access frequency On MRU position in LRU chain, and before once the memory block on MRU position is arranged in the memory block of movement simultaneously, move Bi Hou, regenerates new LRU chain to the memory block set after movement.
If B judges to determine the clean block of high access frequency belonging to the memory block replaced out, then by dirty for high access frequency set of blocks On MRU position during the memory block on LRU position moves to low access frequency dirty set of blocks LRU chain in LRU chain, and the most once Before memory block on MRU position is arranged in the memory block of movement, after moving, to the memory block set after movement again Generate new LRU chain.
A kind of cache replacement method distinguishing dirty degree that the embodiment of the present invention provides, by all places at cache block All dirty piece and clean block are carried out the differentiation of height access frequency, simultaneously by dirty for high access frequency piece of Further Division during reason For some sub-blocks, provide more protection for the memory block that its apoplexy involving ZANG-organ sub-block quantity is many, thus effectively reduce and PCM internal memory is write Hui Liang, promotes durability.
A kind of cache alternative postponing PCM internal memory service life that Fig. 3 shows that one embodiment of the invention provides, Including configuration module 21, order module 22, insert module 23, access modules 24 and replace out module 25, wherein:
Configuration module 21, is used for arranging multiple caches block, and is divided into low access frequency clean each memory block Set of blocks, the dirty set of blocks of low access frequency, the clean set of blocks of high access frequency and the dirty set of blocks of high access frequency, visit height simultaneously Ask that dirty piece in the dirty set of blocks of frequency carries out sub-block classification, and obtain the quantity of each dirty piece of apoplexy involving ZANG-organ sub-block;
Order module 22, in every class memory block, the time that is accessed for for the last time according to memory block is ranked up, Obtain the LRU chain corresponding to each memory block set, wherein, last in LRU chain access time gap current time Near memory block is MRU block, and the last memory block accessing time gap current time farthest is LRU block;
Inserting module 23, for when having detected that new memory block is inserted, if judging, determining that new memory block uses reads disappearance Incorporation way inserts, then new memory block be arranged on the MRU position of low access frequency clean set of blocks LRU chain, lay equal stress on The LRU chain of newly-generated correspondence;If judging to determine that the employing of new memory block is write disappearance incorporation way and inserted, then new memory block is set Put on the MRU position of low access frequency dirty set of blocks LRU chain, and regenerate the LRU chain of correspondence;
Access modules 24, for detect deposit memory block accessed hit time, if storage described in judging to determine Block uses to be read hit mode and is hit, and the described clean set of blocks of low access frequency belonging to memory block or the high access frequency of having deposited is done Clean set of blocks, then move to depositing memory block on the MRU position of high access frequency clean block LRU chain, and regenerate correspondence LRU chain;If other situations, then move to, on the MRU position of dirty piece of LRU chain of high access frequency, lay equal stress on by depositing memory block The LRU chain of newly-generated correspondence;
Replace out module 25, for when detect one need to be replaced out to deposit memory block time, block collection clean to low access frequency successively The LRU chain of conjunction, the dirty set of blocks of low access frequency and the clean set of blocks of high access frequency detects, if first non-NULL being detected During LRU chain, the memory block on the LRU position in described LRU chain is replaced out, and the memory block set weight corresponding to described LRU chain The LRU chain of newly-generated correspondence;If be not detected by first non-NULL LRU chain, then according to dirty sub-block quantity order from less to more Detect each the LRU chain of dirty piece in the dirty set of blocks of high access frequency, if first non-NULL LRU chain detected, by described LRU The memory block on LRU position in chain is replaced out, and corresponding dirty piece of described LRU chain regenerates the LRU chain of correspondence.
In the case of being likely to occur, described module is replaced out to be additionally operable to: if judging to determine low visit belonging to the memory block replaced out Ask dirty piece of frequency, then the memory block on LRU position in clean for high access frequency set of blocks LRU chain is moved to low access frequency and do On MRU position in clean set of blocks LRU chain, the memory block on LRU position in dirty for high access frequency set of blocks LRU chain is moved simultaneously Move on the MRU position in low access frequency dirty set of blocks LRU chain, and regenerate the LRU chain of correspondence.Replace out if judging to determine Memory block belonging to the clean block of high access frequency, then by LRU position in dirty for high access frequency set of blocks LRU chain memory block move Move on the MRU position in low access frequency dirty set of blocks LRU chain, and regenerate the LRU chain of correspondence.
Owing to device described in the embodiment of the present invention is identical with the principle of method described in above-described embodiment, for more detailed Explanation content does not repeats them here.
Come real it should be noted that the embodiment of the present invention can be passed through hardware processor (hardware processor) Existing related function module.
A kind of cache alternative distinguishing dirty degree that the embodiment of the present invention provides, by all places at cache block All dirty piece and clean block are carried out the differentiation of height access frequency, simultaneously by dirty for high access frequency piece of Further Division during reason For some sub-blocks, provide more protection for the memory block that its apoplexy involving ZANG-organ sub-block quantity is many, thus effectively reduce and PCM internal memory is write Hui Liang, promotes durability.
Although additionally, it will be appreciated by those of skill in the art that embodiments more described herein include other embodiments Some feature included by rather than further feature, but the combination of the feature of different embodiment means to be in the present invention's Within the scope of and form different embodiments.Such as, in the following claims, embodiment required for protection appoint One of meaning can mode use in any combination.
The present invention will be described rather than limits the invention to it should be noted above-described embodiment, and ability Field technique personnel can design alternative embodiment without departing from the scope of the appended claims.In the claims, Any reference marks that should not will be located between bracket is configured to limitations on claims.Word " comprises " and does not excludes the presence of not Arrange element in the claims or step.Word "a" or "an" before being positioned at element does not excludes the presence of multiple such Element.The present invention and can come real by means of including the hardware of some different elements by means of properly programmed computer Existing.If in the unit claim listing equipment for drying, several in these devices can be by same hardware branch Specifically embody.Word first, second and third use do not indicate that any order.These word explanations can be run after fame Claim.
One of ordinary skill in the art will appreciate that: various embodiments above only in order to technical scheme to be described, and Non-to its restriction;Although the present invention being described in detail with reference to foregoing embodiments, those of ordinary skill in the art It is understood that the technical scheme described in foregoing embodiments still can be modified by it, or to wherein part or All technical characteristic carries out equivalent;And these amendments or replacement, do not make the essence of appropriate technical solution depart from this Bright claim limited range.

Claims (6)

1. the cache replacement method distinguishing dirty degree, it is characterised in that including:
Multiple caches block is set, and each memory block is divided into the clean set of blocks of low access frequency, low access frequency dirty Set of blocks, the clean set of blocks of high access frequency and the dirty set of blocks of high access frequency, simultaneously by dirty for high access frequency set of blocks Dirty piece carries out sub-block classification, and obtains the quantity of each dirty piece of apoplexy involving ZANG-organ sub-block;
In every class memory block set, the time that is accessed for for the last time according to memory block is ranked up, it is thus achieved that each memory block LRU chain corresponding to set, wherein, in LRU chain, the last memory block accessing time gap current time nearest is MRU Block, the last memory block accessing time gap current time farthest is LRU block;
When having detected that new memory block is inserted, if judging to determine that new memory block uses reading disappearance incorporation way to insert, then New memory block is arranged on the MRU position of low access frequency clean set of blocks LRU chain, and regenerates the LRU chain of correspondence;If Judge to determine that the employing of new memory block is write disappearance incorporation way and inserted, then new memory block is arranged on dirty piece of low access frequency collection Close on the MRU position of LRU chain, and regenerate the LRU chain of correspondence;
When detect deposit memory block accessed hit time, use and read hit mode if having deposited memory block described in judging to determine and ordered In, and described deposited the clean set of blocks of low access frequency belonging to memory block or the clean set of blocks of high access frequency, then will deposit Storage block moves on the MRU position of high access frequency clean block LRU chain, and regenerates the LRU chain of correspondence;If other feelings Condition, then move to depositing memory block on the MRU position of dirty piece of LRU chain of high access frequency, and regenerates the LRU chain of correspondence;
When detect one need to be replaced out to deposit memory block time, set of blocks clean to low access frequency, dirty piece of low access frequency collection successively Close and the LRU chain of the clean set of blocks of high access frequency detects, if first non-NULL LRU chain detected, by described LRU chain In LRU position on memory block replace out, and the memory block set that described LRU chain is corresponding is regenerated correspondence LRU chain;If When being not detected by first non-NULL LRU chain, then according to dirty sub-block quantity dirty piece of sequence detection high access frequency collection from less to more Each LRU chain of dirty piece in conjunction, if first non-NULL LRU chain detected, by depositing on the LRU position in described LRU chain Storage block replaces out, and corresponding dirty piece of described LRU chain regenerates the LRU chain of correspondence.
Method the most according to claim 1, it is characterised in that when first non-NULL LRU chain being detected, by described LRU The memory block on LRU position in chain is replaced out, and the memory block set that described LRU chain is corresponding regenerates the LRU chain of correspondence Afterwards, also include:
If judging to determine dirty piece of low access frequency belonging to the memory block replaced out, then by clean for high access frequency set of blocks LRU chain Memory block on LRU position moves on the MRU position in low access frequency clean set of blocks LRU chain, height is accessed frequency simultaneously On MRU position during the memory block on LRU position moves to low access frequency dirty set of blocks LRU chain in rate dirty set of blocks LRU chain, And regenerate the LRU chain of correspondence.
Method the most according to claim 1, it is characterised in that when first non-NULL LRU chain being detected, by described LRU The memory block on LRU position in chain is replaced out, and the memory block set that described LRU chain is corresponding regenerates the LRU chain of correspondence Afterwards, also include:
If judging to determine the clean block of high access frequency belonging to the memory block replaced out, then by dirty for high access frequency set of blocks LRU chain Memory block on LRU position moves on the MRU position in low access frequency dirty set of blocks LRU chain, and regenerates correspondence LRU chain.
4. the cache alternative distinguishing dirty degree, it is characterised in that including:
Configuration module, is used for arranging multiple caches block, and each memory block is divided into the clean set of blocks of low access frequency, The dirty set of blocks of low access frequency, the clean set of blocks of high access frequency and the dirty set of blocks of high access frequency, simultaneously by high access frequency In dirty set of blocks dirty piece carries out sub-block classification, and obtains the quantity of each dirty piece of apoplexy involving ZANG-organ sub-block;
Order module, in every class memory block, the time that is accessed for for the last time according to memory block is ranked up, it is thus achieved that every LRU chain corresponding to individual memory block set, wherein, last access nearest the depositing of time gap current time in LRU chain Storage block is MRU block, and the last memory block accessing time gap current time farthest is LRU block;
Inserting module, for when having detected that new memory block is inserted, if judging, determining that new memory block uses reads disappearance introducing side Formula is inserted, then new memory block be arranged on the MRU position of low access frequency clean set of blocks LRU chain, and regenerate Corresponding LRU chain;If judging to determine that the employing of new memory block is write disappearance incorporation way and inserted, then new memory block is arranged on low On the MRU position of access frequency dirty set of blocks LRU chain, and regenerate the LRU chain of correspondence;
Access modules, for detect deposit memory block accessed hit time, use if having deposited memory block described in judging to determine Read hit mode to be hit, and described deposit the clean set of blocks of low access frequency belonging to memory block or high access frequency clean block collection Close, then move to depositing memory block on the MRU position of high access frequency clean block LRU chain, and regenerate the LRU of correspondence Chain;If other situations, then move to depositing memory block on the MRU position of dirty piece of LRU chain of high access frequency, and regenerate Corresponding LRU chain;
Replace out module, for when detect one need to be replaced out to deposit memory block time, set of blocks clean to low access frequency, low successively The LRU chain of the dirty set of blocks of access frequency and the clean set of blocks of high access frequency detects, if first non-NULL LRU chain being detected Time, the memory block on the LRU position in described LRU chain is replaced out, and the memory block set to described LRU chain is corresponding regenerates Corresponding LRU chain;If be not detected by first non-NULL LRU chain, then high according to dirty sub-block quantity sequence detection from less to more Each LRU chain of dirty piece in the dirty set of blocks of access frequency, if first non-NULL LRU chain detected, by described LRU chain Memory block on LRU position is replaced out, and corresponding dirty piece of described LRU chain regenerates the LRU chain of correspondence.
Device the most according to claim 4, it is characterised in that described replace out module to be additionally operable to: replace out if judging to determine Dirty piece of low access frequency belonging to memory block, then move the memory block on LRU position in clean for high access frequency set of blocks LRU chain On MRU position in low access frequency clean set of blocks LRU chain, simultaneously by LRU bit in dirty for high access frequency set of blocks LRU chain The memory block put moves on the MRU position in low access frequency dirty set of blocks LRU chain, and regenerates the LRU chain of correspondence.
Device the most according to claim 4, it is characterised in that described replace out module to be additionally operable to: replace out if judging to determine The clean block of high access frequency belonging to memory block, then move the memory block on LRU position in dirty for high access frequency set of blocks LRU chain On MRU position in low access frequency dirty set of blocks LRU chain, and regenerate the LRU chain of correspondence.
CN201610465812.2A 2016-06-23 2016-06-23 Distinguish the cache replacement method and device of dirty degree Active CN106126443B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610465812.2A CN106126443B (en) 2016-06-23 2016-06-23 Distinguish the cache replacement method and device of dirty degree

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610465812.2A CN106126443B (en) 2016-06-23 2016-06-23 Distinguish the cache replacement method and device of dirty degree

Publications (2)

Publication Number Publication Date
CN106126443A true CN106126443A (en) 2016-11-16
CN106126443B CN106126443B (en) 2019-03-01

Family

ID=57269565

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610465812.2A Active CN106126443B (en) 2016-06-23 2016-06-23 Distinguish the cache replacement method and device of dirty degree

Country Status (1)

Country Link
CN (1) CN106126443B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018149278A1 (en) * 2017-02-14 2018-08-23 中兴通讯股份有限公司 Method and device for indexing dirty data in storage system page

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253901A (en) * 2011-07-13 2011-11-23 清华大学 Read/write distinguished data storage replacing method based on phase change memory
CN102999441A (en) * 2012-11-15 2013-03-27 清华大学 Fine granularity memory access method
CN104834608A (en) * 2015-05-12 2015-08-12 华中科技大学 Cache replacement method under heterogeneous memory environment

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102253901A (en) * 2011-07-13 2011-11-23 清华大学 Read/write distinguished data storage replacing method based on phase change memory
CN102999441A (en) * 2012-11-15 2013-03-27 清华大学 Fine granularity memory access method
CN104834608A (en) * 2015-05-12 2015-08-12 华中科技大学 Cache replacement method under heterogeneous memory environment

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
LEE B C,ZHOU P, YANG J: "Phase-change technology and the future of main memory", 《IEEE MICRO》 *
LI Z,JIN P,SU X: "CCF-LRU:A new buffer replacement algorithm for flash memory", 《IEEE TRANSACTIONS》 *

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018149278A1 (en) * 2017-02-14 2018-08-23 中兴通讯股份有限公司 Method and device for indexing dirty data in storage system page

Also Published As

Publication number Publication date
CN106126443B (en) 2019-03-01

Similar Documents

Publication Publication Date Title
US9423970B2 (en) Method and system for predicting block failure in a non-volatile memory
US9329797B2 (en) Method and system for adjusting block erase or program parameters based on a predicted erase life
CN106469029B (en) Data hierarchy storage processing method, device and storage equipment
CN103678150B (en) Solid state hard disc application method and device
CN108052414A (en) A kind of method and system for promoting SSD operating temperature ranges
CN104685571B (en) Presence in response to potential interference refreshes storage stack unit
CN109902039A (en) Memory Controller, storage system and the method that data configuration is managed in a memory
US20130339570A1 (en) Variability aware wear leveling
CN101777026B (en) Memory management method, hard disk and memory system
US20080147998A1 (en) Method and apparatus for detecting static data area, wear-leveling, and merging data units in nonvolatile data storage device
Wang et al. Observational wear leveling: an efficient algorithm for flash memory management
CN106802767B (en) Data configuration method and the electronic system for applying it
CN107391398B (en) Management method and system for flash memory cache region
US7730358B2 (en) Stress testing method of file system
US9223694B2 (en) Data storage device and operating method thereof
CN102047341A (en) Fatigue management system and method for hybrid nonvolatile solid state memory system
Gao et al. Constructing large, durable and fast SSD system via reprogramming 3D TLC flash memory
CN102306503A (en) Method and system for detecting false capacity memory
CN109753443A (en) A kind of data processing method, device and electronic equipment
US9606912B2 (en) Tracking and utilizing second level map index for recycling of solid state drive blocks
CN106201348A (en) The buffer memory management method of non-volatile memory device and device
CN106371762A (en) Optimization method and system of storage data
CN106155938B (en) Postpone the cache replacement method and device of PCM memory service life
CN110837477B (en) Storage system loss balancing method and device based on life prediction
CN106126443A (en) Distinguish cache replacement method and the device of dirty degree

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant