CN102521162B - Method and device for cache data processing - Google Patents

Method and device for cache data processing Download PDF

Info

Publication number
CN102521162B
CN102521162B CN 201110390186 CN201110390186A CN102521162B CN 102521162 B CN102521162 B CN 102521162B CN 201110390186 CN201110390186 CN 201110390186 CN 201110390186 A CN201110390186 A CN 201110390186A CN 102521162 B CN102521162 B CN 102521162B
Authority
CN
Grant status
Grant
Patent type
Prior art keywords
page
out
weight
value
buffer
Prior art date
Application number
CN 201110390186
Other languages
Chinese (zh)
Other versions
CN102521162A (en )
Inventor
李怀洲
Original Assignee
华为技术有限公司
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
Grant date

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; 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

Abstract

本发明提供一种用于缓存数据处理的方法和装置。 The present invention provides a method and apparatus for processing data cache. 涉及通信技术领域。 It relates to communication technologies. 解决了由于长时间不被访问的页面没有被及时删除,导致缓冲区的性能下降的问题。 Solve the problem because the page is not accessed for a long time is not promptly removed, resulting in a decrease in the performance of the buffer. 该方法包括:确定页面的淘汰权重基数;在页面每次被执行操作后,将页面的淘汰权重基数累加第一预设数值;若淘汰权重值具有预设的上限值,在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值;若淘汰权重值没有预设的上限值,则在每次进行淘汰扫描时,按照不满足预设条件的淘汰权重值与对应的页面在缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值;将满足预设条件的淘汰权重值对应的页面从缓冲区中删除,从而可应用于缓冲区置换页面。 The method comprising: determining weights out of the base of the page; each page is performed after the operation, the weight of the base page out a first preset value accumulated; eliminated if the weight value with a predetermined upper limit value, at each time-out when scanning, the weight does not satisfy a predetermined condition out of a weight value minus a second predetermined value; if the weight value is not out of a preset upper limit value, for each scanned out, in accordance with the preset condition is not satisfied in weight out value stored in the corresponding page buffer time inversely proportional calculation, the weight value of the current out of the page; the weight value corresponding to satisfy out page preset condition removed from the buffer, the buffer may be applied so that District replacement page.

Description

用于缓存数据处理的方法和装置 Method and apparatus for caching data processing

技术领域 FIELD

[0001] 本发明涉及通信技术领域,尤其涉及用于缓存数据处理的方法和装置。 [0001] The present invention relates to communications technologies, and in particular relates to a method and apparatus for processing data cache.

背景技术 Background technique

[0002] 闪存是近年来出现的一种新型存储介质。 [0002] Flash memory is a new type of storage media in recent years. 当计算机要显示闪存中的某页面时,计算机将闪存中的该页面放入缓冲区中,由于页面需要不断的更新信息,因此,当长时间显示该页面时,缓冲区中存入大量该页面的信息,使得缓冲区没有足够的空间执行其它操作,导致计算机性能下降。 When the computer to display a page of flash memory, the computer will flash the page into the buffer, because the pages need to constantly update information, so long as the page is displayed, the buffer is stored in a large number of the page information, so that the buffer is not enough space to perform other operations, resulting in computer performance.

[0003] 当对NAND(-种闪存型号)型闪存中某页面执行写、读操作之前,先将待操作页面存入缓冲区,缓冲区根据缓冲区中的页面的"引用位"确定需要从缓冲区中淘汰的页面,以便缓冲区拥有足够的空间执行其它操作。 [0003] As for the NAND (- kinds of flash memory model) a page write-type flash memory before the read operation, the first page to be operated into the buffer, the buffer buffer page "reference position" is determined as needed from out of the page buffer, the buffer has enough space to perform other operations.

[0004] 具体的,页面首次存入缓冲区时,页面的"引用位"置1 ;缓冲区中的任何页面被访问时,该页面的"引用位"加1。 [0004] Specifically, when the page is first stored in the buffer, the page "reference position" is set to 1; when the buffer any page is accessed, the page "reference position" plus one.

[0005] 淘汰页面时,缓冲区从指针当前指向的页面开始扫描队列,指针指向哪个页面,缓冲区扫描哪个页面,即扫描缓冲区中存储的所有页面,把当前"引用位"不为〇的页面的"弓I 用位"减1 ;把当前"引用位"为〇的页面从缓冲区中淘汰,指针指向下一个页面。 [0005] When the phase-out of the page buffer pointer is currently pointing to a page from the start scanning queue, a pointer to which page, which page buffer scan that scans all the pages stored in the buffer, the current "reference position" is not the square page "bow I bit with" minus 1; the current "reference position" is the square of the pages out from the buffer, a pointer to the next page.

[0006] 循环扫描队列时,如果找到的所有页面的"引用位"均不为0,指针就会绕整个循环队列一圈,把碰到的所有页面的"引用位"减1。 [0006] When the scanning cycle queue, if all pages of the found "reference position" is not 0, the pointer will circle around the entire circular queue, we encountered all pages "reference bit" minus 1.

[0007] 在实现上述用于缓存数据处理的过程中,当页面被访问时,该页面的"引用位"被加1,当该页面短时间内被频繁访问时,该页面的"引用位"数值被累加到很大,当该页面不被访问时,缓冲区需扫描多次该页面,才可将该页面的"引用位"减为〇,因此该页面长时间不被访问时在缓冲区中停留一定时间后才会被删除,导致该不被访问的页面占据缓冲区空间,使缓冲区的性能下降。 [0007] In the process of implementing the cache for the data processing, when the page is accessed, the page of the "reference position" is incremented by 1, when the page is accessed frequently in a short time, the page "reference bit" the accumulated value is large, when the page is not accessed, the page buffer to be scanned a plurality of times, the page before the "reference bit" Save as square, so that when the page is not accessed for a long time in the buffer the residence will be deleted after a certain time, lead to a page that is not being accessed occupy buffer space, the buffer performance decline.

发明内容 SUMMARY

[0008] 本发明的实施例提供一种用于缓存数据处理的方法、装置,解决了由于长时间不被访问的页面没有被及时删除,导致该不被访问的页面占据缓冲区空间,使缓冲区的性能下降的问题。 [0008] Embodiments of the present invention provides a method for caching data processing apparatus to solve because the page is not accessed for a long time is not promptly removed, leading to the page being accessed is not occupied buffer space, the buffer the problem of declining performance area.

[0009] 为达到上述目的,本发明的实施例采用如下技术方案: [0009] To achieve the above object, embodiments of the present invention adopts the following technical solutions:

[0010] 一种用于缓存数据处理的方法,包括: [0010] A method for processing buffered data, comprising:

[0011] 在页面初次读入缓冲区时,确定所述页面的淘汰权重基数; [0011] When the page is first read into the buffer, to determine the weight out of the base of the page;

[0012] 在所述页面每次被执行操作后,将所述页面的淘汰权重基数累加第一预设数值; [0013] 若所述淘汰权重值具有预设的上限值,则在所述淘汰权重值达到所述上限值后, 停止累加所述淘汰权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值,得到当前对应的页面的淘汰权重值; [0012] After the operation is performed each time the page, the page out of the weight of the base a first preset value accumulated; [0013] When the phase-out weighting value has a predetermined upper limit value, the after elimination weight values ​​reaches the upper limit value, stopping the accumulation of the weights out of the base, and carried out in each scanning, the weight does not satisfy a predetermined condition out of the second preset value Save weight values, corresponding to the current page to obtain the elimination of the weight value;

[0014] 若所述淘汰权重值没有预设的上限值,则在每次进行淘汰扫描时,按照所述不满足所述预设条件的淘汰权重值与对应的页面在所述缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值; [0014] In the phase-out of said buffer if the weight value is not preset upper limit value, at each time-out scanning, according to the phase-out does not satisfy the preset condition and the weight value corresponding to the page storage time inversely proportional calculation, the weight value of the current out of the page;

[0015] 将满足所述预设条件的淘汰权重值对应的页面从所述缓冲区中删除。 [0015] satisfying the preset condition out of the weight value corresponding to the page is deleted from the buffer.

[0016] 一种用于缓存数据处理的装置,包括: [0016] An apparatus for processing buffered data, comprising:

[0017] 确定单元,用于在页面初次读入缓冲区时,确定所述页面的淘汰权重基数; [0017] The determination unit configured to, when the page is first read into the buffer, to determine the weight out of the base of the page;

[0018] 累加单元,用于在所述页面每次被执行操作后,将所述页面的淘汰权重基数累加第一预设数值; [0018] accumulation unit, for each page, after the operation is performed, to the right out of the page weight basis accumulating a first predetermined value;

[0019] 第一计算单元,用于若所述淘汰权重值具有预设的上限值,则在所述淘汰权重值达到所述上限值后,停止累加所述淘汰权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值,得到当前对应的页面的淘汰权重值; After [0019] the first calculation unit if the upper limit for the weight-out value has a predetermined weight, the weight out of the weight value reaches the upper limit, stopping the accumulation of the weights out of the base, and each of when the time-out for scanning the weight does not satisfy a predetermined condition out of the second preset value Save weight values, to obtain weight values ​​corresponding to the current out of the page;

[0020] 第二计算单元,用于若所述淘汰权重值没有预设的上限值,则在每次进行淘汰扫描时,按照所述不满足所述预设条件的淘汰权重值与对应的页面在所述缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值; [0020] When the second calculating unit, configured to, if not eliminated preset weight value of the upper limit value is carried out in each scanning, according to the phase-out not satisfy the preset weight value corresponding to the condition stored in the page buffer time inversely proportional calculation, the weight value of the current out of the page;

[0021] 删除单元,用于将满足所述预设条件的淘汰权重值对应的页面从所述缓冲区中删除。 [0021] The deleting unit, configured to satisfy the preset condition out of the weight value corresponding to the page is deleted from the buffer.

[0022] 本发明实施例提供的用于缓存数据处理的方法和装置,在页面初次读入缓冲区时,确定所述页面的淘汰权重基数;在所述页面每次被执行操作后,将所述页面的淘汰权重基数累加第一预设数值;若所述淘汰权重值具有预设的上限值,则在所述淘汰权重值达到所述上限值后,停止累加所述淘汰权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值,得到当前对应的页面的淘汰权重值;若所述淘汰权重值没有预设的上限值,则在每次进行淘汰扫描时,按照所述不满足所述预设条件的淘汰权重值与对应的页面在所述缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值;将满足所述预设条件的淘汰权重值对应的页面从所述缓冲区中删除。 [0022] The embodiment provides a method and apparatus for caching data processing embodiment of the present invention, when the page is first read into the buffer, to determine the weight out of the base of the page; the page after each operation is performed, The said page-out base accumulating a first predetermined weight value; eliminated if the weighting value has a predetermined upper limit value, the weight reaches a weight value out of the upper limit value, stopping the accumulation out of the base weights, and scanning each time out, does not satisfy a predetermined condition out of the right weight value minus the second predetermined value, to obtain a corresponding current weight value out of the page; if the weight value is not out of a predetermined upper limit value, carried out at the time of each scan, in accordance with said phase-out does not satisfy the preset condition and the weight value calculated in the corresponding pages stored in the buffer time inversely proportional to obtain the current weight value out of the page ; satisfying the preset condition out of the weight value corresponding to the page is deleted from the buffer.

[0023] 采用上述方案后,通过对不同属性的页面分别设置淘汰权重上限值,使得那些在短时间被多次访问之后长时间不被访问的页面的淘汰权重数值不为无限大,缓冲区可在短时间内将该页面的淘汰页面权重值减到满足预设条件的数值;或者,按照淘汰权重值与页面在缓冲区中存储的时间成反比的方式计算淘汰权重值,使得缓冲区及时将不被访问的页面从缓冲区中删除。 [0023] After the foregoing embodiment, different attributes of the page by setting the weighting value are eliminated, so that after a short time out of the right long access times is not accessed pages weight value is not infinite, the buffer the weight value can be reduced to a short time out of the right page of the page value satisfies a preset condition; alternatively, a weight value calculated out in accordance with the weights and the weight value out of the page stored in the buffer time is inversely proportional manner, such that buffer promptly page will not be accessible deleted from the buffer.

附图说明 BRIEF DESCRIPTION

[0024] 为了更清楚地说明本发明实施例中的技术方案,下面将对实施例描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。 [0024] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, as briefly described in the introduction to the accompanying drawings required for use in describing the embodiments. Apparently, the drawings in the following description are only some of the present invention. embodiments, those of ordinary skill in the art is concerned, without creative efforts, can derive from these drawings other drawings.

[0025] 图1为本发明实施例提供的一种用于缓存数据处理的方法流程图; [0025] FIG. 1 is provided a method for caching data processing flowchart of the present embodiment of the invention;

[0026] 图2为本发明实施例提供的当淘汰权重没有上限值时,缓存数据处理的方法流程图; [0026] Figure 2 provides the weight is not eliminated when the upper limit value, cache data processing flowchart of a method embodiment of the present invention;

[0027] 图3为本发明实施例提供的缓冲区删除脏页面与非脏页面所需的时间和所需的开销; [0027] FIG buffer 3 according to an embodiment of the time required to delete dirty and non-dirty pages and page overhead required of the present invention;

[0028] 图4为本发明实施例提供的当淘汰权重具有上限值时,缓存数据处理的方法流程图; When the [0028] embodiment of FIG. 4 provided right out when a weight having an upper limit of the present invention, a method of processing a flowchart of cache data;

[0029] 图5为本发明实施例提供的缓冲区与页面的状态图; [0029] FIG. 5 is a state diagram provided with the page buffer of the embodiment of the present invention;

[0030] 图6为本发明实施例提供的当非脏页面的淘汰权重基数、淘汰权重上限值被设置为〇时,缓存数据处理的方法流程图; [0030] FIG 6 provided in the base when the weight out of the non-dirty page-out weights upper limit value is set square, a flowchart of a method for processing buffered data embodiment of the invention;

[0031] 图7为本发明实施例提供的一种用于缓存数据处理的装置结构示意图; [0031] FIG. 7 is a schematic structure of an apparatus for processing data cache according to an embodiment of the present invention;

[0032] 图8为本发明实施例提供的当淘汰权重没有上限值时,缓存数据处理的装置结构示意图; [0032] FIG. 8 when the upper limit value out of the weight, the structure of the device does not cache data process schematic according to an embodiment of the present invention;

[0033] 图9为本发明实施例提供的当淘汰权重具有上限值时,缓存数据处理的装置结构示意图; [0033] FIG 9 out when the weight having an upper limit, the structure of cache data processing apparatus according to an embodiment schematic view of the present invention;

[0034] 图10为本发明实施例提供的当非脏页面的淘汰权重基数、淘汰权重上限值被设置为0时,缓存数据处理的装置结构示意图。 [0034] FIG. 10 is provided in the base when the weight out of the non-dirty page, the upper limit value out of the weight is set to 0, a schematic view of a data processing device configuration cache embodiment of the invention.

具体实施方式 Detailed ways

[0035] 下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。 [0035] below in conjunction with the present invention in the accompanying drawings, technical solutions of embodiments of the present invention are clearly and completely described, obviously, the described embodiments are merely part of embodiments of the present invention, but not all embodiments example. 基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。 Based on the embodiments of the present invention, those of ordinary skill in the art to make all other embodiments without creative work obtained by, it falls within the scope of the present invention.

[0036] 本发明实施例提供一种用于缓存数据处理的方法,如图1所示,包括以下步骤: [0036] The embodiments of the present invention provides a method for processing buffered data, shown in Figure 1, comprising the steps of:

[0037] 101、确定页面的淘汰权重基数。 [0037] 101, to determine the weight out of the base of the page.

[0038] 缓冲区通过页面淘汰权重值确定是否将对应的页面从缓冲区中删除,页面的淘汰权重值越大,该页面越需要被存储在缓冲区中,页面的淘汰权重值越小,该页面越应该被从缓冲区中删除。 [0038] buffer to determine whether the corresponding page is deleted from the buffer, the greater the weight value out of the page, this page requires the page by weight weighting value is eliminated in the buffer, out of the smaller weight value of the page memory, the the page should be removed from the buffer.

[0039] 当页面被执行相应操作后,该页面的淘汰权重值会发生变化,变化的过程为基于淘汰权重基数进行相应的运算。 [0039] When a page corresponding operation is performed, the weight value out of the page will change, process variations for the corresponding operation based on the weight out of the right base. 淘汰权重基数为页面初始存入缓冲区中时的淘汰权重值。 Out of the base weights for the weight values ​​stored in the initial page out of Quanshi buffer.

[0040] 102、在页面每次被执行操作后,将页面的淘汰权重基数累加第一预设数值,得到当前页面的淘汰权重值。 [0040] 102, after the page is performed each time the operation, the weight out of the base page accumulating a first predetermined value, to obtain weight values ​​of the current out of the page.

[0041] 为了使缓冲区中存储的正在被访问的页面不被从缓冲区中删除,当页面被访问后,将页面的淘汰权重基数累加第一预设数值,得到当前页面的淘汰权重值。 [0041] To make the page being accessed is not stored in the buffer are removed from the buffer, when the page is accessed, the page-out base weight accumulating a first predetermined value, to obtain weight values ​​of the current out of the page.

[0042] 103、若淘汰权重值具有预设的上限值,则在淘汰权重值达到上限值后,停止累加权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的权重值减第二预设数值,得到当前对应的页面的淘汰权重值。 [0042] 103, if having a weight value out of preset upper limit, the weight values ​​after phase-out reaches the upper limit, stopping the accumulation weight of the base, and carried out at each scanning, the preset condition is not satisfied weight value minus the second predetermined value, give out the current weight value of the corresponding page.

[0043] 缓冲区中的页面每被访问过一次,该页面的页面权重累加第一预设数值,通过设置淘汰权重上限值,使页面淘汰权重累加到上限值后不再累加。 [0043] Each page buffer is accessed once, the right page of the first page of the accumulated weight preset value, by setting the upper limit of the weight out of the pages out of the accumulated weight no upper limit to the accumulation.

[0044] 通过设置淘汰权重上限值,使得该页面在频繁访问后,页面淘汰权重不会累加到无限大的值。 [0044] By setting the upper limit of the weight-out, so that the frequently accessed in the page, the page will not accumulate out weighting value to infinity.

[0045] 为了使长时间不被访问的页面不会占用缓冲区的空间,在每次进行淘汰扫描时, 将不满足预设条件的淘汰权重值减第二预设数值。 [0045] To make the page is not accessed for a long time does not take up space in the buffer in each time-out scanning, the weight does not satisfy a predetermined condition out of the second preset value Save weight values.

[0046] 104、若淘汰权重值没有预设的上限值,则在每次淘汰扫描时,按照不满足预设条件的淘汰权重值与对应的页面在缓冲区中存储的时间成反比的方式进行计算,得到当前该页面的权重值。 [0046] 104, if the weight value is not out of a predetermined upper limit value, each time the scan-out, in a time-out does not satisfy the preset condition and the weight value corresponding to a page stored in the buffer is inversely proportional manner has been calculated, the weight value of the current page.

[0047] 页面被存储于缓冲区中时间越长,且距离上次被访问的时间越长,该页面越可能被从缓冲区中淘汰。 [0047] page is stored in the buffer longer and longer distance last time being accessed, the page is more likely to be eliminated from the buffer.

[0048] 作为本实施例的一种实施方式,如果某页面在某段时间内没有被访问,页面在缓冲区中存储的时间越长,该页面的淘汰权重值越小;页面在缓冲区中存储的时间越短,该页面的淘汰权重值越大。 [0048] As an embodiment according to the present embodiment, if a page has not been accessed within a certain period of time, the longer stored in the page buffer, the smaller the weight value out of the page; page buffer the shorter the storage time, the greater the weight value out of the page.

[0049] 具体的,若淘汰权重值没有预设的上限值,则在每次淘汰扫描时,按照不满足预设条件的淘汰权重值与对应的页面在缓冲区中存储的时间成反比的方式进行计算,得到当前该页面的权重值。 [0049] Specifically, if the weight value is not out of a predetermined upper limit value, each time the scan-out, in a time-out does not satisfy the preset condition corresponding to the weight value stored in the page buffer is inversely proportional to for calculation to obtain weight values ​​of the current page.

[0050] 105、将满足预设条件的淘汰权重值对应的页面从缓冲区中删除。 [0050] 105, the preset condition is satisfied out of the page corresponding weight values ​​removed from the buffer.

[0051] 当缓冲区对存储的页面进行淘汰扫描时,判断页面的淘汰权重值是否满足预设条件;当页面的淘汰权重值满足预设条件时,将该页面从缓冲区中删除。 [0051] When the buffer to scan out the stored pages, right out of the page is determined weight value meets a preset condition; right out of the page when the weight value satisfies a preset condition, deleted from the page buffer.

[0052] 通过删除淘汰权重值满足预设条件的页面,可以释放缓冲区的空间,为其他页面提供存储空间,提1¾缓冲区的性能。 [0052] by deleting the elimination of weight values ​​meet the preset conditions page, you can free up space in the buffer, provide storage space for other pages, improve the performance of 1¾ buffer.

[0053] 采用上述方案后,通过对不同属性的页面分别设置淘汰权重上限值,使得那些在短时间被多次访问之后长时间不被访问的页面的淘汰权重数值不为无限大,缓冲区可在短时间内将该页面的淘汰页面权重值减到满足预设条件的数值;或者,按照淘汰权重值与页面在缓冲区中存储的时间成反比的方式计算淘汰权重值,充分考虑到了页面在缓冲区中的停留时间、和删除页面所需的开销,使得缓冲区及时将不被访问的页面从缓冲区中淘汰,释放缓冲区的空间,进而提高缓冲区的性能。 [0053] After the foregoing embodiment, different attributes of the page by setting the weighting value are eliminated, so that after a short time out of the right long access times is not accessed pages weight value is not infinite, the buffer the weight value can be reduced to a short time out of the right page of the page value satisfies a preset condition; alternatively, a weight value calculated out in accordance with the weights and the weight value out of the page stored in the buffer time is inversely proportional manner, taking into account the full page the required residence time in the buffer, and delete pages overhead, making the page buffer in a timely manner will not be accessed eliminated from the buffer, the buffer space is released, thus improving the performance of the buffer.

[0054] 作为实施例的改进,本实施例提供另一种用于缓存数据处理的方法,该方法介绍了当页面的淘汰权重值没有预设的上限值时,页面的淘汰权重具体的计算方法,如图2所示,包括以下步骤: [0054] A modified example of the embodiment, the present embodiment provides another method for processing data cache, the method introduces out when the weight value is not preset upper page limit, calculated as the weight of the specific weights of the page-out A method, as shown in Figure 2, comprising the steps of:

[0055] 201、确定页面的淘汰权重基数。 [0055] 201, to determine the weight out of the base of the page.

[0056] 缓冲区通过页面淘汰权重值确定是否将对应的页面从缓冲区中删除,页面的淘汰权重值越大,该页面越需要被存储在缓冲区中,页面的淘汰权重值越小,该页面越应该被从缓冲区中删除。 [0056] buffer to determine whether the corresponding page is deleted from the buffer, the greater the weight value out of the page, this page requires the page by weight weighting value is eliminated in the buffer, out of the smaller weight value of the page memory, the the page should be removed from the buffer.

[0057] 当页面被执行相应操作后,该页面的淘汰权重值会发生变化,变化的过程为基于淘汰权重基数进行相应的运算。 [0057] When a page corresponding operation is performed, the weight value out of the page will change, process variations for the corresponding operation based on the weight out of the right base. 淘汰权重基数为页面初始存入缓冲区中时的淘汰权重值。 Out of the base weights for the weight values ​​stored in the initial page out of Quanshi buffer.

[0058] 缓冲区中的页面包含脏页面、与非脏页面;脏页面为被执行写操作的页面,非脏页面为被执行读操作的页面。 [0058] The page buffer comprises a dirty pages, and non-dirty pages; dirty pages of the page write operation is performed, the non-dirty pages of the page read operation is performed.

[0059] 本实施例对页面的淘汰权重基数的设定不作限定,可以根据实际需要进行设定。 Set [0059] This embodiment of the page-out weighting base is not limited, and may be set according to actual needs.

[0060] 作为本实施例的一种实施方式,若在页面初次读入缓冲区时,页面被执行的是读操作,则页面的淘汰权重基数为1,若在页面初次读入缓冲区时,页面被执行的是写操作,则写操作开销页面的淘汰权重基数为μ。 [0060] As an embodiment according to the present embodiment, if the first page is read into the buffer, a page read operation is executed, the page out of the weight of the base 1 is, if the first page is read into the buffer, page write operation is to be performed, the write operation out of the base weights overhead page for μ. 其中^ = 为读写性差异系数。 ^ = Where is the coefficient of variation of the reader. 读操作开销 Read overhead

[0061] 202、在页面每次被执行操作后,将页面的淘汰权重基数累加第一预设数值,得到当前页面的淘汰权重值。 [0061] 202, after the page is performed each time the operation, the weight out of the base page accumulating a first predetermined value, to obtain weight values ​​of the current out of the page.

[0062] 缓冲区中存储的页面为正在被访问的页面,为了是该页面不被从缓冲区中删除, 当页面被访问后,将页面的淘汰权重基数累加第一预设数值,得到当前页面的淘汰权重值。 [0062] The pages stored in the buffer for the page being accessed, the page is not to be removed from the buffer, when the page is accessed, the page-out base weight accumulating a first predetermined value, the current page to obtain the elimination of the weight value.

[0063] 作为本实施例的一种实施方式,根据公式ω i = R+ μ *W对相应被访问后的页面的淘汰权重值累加相应的第一预设数值。 [0063] As an embodiment according to the present embodiment, the respective first accumulated value according to a predetermined formula ω i = R + μ * W weight values ​​corresponding to the page to be accessed right out. 其中,R为页面被执行读操作次数;W为页面被执行写操作次数;ω i为页面上一次被执行操作后的淘汰权重值。 Wherein, R is the number of page read operation is performed; W is executed, the page write operations; ω i is the weight value of weight-out operation is performed after the first page.

[0064] 由于删除脏页面与删除非脏页面所需的开销不同,删除脏页面的开销大于删除非脏页面的开销,例如:删除一个脏页面的所需时间比删除一个非脏页面的时间长,因此,缓冲区优先考虑删除缓冲区中长时间不被访问的,且删除时开销较小的页面。 [0064] Since the non-deleted and deleted dirty dirty pages overhead required different page, delete dirty pages is greater than the cost overhead remove non-dirty pages, for example: the time required to remove a dirty pages of a non-dirty pages longer than the deleted Therefore, prioritize delete buffer buffer is not accessed for a long time, and when the cost of a smaller page deleted. 图3为删除被执行读操作、写操作页面分别所需的时间及缓冲区的开销。 Figure 3 is an overhead delete the read operation, write operations are required time and page buffer.

[0065] 本实施例中提供的读操作开销、写操作开销为本领域技术人员熟知的内容,在此不再赘述。 [0065] The present embodiment provides a read operation overhead embodiment, the content of the write operation are well known to those skilled in the overhead, and are not repeated here.

[0066] 当页面每被执行一次读操作时,公式ω i = R+ μ *W中的R被加1 ;当页面每被执行一次写操作时,公式ω 1 = R+ μ *W中的W被加1。 [0066] When the page each be performed once a read operation, the formula ω i = R + μ * W of R 1 is added; if the page every executed, a write operation, the formula ω 1 = R + μ * W wherein W is plus 1.

[0067] 即在页面每次被执行读操作后,将页面的淘汰权重基数累加1,在页面每次被执行写操作后,将页面的淘汰权重基数累加μ (μ > 1)。 [0067] That is, after each time the page is a read operation, the page out accumulated weight base 1, every time after the page write operation, the base of the page-out cumulative weight μ (μ> 1).

[0068] 本实施例对第一预设数值不作限定,可以根据实际需要进行设定,如可以设置为1〇 [0068] This embodiment is not limited in the first preset value, may be set according to actual needs, such as may be provided 1〇

[0069] 203、判断淘汰权重值是否满足预设条件。 [0069] 203, it is determined whether or not the weight value out of preset conditions are satisfied.

[0070] 在缓冲区进行淘汰扫描时,首先判断页面的淘汰权重值是否满足预设条件。 [0070] When scan-out buffer, the first weighting value is determined out of the page satisfies a preset condition.

[0071] 本实施例对页面的淘汰权重值的预设条件不做限定,可以根据实际需要进行设定。 [0071] The present embodiment of the weight values ​​predetermined condition out of the right page of the embodiment is not limited and may be set according to actual needs.

[0072] 作为本实施例的一种实施方式,判断页面的淘汰权重值是否大于0,若页面的淘汰权重值不大于〇,即满足预设条件,则执行步骤205 ;若页面的淘汰权重值大于0,即不满足预设条件,则执行步骤204。 [0072] As an embodiment according to the present embodiment, out of weight values ​​determines the page is greater than 0, out of a weight value, if the page is not greater than the square, i.e., meets a preset condition, execute step 205; weight value out of weight if the page is greater than 0, i.e., the preset condition is not satisfied, step 204 is performed.

[0073] 204、在每次进行淘汰扫描时,按照不满足预设条件的淘汰权重值与对应的页面在缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值。 [0073] 204, carried out at each scan, in accordance with the preset condition is not satisfied out of the weight values ​​corresponding to the pages stored in the buffer is calculated inversely proportional to time, to give the current weight value out of the page.

[0074] 页面被存储于缓冲区中时间越长,且距离上次被访问的时间越长,该页面越可能被从缓冲区中删除。 [0074] page is stored in the buffer longer and longer distance last time being accessed, the page is more likely to be removed from the buffer.

[0075] 作为本实施例的一种实施方式,在每次进行淘汰扫描时,如果页面在某段时间内没有被访问,页面在缓冲区中存储的时间越长,则该页面的淘汰权重值越小;页面在缓冲区中存储的时间越短,则该页面的淘汰权重值越大。 [0075] As an embodiment according to the present embodiment, carried out at each scanning, if the page has not been accessed within a certain period of time, the longer the page stored in the buffer time, then the page out weighting value the smaller; shorter page stored in the buffer time, then the weight value out of the page increases.

[0076] 作为本实施例的一种实施方式,若不满足预设条件的淘汰权重值对应的页面上一次被执行的为写操作,则根据公式ω 2= ωι*ΤΙΧ-μ计算当前该页面的淘汰权重值;若不满足预设条件的淘汰权重值对应的页面上一次被执行的为读操作,则根据公式ω 2 = ω'ΤΙΧ-Ι计算页面当前该页面的淘汰权重值。 Write operation according to the equation ω 2 = ωι * ΤΙΧ-μ calculating a current out of the page on the page corresponding weight values ​​[0076] As an embodiment according to the present embodiment, if a preset condition is satisfied performed elimination weight value; out of the page corresponding to the weight value is not satisfied a preset condition is performed for a read operation, 2 = ω'ΤΙΧ-Ι page current weight value is calculated according to the formula weights ω out of the page.

[0077] 其中, [0077] wherein,

Figure CN102521162BD00091

为时间局部性系数;为不满足预设条件的淘汰权重值对应的页面上一次被执行操作后的淘汰权重值;μ为读写差异性系数;ω2为当前不满足预设条件的淘汰权重值对应的页面的淘汰权重。 Is the coefficient of temporal locality; is not satisfied a preset weight value is performed after the operation out of weights out on a page corresponding to a weight value condition; difference coefficient [mu] is read; [omega] 2 does not satisfy the preset condition for the current weight value out right out of the pages of the corresponding weight.

[0078] 205、将满足预设条件的淘汰权重值对应的页面从缓冲区中删除。 [0078] 205, the preset condition is satisfied out of the page corresponding weight values ​​removed from the buffer.

[0079] 由于缓冲区的空间有限,因此,如果长时间不被访问的页面占用的缓冲区过多的空间,使得一些被访问的页面无法被存入缓冲区中,导致缓冲区的性能降低。 [0079] Due to the limited space in the buffer, and therefore, too much buffer space if the page is not accessed for a long time occupied, making some pages are accessed and can not be stored in the buffer, resulting in reduced performance of the buffer. 因此,缓冲区定时对该缓冲区中存储的页面进行扫描,并删除长时间不被访问的页面。 Therefore, the timing to scan the page buffer stored in the buffer, and delete pages for a long time not being accessed.

[0080] 作为本实施例的一种实施方式,当页面的淘汰权重值满足预设条件时,将页面从缓冲区中删除。 [0080] As an embodiment according to the present embodiment, when the page-out weight weight value satisfies a preset condition, will remove the page from the buffer.

[0081] 上述方案中,由于删除脏页面与删除非脏页面所需的开销不同,删除脏页面的开销大于删除非脏页面的开销,因此,对执行写操作的页面与对执行读操作的页面的淘汰权重基数、第一预设数值、第二预设数值进行分别设定,使得缓冲区优先删除开销较小的页面;在每次进行淘汰扫描时,根据公式ω 2 = ω^ΤΙΧ-μ、或公式ω2 = ωι*ΤΙΧ-1计算页面的淘汰权重,充分考虑到了页面在缓冲区中的停留时间、和删除页面所需的开销,使得缓冲区及时将不被访问的页面从缓冲区中淘汰,释放缓冲区的空间,进而提高缓冲区的性能。 [0081] In the above embodiment, since the dirty pages to delete the deleted non-dirty pages different overhead required to delete dirty pages is greater than the cost of deleting the non-dirty pages overhead, therefore, a page write operation and a read operation is performed on the page elimination weight base, a first preset value, the second predetermined numerical values ​​are set such that priority remove small overhead buffer page; carried out at each scanning, according to the equation ω 2 = ω ^ ΤΙΧ-μ or formula ω2 = right out of ωι * ΤΙΧ-1 calculation page is heavy, fully taking into account the necessary residence time of a page in the buffer, and delete pages overhead, so that the buffer will not be in time to access a page from the buffer eliminated, freeing up space in the buffer, thus improving the performance of the buffer. [0082] 本实施提供另一种用于缓存数据处理的方法,该方法介绍了当页面的淘汰权重值具有预设的上限值时,页面的淘汰权重具体的计算方法,如图4所示,包括以下步骤: [0082] The present embodiment provides another method for processing buffered data, which describes when the weight value out of the page has a predetermined upper limit value, out of the right page of a specific weight calculation method, shown in Figure 4 comprising the steps of:

[0083] 401、确定页面的淘汰权重基数。 [0083] 401, to determine the weight out of the base of the page.

[0084] 缓冲区通过页面淘汰权重值确定是否将对应的页面从缓冲区中删除,页面的淘汰权重值越大,该页面越需要被存储在缓冲区中,页面的淘汰权重值越小,该页面越应该被从缓冲区中删除。 [0084] buffer to determine whether the corresponding page is deleted from the buffer, the greater the weight value out of the page, this page requires the page by weight weighting value is eliminated in the buffer, out of the smaller weight value of the page memory, the the page should be removed from the buffer. 图5为缓冲区与页面的状态图。 5 is a state diagram of the page buffer.

[0085] 当页面被执行相应操作后,该页面的淘汰权重值会发生变化,变化的过程为基于淘汰权重基数进行相应的运算。 [0085] When a page corresponding operation is performed, the weight value out of the page will change, process variations for the corresponding operation based on the weight out of the right base. 淘汰权重基数为页面初始存入缓冲区中时的淘汰权重值。 Out of the base weights for the weight values ​​stored in the initial page out of Quanshi buffer. [0086] 本实施例对页面的淘汰权重基数的预设值不作限定,可以根据实际需要进行设定。 [0086] The present embodiment is preset to page out the weight of the base is not limited, and may be set according to actual needs.

[0087] 作为本实施例的一种实施方式,若在页面初次读入缓冲区时,页面的淘汰权重基数为预设值,例如:将页面的淘汰权重基数设置为1。 [0087] As an embodiment according to the present embodiment, if the first page is read into the buffer, the weight out of the base page is a preset value, for example: the weight of the base out of the page is set to 1.

[0088] 402、为页面淘汰权重确定淘汰权重上限值。 [0088] 402, a page out of weights out of the weight determination upper limit.

[0089] 如果页面在某一时间段内被多次访问后,在该时间段之后该页面长时间不被访问,此时,该页面的淘汰权重值可能会被累加到很大的数值,导致缓冲区对该页面进行淘汰扫描时,将该页面的淘汰权重值减到满足删除条件的时间过长,使得该长时间不被访问的页面不能被及时从缓冲区中删除。 [0089] If the page after a certain period of time has been repeatedly visited, the page is not accessed for a long time after that period of time, this time, the weight value out of the page may be of great value to accumulate, leading to when the buffer is scanned out of the pages, the weight value right out of the pages to delete reduced to meet the conditions for too long, so that the page is not accessed for a long time can not be promptly removed from the buffer.

[0090] 为了使页面在被多次访问后,该页面的淘汰权重值不为无限大,为页面淘汰权重确定淘汰权重上限值,使得淘汰权重值在累加到淘汰权重上限值后不再增加。 [0090] To make the page after being repeatedly accessed out of the weight value of the page is not infinite, a page out of a weight determination on the phase-out weighting value, such that the weight value out weight the accumulated onto out of the weight value after no increase.

[0091] 由于删除脏页面与删除非脏页面所需的开销不同,删除脏页面的开销大于删除非脏页面的开销,例如:删除一个脏页面的所需时间比删除一个非脏页面的时间长,因此,缓冲区优先考虑删除缓冲区中长时间不被访问的,且删除时开销较小的页面,因此,对被执行读操作的页面与被执行写操作的页面分别设置淘汰权重上限值。 [0091] Since the non-deleted and deleted dirty dirty pages overhead required different page, delete dirty pages is greater than the cost overhead remove non-dirty pages, for example: the time required to remove a dirty pages of a non-dirty pages longer than the deleted Therefore, prioritize delete buffer buffer is not accessed for a long time, and cost less when you delete a page, therefore, the page is read operation is performed and the page is set up to perform write operations are eliminated limits on weight .

[0092] 作为本实施例一种实施方式,当页面上一次被执行的为写操作时,根据公式ω3 = μ ^Threshold计算缓冲区中该页面的淘汰权重上限值;当页面上一次被执行的为读操作时,根据公式ω3 = Threshold计算缓冲区中该页面的淘汰权重上限值。 [0092] As an embodiment according to the present embodiment, when a write operation is, according to the formula ω3 = μ ^ Threshold calculation buffer upper limit of the weight out of the page once the page be executed; when a page is performed for a read operation, is calculated according to the formula ω3 = Threshold right out of the page buffer upper limit of the weight.

[0093] 其中,ω3为页面淘汰权重的上限值;Threshold为预设系数;μ (μ彡1)为读写差异性系数。 [0093] wherein, ω3 is the weight of the upper weight limit pages out; the Threshold is a predetermined coefficient; μ (μ San 1) to read and write the difference coefficient.

[0094] 本实施例对Threshold的大小不做限定,可以根据实际需要进行设定。 Size [0094] Threshold of the embodiment of the present embodiment is not limited, and may be set according to actual needs.

[0095] 403、在页面每次被执行操作后,将页面的淘汰权重基数累加第一预设数值,得到当前页面的淘汰权重值。 [0095] 403, after the page is performed each time the operation, the weight out of the base page accumulating a first predetermined value, to obtain weight values ​​of the current out of the page.

[0096] 缓冲区中存储的页面为正在被访问的页面,为了使该页面不被从缓冲区中删除, 当页面每次被执行操作后,将页面的淘汰权重基数累加第一预设数值,得到当前页面的淘汰权重值。 [0096] stored in the page buffer for the page being accessed, in order that the page is not removed from the buffer, each time when the page operation is performed, the weight of the base page out accumulated first preset value, get out of the weight value of the current page.

[0097] 本实施例对第一预设数值不作限定,可以根据实际需要进行设定。 [0097] This embodiment is not limited in the first preset value, you may be set according to actual needs.

[0098] 作为本实施例的一种实施方式,在页面每次被执行操作后,将该页面的淘汰权重值累加1。 [0098] As an embodiment according to the present embodiment, each page is performed after the operation, the weight out of the weight value accumulated page 1. 当淘汰权重累加到淘汰权重上限值后不再累加。 When the accumulated weights out to the right out of the upper limit value is no longer accumulated after re.

[0099] 404、判断淘汰权重值是否满足预设条件。 [0099] 404, it is determined whether or not the weight value out of preset conditions are satisfied.

[0100] 在缓冲区进行淘汰扫描时,首先判断淘汰权重值是否满足预设条件。 [0100] When scan-out buffer, the first weighting value is determined out meets a preset condition.

[0101] 本实施例对页面的淘汰权重值的预设条件不做限定,可以根据实际需要进行设定。 [0101] The present embodiment of the weight values ​​predetermined condition out of the right page of the embodiment is not limited and may be set according to actual needs.

[0102] 作为本实施例的一种实施方式,判断页面的淘汰权重值是否等于0,若页面的淘汰权重值等于〇,即满足预设条件,则执行步骤406 ;若页面的淘汰权重值不等于0,即不满足预设条件,则执行步骤405。 [0102] As an embodiment according to the present embodiment, out of weight values ​​determines the page is equal to 0, out of a weight value, if the page is equal to the square, i.e., meets a preset condition, execute step 406; if out right page weight Value is equal to 0, i.e., the preset condition is not satisfied, step 405 is executed.

[0103] 405、在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值, 得到当前对应的页面的淘汰权重值。 [0103] 405, carried out at each scanning, the weight does not satisfy a predetermined condition out of the second preset value Save weight values, to obtain weight values ​​corresponding to the current out of the page.

[0104] 为了使长时间不被访问的页面不会占用缓冲区的空间,在每次进行淘汰扫描时, 将不满足预设条件的权重值减第二预设数值。 [0104] To make the page is not accessed for a long time does not take up space in the buffer, the scan-out each time, the condition does not satisfy the preset weight value minus the second predetermined weight value.

[0105] 本实施例对第二预设数值不作限定,可以根据实际需要进行设定。 [0105] This embodiment of the second preset value is not limited, and may be set according to actual needs.

[0106] 作为本实施例的一种实施方式,在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减1。 [0106] As an embodiment according to the present embodiment, carried out at each scanning, the predetermined condition is not satisfied out of the weight value by one.

[0107] 406、将满足预设条件的淘汰权重值对应的页面从缓冲区中删除。 [0107] 406, will meet the preset conditions out of the weight value corresponding page is deleted from the buffer.

[0108] 由于缓冲区的空间有限,因此,如果长时间不被访问的页面占用的缓冲区过多的空间,使得一些被访问的页面无法被存入缓冲区中,导致缓冲区的性能降低。 [0108] Due to the limited space in the buffer, and therefore, too much buffer space if the page is not accessed for a long time occupied, making some pages are accessed and can not be stored in the buffer, resulting in reduced performance of the buffer. 因此,缓冲区定时对该缓冲区中存储的页面进行扫描,并删除长时间不被访问的页面。 Therefore, the timing to scan the page buffer stored in the buffer, and delete pages for a long time not being accessed.

[0109] 作为本实施例的一种实施方式,当页面的淘汰权重值满足预设条件时,将页面从缓冲区中删除。 [0109] As an embodiment according to the present embodiment, when the page-out weight weight value satisfies a preset condition, will remove the page from the buffer.

[0110] 上述方案中,通过为页面的淘汰权重设定淘汰权重上限值,使得那些在短时间被多次访问之后长时间不被访问的页面的淘汰权重数值不为无限大,缓冲区可在短时间内将该页面的淘汰页面权重值减到满足预设条件的数值,缓冲区可以及时将不被访问的页面从缓冲区中删除,释放缓冲区的空间,进而提高缓冲区的性能。 [0110] In the above embodiment, the weight is out of the page on the weight setting out the weight value, so that after a short time out of the right long access times is not accessed pages weight value is not infinitely large, buffer size in the weight value right out of the page in a short time the page is reduced to meet the preset condition value, the buffer can not be accessed promptly page deleted from the buffer, the buffer space is released, thus improving the performance of the buffer.

[0111] 本实施例提供另一种用于缓存数据处理的方法,该方法介绍了在每次进行淘汰扫描时,将被执行读操作的页面从缓冲区中删除,如图6所示,包括以下步骤: [0111] This embodiment provides another method for processing buffered data, which describes the scanning each time-out, a page read operation to be performed is removed from the buffer, shown in Figure 6, comprising the following steps:

[0112] 601、将被执行读操作的页面的淘汰权重基数确定为0。 Out weight the base [0112] 601, a read operation is to be performed is determined to be 0 page.

[0113] 本实施例对被执行读操作的页面的淘汰权重基数不作限定,可以根据实际需要进行设定。 [0113] This embodiment is a page read operation is performed out of the base weight is not limited, and may be set according to actual needs.

[0114] 602、将被执行读操作的页面的淘汰权重上限值设置为0。 [0114] 602, the right to be executed out of the page read operation to re-set upper limit value of 0.

[0115] 本实施例对被执行读操作的页面的淘汰权重上限值不作限定,可以根据实际需要进行设定。 Right out of the page read operation is performed [0115] Example embodiments of the present upper limit of the weight is not limited, and may be set according to actual needs.

[0116] 作为本实施例的一种实施方式,为了在每次进行淘汰扫描时,将被执行读操作的页面从缓冲区中删除,将被执行读操作的页面的淘汰权重上限值设置为0。 Page [0116] As an embodiment according to the present embodiment, in order every time when the scan-out, the read operation will be removed from the buffer, the read operation is to be performed out of the right page is set to the upper limit value of the weight 0.

[0117] 由于被执行读操作的页面的权重基数确定为0,且被执行读操作的页面的淘汰权重上限值被设置为0,因此,被执行读操作的页面的淘汰权重至始终为0。 [0117] Since the right to be executed read operation pages weight basis is determined to be 0, and executed upper limit value out of the weight page read operation is set to 0, therefore, out of the right is a read operation pages weight to always 0 .

[0118] 603、执行步骤403 至406。 [0118] 603, steps 403-406.

[0119] 删除脏页面与删除非脏页面所需的开销不同,删除脏页面的开销大于删除非脏页面的开销,例如:删除一个脏页面的所需时间比删除一个非脏页面的时间长,因此,缓冲区优先考虑删除缓冲区中长时间不被访问的,且删除时开销较小的页面。 [0119] Remove the non-dirty pages to delete the overhead required for different dirty pages, delete dirty pages is greater than the cost of deleting the non-dirty pages overhead, for example: the time required to remove a dirty page longer than delete a non-dirty pages, Therefore, prioritize delete buffer buffer is not accessed for a long time, and when the cost of a smaller page deleted.

[0120] 当缓冲区进行淘汰扫描时,由于被执行读操作的页1面的淘汰权重至始终为0,因此,被执行读操作的页面被从缓冲区中删除。 [0120] When the scan buffers are eliminated, since the read-out operation is performed right on page 1 to the surface of the weight is always 0, therefore, the read operation is performed page is removed from the buffer.

[0121] 本实施例对被执行写操作的页面的删除方法不作限定,可以为本领域技术人员熟知的任意方法。 [0121] Example embodiment of the present method is performed to remove a page write operation is not limited, and any method may be well known to those of skill in the art.

[0122] 上述方案中,由于删除被执行读操作的页面的时间比删除被执行写操作的页面的时间少,因此,将被执行读操作的页面的淘汰权重上限值设置为0,使得在每次进行淘汰扫描时,将被执行读操作的页面从缓冲区中删除,既释放了缓冲区的空间,又减小缓冲区删除页面的开销,提高的缓冲区的性能。 [0122] In the above solution, since the time to delete the read operation of the page is less than the deleted perform page write operation time, therefore, to be executed out of the right page read operation weight upper limit value is set to 0, so every time out of the scan, the read operation will be deleted from the page buffer, the buffer not only free up space, but also reduce the cost of the buffer delete pages, to improve the performance of the buffer.

[0123] 本实施例提供一种用于缓存数据处理的装置,如图7所示,包括:确定单元71、累加单元72、第一计算单元73、第二计算单元74、删除单元75。 [0123] The present embodiment provides a buffer for data processing apparatus, as shown in FIG. 7, comprising: a determining unit 71, the accumulation unit 72, a first calculation unit 73, the second calculating unit 74, deletion unit 75.

[0124] 其中,确定单元71,用于在页面初次读入缓冲区时,确定页面的淘汰权重基数。 [0124] wherein the determining unit 71, configured to, when the page is first read into the buffer, the base weight is determined out of the page.

[0125] 累加单元72,用于在页面每次被执行操作后,将页面的淘汰权重基数累加第一预设数值。 [0125] accumulation unit 72, for each page is performed after the operation, the weight of the base out of the first preset value accumulated page.

[0126] 第一计算单元73,用于若淘汰权重值具有预设的上限值,则在淘汰权重值达到上限值后,停止累加淘汰权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值,得到当前对应的页面的淘汰权重值。 After [0126] The first calculating unit 73, if a weight having a weight value out of preset upper limit, the weight out of the weight reaches the upper limit value, stopping the accumulation out of the base weights, and carried out in each scan, does not satisfy a predetermined condition out of the second weight value Save preset value, to give out the current weight value of the corresponding page.

[0127] 第二计算单元74,用于若淘汰权重值没有预设的上限值,则在每次进行淘汰扫描时,按照不满足预设条件的淘汰权重值与对应的页面在缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值。 [0127] The second calculating unit 74 for phase-out if the weight value is not preset upper limit value, carried out at each scan, in accordance with the preset condition is not satisfied out of the weight values ​​corresponding to the page in the buffer storage time inversely proportional calculation, the weight value of the current out of the page.

[0128] 删除单元75,用于将满足预设条件的淘汰权重值对应的页面从缓冲区中删除。 [0128] 75 deleting unit, configured to satisfy a weight value out of preset condition corresponding to remove the page from the buffer.

[0129] 采用上述方案后,通过对不同属性的页面分别设置淘汰权重上限值,使得那些在短时间被多次访问之后长时间不被访问的页面的淘汰权重数值不为无限大,缓冲区可在短时间内将该页面的淘汰页面权重值减到满足预设条件的数值;或者,按照淘汰权重值与页面在缓冲区中存储的时间成反比的方式计算淘汰权重值,充分考虑到了页面在缓冲区中的停留时间、和删除页面所需的开销,使得缓冲区及时将不被访问的页面从缓冲区中淘汰,释放缓冲区的空间,进而提高缓冲区的性能。 [0129] After the foregoing embodiment, different attributes of the page by setting the weighting value are eliminated, so that after a short time out of the right long access times is not accessed pages weight value is not infinite, the buffer the weight value can be reduced to a short time out of the right page of the page value satisfies a preset condition; alternatively, a weight value calculated out in accordance with the weights and the weight value out of the page stored in the buffer time is inversely proportional manner, taking into account the full page the required residence time in the buffer, and delete pages overhead, making the page buffer in a timely manner will not be accessed eliminated from the buffer, the buffer space is released, thus improving the performance of the buffer.

[0130] 作为实施例的改进,本实施例提供另一种用于缓存数据处理的装置,如图8所示, 包括:确定单元81、累加单元82、第二计算单元83、删除单元84。 [0130] As a modification of the embodiment, the present embodiment provides another apparatus for processing buffered data, as shown in Figure 8, comprising: a determining unit 81, the accumulation unit 82, the second calculating unit 83, deletion unit 84.

[0131] 其中,确定单元81包括:第一设置模块811。 [0131] wherein the determining unit 81 comprises: a first setting module 811.

[0132] 累加单元82包括:累加模块821。 [0132] accumulation unit 82 includes: accumulation module 821.

[0133] 第二计算单元83包括:第一计算模块831、第二计算模块832。 [0133] The second calculation unit 83 comprises: a first calculating module 831, a second calculation module 832.

[0134] 确定单元81,用于在页面初次读入缓冲区时,确定页面的淘汰权重基数。 [0134] 81 determination unit, configured to, when the page is first read into the buffer, the base weight is determined out of the page.

[0135] 具体的,若淘汰权重值没有预设的上限值,第一设置模块811,用于若在页面初次读入缓冲区时,页面被执行的是读操作,则页面的淘汰权重基数为1,若在页面初次读入缓冲区时,页面被执行的是写操作,则页面的淘汰权重基数为μ。 [0135] Specifically, if the weight value is not out of a predetermined upper limit value, a first setting module 811, if a first read page buffer, the page read operation is executed, the page out of the base weight 1, if the first read into the page buffer, the page write operation is to be performed, the page out of the weight of the base is μ.

[0136] 缓冲区通过页面淘汰权重值确定是否将对应的页面从缓冲区中删除,页面的淘汰权重值越大,该页面越需要被存储在缓冲区中,页面的淘汰权重越小,该页面越应该被从缓冲区中删除。 [0136] Buffer is determined by the page-out weighting value corresponding to whether the right to remove the page from the buffer, the greater the weight value out of the page, the page needs to be more in the buffer, out of the page of weights stored in the weight is smaller, the page more should be removed from the buffer.

[0137] 当页面被执行相应操作后,该页面的淘汰权重值会发生变化,变化的过程为基于淘汰权重基数进行相应的运算。 [0137] When a page corresponding operation is performed, the weight value out of the page will change, process variations for the corresponding operation based on the weight out of the right base. 淘汰权重基数为页面初始存入缓冲区中时的淘汰权重值。 Out of the base weights for the weight values ​​stored in the initial page out of Quanshi buffer.

[0138] 累加单元82,用于在页面每次被执行操作后,将页面的淘汰权重基数累加第一预设数值。 [0138] accumulation unit 82, for each page is performed after the operation, the weight of the base out of the first preset value accumulated page.

[0139] 作为本实施例的一种实施方式,累加单元根据公式= R+μ *W对相应被访问后的页面的淘汰权重值累加相应的第一预设数值。 [0139] As an embodiment according to the present embodiment, the first accumulation unit accumulates a respective predetermined value according to the formula = R + μ * W weight values ​​corresponding to the page to be accessed right out. 其中,R为页面被执行读操作次数;W为页面被执行写操作次数;ω i为页面上一次被执行操作后的淘汰权重值。 Wherein, R is the number of page read operation is performed; W is executed, the page write operations; ω i is the weight value of weight-out operation is performed after the first page.

[0140] 具体的,累加模块821,用于在页面每次被执行读操作后,将页面的淘汰权重基数累加1,在页面每次被执行写操作后,将页面的淘汰权重基数累加μ。 [0140] Specifically, the accumulation module 821, for each page is executed after the read operation, the page out accumulated weight base 1, every time after the page write operation, the base of the page-out cumulative weight μ.

[0141] 第二计算单元83,用于若淘汰权重值没有预设的上限值,则在每次进行淘汰扫描时,按照不满足预设条件的淘汰权重值与对应的页面在缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值。 When [0141] The second calculation unit 83, weighting values ​​for phase-out if there is no preset upper limit value, for each scanned out, in accordance with the preset condition is not satisfied out of the weight values ​​corresponding to the page in the buffer storage time inversely proportional calculation, the weight value of the current out of the page.

[0142] 作为本实施例的一种实施方式,在每次进行淘汰扫描时,如果页面在某段时间内没有被访问,页面在缓冲区中存储的时间越长,则该页面的淘汰权重值越小;页面在缓冲区中存储的时间越短,则该页面的淘汰权重值越大。 [0142] As an embodiment according to the present embodiment, carried out at each scanning, if the page has not been accessed within a certain period of time, the longer the page stored in the buffer time, then the page out weighting value the smaller; shorter page stored in the buffer time, then the weight value out of the page increases.

[0143] 具体的,第一计算模块831,用于若不满足预设条件的淘汰权重值对应的页面上一次被执行的为写操作,则根据公式ω 2 = ωι*ΤΙΧ-μ计算当前该页面的淘汰权重值。 [0143] Specifically, the first calculating module 831, to satisfy the preset condition if the weight value corresponding to the phase-out of a page write operation is performed according to the equation ω 2 = ωι * ΤΙΧ-μ calculating the current page right out of the weight value.

[0144] 第二计算模块832,用于若不满足预设条件的淘汰权重值对应的页面上一次被执行的为读操作,则根据公式ω 2= ωι*ΤΙΧ-1计算该页面当前的淘汰权重值。 [0144] The second calculating module 832, a read operation is not satisfied for the value corresponding to the weight out of the page of a predetermined condition to be executed, out of the current page is calculated according to the equation ω 2 = ωι * ΤΙΧ-1 Weights.

[0145] 其中, [0145] wherein,

Figure CN102521162BD00131

为时间局部性系数;ωι为不满足预设条件的淘汰权重值对应的页面上一次被执行操作后的淘汰权重值;μ为读写差异性系数;ω2为当前不满足预设条件的淘汰权重值对应的页面的淘汰权重。 Is the coefficient of temporal locality; ωι not to satisfy a weight value out of weights is performed after a preset operating condition corresponding to the weight value out of the page; [mu] is a coefficient difference reader; [omega] 2 does not satisfy the preset condition for the current out weight out of the weights corresponding page weight.

[0146] 删除单元84,用于将满足预设条件的淘汰权重值对应的页面从缓冲区中删除。 [0146] deleting unit 84, the predetermined condition is satisfied for the value corresponding to the phase-out of the weight page is deleted from the buffer.

[0147] 由于缓冲区的空间有限,因此,如果长时间不被访问的页面占用的缓冲区过多的空间,使得一些被访问的页面无法被存入缓冲区中,导致缓冲区的性能降低。 [0147] Due to the limited space in the buffer, and therefore, too much buffer space if the page is not accessed for a long time occupied, making some pages are accessed and can not be stored in the buffer, resulting in reduced performance of the buffer. 因此,缓冲区定时对该缓冲区中存储的页面进行扫描,并删除长时间不被访问的页面。 Therefore, the timing to scan the page buffer stored in the buffer, and delete pages for a long time not being accessed.

[0148] 作为本实施例的一种实施方式,若页面的淘汰权重值不大于0,即满足预设条件; 若页面的淘汰权重值大于〇,即不满足预设条件,删除单元将满足预设条件的淘汰权重值对应的页面从缓冲区中删除。 [0148] As an embodiment according to the present embodiment, out of the page if the weight value is not greater than 0, i.e., satisfies a preset condition; eliminated if the weight value is greater than a billion pages, i.e., does not satisfy the preset condition deletion unit satisfying pre out of the weight value corresponding page set conditions removed from the buffer.

[0149] 作为本实施例的一种实施方式,当页面的淘汰权重值满足预设条件时,删除单元将页面从缓冲区中删除。 [0149] As an embodiment according to the present embodiment, when the page-out weight weight value satisfies a preset condition deletion unit deleting a page from the buffer.

[0150] 上述方案中,由于删除脏页面与删除非脏页面所需的开销不同,删除脏页面的开销大于删除非脏页面的开销,因此,对执行写操作的页面与对执行读操作的页面的淘汰权重基数、第一预设数值、第二预设数值进行分别设定,使得缓冲区优先删除开销较小的页面;在每次进行淘汰扫描时,根据公式ω 2 = ω^ΤΙΧ-μ、或公式ω2 = ωι*ΤΙΧ-1计算页面的淘汰权重,充分考虑到了页面在缓冲区中的停留时间、和删除页面所需的开销,使得缓冲区及时将不被访问的页面从缓冲区中淘汰,释放缓冲区的空间,进而提高缓冲区的性能。 [0150] In the above embodiment, since the dirty pages to delete the deleted non-dirty pages different overhead required to delete dirty pages is greater than the cost of deleting the non-dirty pages overhead, therefore, a page write operation and a read operation is performed on the page elimination weight base, a first preset value, the second predetermined numerical values ​​are set such that priority remove small overhead buffer page; carried out at each scanning, according to the equation ω 2 = ω ^ ΤΙΧ-μ or formula ω2 = right out of ωι * ΤΙΧ-1 calculation page is heavy, fully taking into account the necessary residence time of a page in the buffer, and delete pages overhead, so that the buffer will not be in time to access a page from the buffer eliminated, freeing up space in the buffer, thus improving the performance of the buffer.

[0151] 本实施例提供另一种用于缓存数据处理的装置,如图9所示,包括:确定单元91、 第三计算单元92、第四计算单元93、累加单元94、第一计算单元95、删除单元96。 [0151] The present embodiment provides another apparatus for processing buffered data, shown in Figure 9, comprising: determining means 91, third calculating unit 92, a fourth calculating unit 93, the accumulation unit 94, a first calculation unit 95, delete unit 96.

[0152] 其中,确定单元91,用于在页面初次读入缓冲区时,确定页面的淘汰权重基数。 [0152] wherein the determining unit 91, configured to, when the page is first read into the buffer, the base weight is determined out of the page.

[0153] 进一步可选的,若淘汰权重值具有预设的上限值,确定单元将页面的淘汰权重基数确定为预设值。 [0153] Further, optionally, when having a weight value out of preset upper limit value, the weight determining unit out of the base of the page is determined to be a preset value.

[0154] 作为本实施例是一种实施方式,确定单元将页面的淘汰权重基数确定为1。 [0154] Example is an embodiment, the weight determination unit out of the base of the page is determined as a present embodiment.

[0155] 第三计算单元92,用于当页面上一次被执行的为写操作时,根据公式ω3 = μ ^Threshold计算缓冲区中该页面的淘汰权重上限值。 [0155] The third computing unit 92, is for a write operation, according to the formula ω3 = μ ^ Threshold weight calculated out of the page buffer upper limit value when the page re-executed once.

[0156] 为了使页面在被多次访问后,该页面的淘汰权重值不为无限大,为页面淘汰权重确定淘汰权重上限值,使得淘汰权重值在累加到淘汰权重上限值后不再增加。 [0156] To make the page after being repeatedly accessed out of the weight value of the page is not infinite, a page out of a weight determination on the phase-out weighting value, such that the weight value out weight the accumulated onto out of the weight value after no increase.

[0157] 由于删除脏页面与删除非脏页面所需的开销不同,删除脏页面的开销大于删除非脏页面的开销,例如:删除一个脏页面的所需时间比删除一个非脏页面的时间长,因此,缓冲区优先考虑删除缓冲区中长时间不被访问的,且删除时开销较小的页面,因此,通过第三计算单元、第四计算单元分别对被执行读操作的页面与被执行写操作的页面设置淘汰权重上限值。 [0157] Since the non-deleted and deleted dirty dirty pages overhead required different page, delete dirty pages is greater than the cost overhead remove non-dirty pages, for example: the time required to remove a dirty pages of a non-dirty pages longer than the deleted Therefore, prioritize delete buffer buffer is not accessed for a long time, and cost less when you delete a page, so by the third calculation unit, the fourth computing unit respectively with the execution of the page read operation is performed write page setup out of the upper limit of the weight.

[0158] 第四计算单元93,用于当页面上一次被执行的为读操作时,根据公式ω3 = Threshold计算缓冲区中该页面的淘汰权重上限值。 When [0158] The fourth calculating unit 93, when for the first page read operation is performed, is calculated according to the formula ω3 = Threshold right out of the page buffer upper limit of the weight.

[0159] 其中,ω3为页面淘汰权重的上限值;Threshold为预设系数;μ为读写差异性系数。 [0159] wherein, ω3 is the weight of the upper weight limit pages out; the Threshold is a predetermined coefficient; [mu] is a coefficient read difference.

[0160] 累加单元94,用于在面每次被执行操作后,将页面的淘汰权重基数累加第一预设数值。 [0160] accumulation unit 94, for each surface is performed after the operation, the weight of the base out of the first preset value accumulated page.

[0161] 作为本实施例是一种实施方式,在页面每次被执行操作后,累加单元将该页面的淘汰权重值累加1。 [0161] As the present embodiment is an embodiment, each page is performed after the operation, the accumulated weight value out of the page unit is incremented by one. 当淘汰权重累加到淘汰权重上限值后不再累加。 When the accumulated weights out to the right out of the upper limit value is no longer accumulated after re.

[0162] 第一计算单元95,用于若淘汰权重值具有预设的上限值,则在淘汰权重值达到上限值后,停止累加淘汰权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值,得到当前对应的页面的淘汰权重值。 After [0162] The first calculating unit 95, if a weight having a weight value out of preset upper limit, the weight out of the weight reaches the upper limit value, stopping the accumulation out of the base weights, carried out and at each scan, does not satisfy a predetermined condition out of the second weight value Save preset value, to give out the current weight value of the corresponding page.

[0163] 为了使长时间不被访问的页面不会占用缓冲区的空间,在每次进行淘汰扫描时, 第一计算单元将不满足预设条件的权重值减第二预设数值。 [0163] To make the page is not accessed for a long time does not take up space in the buffer, each time out of the scan, the first calculation unit does not satisfy the condition preset weight value minus the second predetermined weight value.

[0164] 作为本实施例的一种实施方式,在每次进行淘汰扫描时,第一计算单元将不满足预设条件的淘汰权重值减1。 [0164] As an embodiment according to the present embodiment, carried out at each scan, the first calculation means does not satisfy a predetermined condition out of the right weight value by one.

[0165] 删除单元96,用于将满足预设条件的淘汰权重值对应的页面从缓冲区中删除。 [0165] 96 deleting unit, configured to meet the requirements out the weight value corresponding to a preset condition is deleted from the page buffer.

[0166] 由于缓冲区的空间有限,因此,如果长时间不被访问的页面占用的缓冲区过多的空间,使得一些被访问的页面无法被存入缓冲区中,导致缓冲区的性能降低。 [0166] Due to the limited space in the buffer, and therefore, too much buffer space if the page is not accessed for a long time occupied, making some pages are accessed and can not be stored in the buffer, resulting in reduced performance of the buffer. 因此,缓冲区定时对该缓冲区中存储的页面进行扫描,并删除长时间不被访问的页面。 Therefore, the timing to scan the page buffer stored in the buffer, and delete pages for a long time not being accessed.

[0167] 作为本实施例的一种实施方式,若页面的淘汰权重值等于0,即满足预设条件;若页面的淘汰权重值不等于0,即不满足预设条件,删除单元将满足预设条件的淘汰权重值对应的页面从缓冲区中删除。 [0167] As an embodiment according to the present embodiment, when the page-out weighting value is equal to 0, i.e., satisfies a preset condition; right out of the page if the weight value is not equal to 0, i.e., does not satisfy the preset condition deletion unit satisfying pre out of the weight value corresponding page set conditions removed from the buffer.

[0168] 上述方案中,通过为页面的淘汰权重设定淘汰权重上限值,使得那些在短时间被多次访问之后长时间不被访问的页面的淘汰权重数值不为无限大,缓冲区可在短时间内将该页面的淘汰页面权重值减到满足预设条件的数值,缓冲区可以及时将不被访问的页面从缓冲区中淘汰,释放缓冲区的空间,进而提高缓冲区的性能。 [0168] In the above embodiment, the weight is out of the page on the weight setting out the weight value, so that after a short time out of the right long access times is not accessed pages weight value is not infinitely large, buffer size in the weight value right out of the page in a short time the page is reduced to meet the preset condition value, the buffer can not be promptly page accessed eliminated from the buffer, the buffer space is released, thus improving the performance of the buffer.

[0169] 本实施例提供一种用于缓存数据处理的装置,如图10所示,包括:确定单元101、 第四计算单元102、累加单元103、第一计算单元104、删除单元105。 [0169] The present embodiment provides a buffer for data processing apparatus, shown in Figure 10, comprising: a determination unit 101, a fourth calculating unit 102, the accumulation unit 103, a first calculation unit 104, a deleting unit 105.

[0170] 确定单元101,用于在页面初次读入缓冲区时,确定页面的淘汰权重基数。 [0170] determination unit 101, configured to, when the page is first read into the buffer, the base weight is determined out of the page.

[0171] 进一步可选的,确定单元将被执行读操作的页面的淘汰权重基数确定为0。 [0171] Further, optionally, the weight out of the base unit determines a read operation to be performed is determined to be 0 page.

[0172] 第四计算单元103,用于当页面上一次被执行的为读操作时,将该页面的淘汰权重上限值设置为0。 [0172] The fourth calculation means 103 for, when a read operation is performed on the page, the page out of the right weight upper limit value is set to zero.

[0173] 累加单元104,用于在面每次被执行操作后,将页面的淘汰权重基数累加第一预设数值。 [0173] accumulation unit 104, for each surface is performed after the operation, the weight of the base out of the first preset value accumulated page.

[0174] 作为本实施例是一种实施方式,在页面每次被执行操作后,累加单元将该页面的淘汰权重值累加1。 [0174] As the present embodiment is an embodiment, each page is performed after the operation, the accumulated weight value out of the page unit is incremented by one. 当淘汰权重累加到淘汰权重上限值后不再累加。 When the accumulated weights out to the right out of the upper limit value is no longer accumulated after re.

[0175] 由于被执行读操作的页面的权重基数确定为0,且被执行读操作的页面的淘汰权重上限值被设置为〇,因此,被执行读操作的页面的淘汰权重至始终为〇。 [0175] Since the right to be executed read operation pages weight basis is determined to be 0, and executed upper limit value out of the weight page read operation is set to be square, therefore, to be executed out of the right page read operation weight to always square .

[0176] 第一计算单元105,用于若淘汰权重值具有预设的上限值,则在淘汰权重值达到上限值后,停止累加淘汰权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值,得到当前对应的页面的淘汰权重值。 After [0176] The first calculation unit 105, a weight when the weight having a value out of a predetermined upper limit value, the weights in the weight reaches the upper limit value is eliminated, stopping the accumulation out of the base weights, and carried out in each scan, does not satisfy a predetermined condition out of the second weight value Save preset value, to give out the current weight value of the corresponding page.

[0177] 为了使长时间不被访问的页面不会占用缓冲区的空间,在每次进行淘汰扫描时, 第一计算单元将不满足预设条件的权重值减第二预设数值。 [0177] To make the page is not accessed for a long time does not take up space in the buffer, each time out of the scan, the first calculation unit does not satisfy the condition preset weight value minus the second predetermined weight value.

[0178] 作为本实施例的一种实施方式,在每次进行淘汰扫描时,第一计算单元将不满足预设条件的淘汰权重值减1。 [0178] As an embodiment according to the present embodiment, carried out at each scan, the first calculation means does not satisfy a predetermined condition out of the right weight value by one.

[0179] 删除单元106,用于将满足预设条件的淘汰权重值对应的页面从缓冲区中删除。 [0179] deleting unit 106, meeting a preset condition for the phase-out of a page corresponding weight values ​​removed from the buffer.

[0180] 当缓冲区进行淘汰扫描时,由于被执行读操作的页面的淘汰权重至始终为〇,因此,被执行读操作的页面被删除单元从缓冲区中删除。 [0180] When the buffer for scan-out, due to the right out of the page read operation is performed to always square weight, therefore, the read operation is performed page deletion unit is removed from the buffer.

[0181] 上述方案中,由于删除被执行读操作的页面的时间比删除被执行写操作的页面的时间少,因此,将被执行读操作的页面的淘汰权重上限值设置为0,使得在每次进行淘汰扫描时,将被执行读操作的页面从缓冲区中删除,既释放了缓冲区的空间,有减小缓冲区删除页面的开销,提高的缓冲区的性能。 [0181] In the above solution, since the time to delete the read operation of the page is less than the deleted perform page write operation time, therefore, to be executed out of the right page read operation weight upper limit value is set to 0, so every time out of the scan, the read operation will be deleted from the page buffer, both the release of buffer space, there is a buffer to reduce overhead delete pages, to improve the performance of the buffer.

[0182] 通过以上的实施方式的描述,所属领域的技术人员可以清楚地了解到本发明可借助软件加必需的通用硬件的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。 [0182] By the above described embodiments, those skilled in the art may clearly understand that the present invention may be implemented by software plus necessary universal hardware implemented, also be implemented by hardware, but the former is preferred in many cases embodiments. 基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在可读取的存储介质中,如计算机的软盘,硬盘或光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机, 服务器,或者网络设备等)执行本发明各个实施例所述的方法。 Based on such understanding, the technical solutions of the present invention in essence or the part contributing to the prior art may be embodied in a software product out, in the storage medium may be readable, such as a floppy disk of the computer software product is stored and the like, a hard disk or optical disk, and include several instructions that enable a computer device (may be a personal computer, a server, or network device) to execute the methods according to embodiments of the present invention.

[0183] 以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。 [0183] The above are only specific embodiments of the present invention, but the scope of the present invention is not limited thereto, any skilled in the art in the art within the technical scope of the present invention is disclosed, variations may readily occur or Alternatively, it shall fall within the protection scope of the present invention. 因此,本发明的保护范围应所述以权利要求的保护范围为准。 Accordingly, the scope of the present invention should be in the scope of the claims and their equivalents.

Claims (10)

  1. 1. 一种用于缓存数据处理的方法,其特征在于, 在页面初次读入缓冲区时,确定所述页面的淘汰权重基数; 在所述页面每次被执行操作后,将所述页面的淘汰权重基数累加第一预设数值; 若所述淘汰权重值具有预设的上限值,则在所述淘汰权重值达到所述上限值后,停止累加所述淘汰权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值,得到当前对应的页面的淘汰权重值; 若所述淘汰权重值没有预设的上限值,则在每次进行淘汰扫描时,按照所述不满足所述预设条件的淘汰权重值与对应的页面在所述缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值; 将满足所述预设条件的淘汰权重值对应的页面从所述缓冲区中删除; 其中,所述淘汰权重值没有预设的上限值时,所述在页面初次读入缓冲 1. A method for processing data cache, wherein, when the page is first read into the buffer, determining the weight of the base out of the page; after the operation is performed each time the page, the page accumulating a first base weight out preset value; eliminated if the weighting value has a predetermined upper limit value, the weight out of the weight value reaches the upper limit value, stopping the accumulation of the weights out of the base, and each of when the time-out for scanning the weight does not satisfy a predetermined condition out of the second preset value Save weight values, out to obtain weight values ​​corresponding to the current page; if the weight value is not out of a predetermined upper limit value, at each time inversely proportional to the time-out time for scanning, according to the phase-out does not satisfy the preset condition and the weight values ​​stored in the corresponding page in the buffer calculation, the weight value of the current out of the page; satisfying the preset condition out weighting value corresponding to remove the page from the buffer; wherein the weight value is not out of a predetermined upper limit value, the first page is read into the buffer in 时,确定所述页面的淘汰权重基数包括: 若在页面初次读入缓冲区时,所述页面被执行的是读操作,则所述页面的淘汰权重基数为1,若在页面初次读入缓冲区时,所述页面被执行的是写操作,则所述页面的淘汰权重基数为μ ; 所述按照所述不满足所述预设条件的淘汰权重值与对应的页面在所述缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值包括: 若所述不满足所述预设条件的淘汰权重值对应的页面上一次被执行的为写操作,则根据公式ω2 = ωι*ΤΙΧ-μ计算当前该页面的淘汰权重值; 若所述不满足所述预设条件的淘汰权重值对应的页面上一次被执行的为读操作,则根据公式ω2 = ωι*ΤΙΧ-1计算该页面当前的淘汰权重值; 其中, When determining the weight of the page-out base comprising: if the first read into the page buffer, the page is a read operation is performed, the weight of the page out of the base 1, when the first page is read into the buffer time zone, the page write operation is to be performed, then out of the page [mu] is the weight of the base; said phase-out in accordance with said predetermined weight does not satisfy the condition corresponding to the value of the page in the buffer stored in a manner inversely proportional to time is calculated to obtain the current weight value out of the page comprises: when the upper-out does not satisfy the preset weight value corresponding to the conditions of a page write operation is performed according to the equation ω2 = ωι * ΤΙΧ-μ calculating a current value of the page-out weights; if the condition does not satisfy the preset weight value corresponding to the phase-out of a page read operation is performed according to the equation ω2 = ωι * ΤΙΧ-1 the current page is calculated out weighting value; wherein,
    Figure CN102521162BC00021
    为时间局部性系数;为所述不满足所述预设条件的淘汰权重值对应的页面上一次被执行操作后的淘汰权重值;μ为读写差异性系数;ω2为当前所述不满足所述预设条件的淘汰权重值对应的页面的淘汰权重。 Coefficient of temporal locality; time to be performed on the phase-out does not satisfy the preset condition weighting value corresponding to a weight value of the page-out right after operation; [mu] is a coefficient difference reader; [omega] 2 is not satisfied by the current right out of said predetermined condition out of the page corresponding to the weight value of the weight.
  2. 2. 根据权利要求1所述的用于缓存数据处理的方法,其特征在于,所述在所述页面每次被执行操作后,将所述页面的淘汰权重基数累加第一预设数值包括: 在所述页面每次被执行读操作后,将所述页面的淘汰权重基数累加1,在所述页面每次被执行写操作后,将所述页面的淘汰权重基数累加μ。 A method according to claim buffer for data processing according to 1, wherein each said page after the operation is performed, the weight of the base page out accumulated first preset number comprising: after the read operation is executed every page, the page out of the weight of the base 1 is accumulated in the page write operation is performed each time the weight of the base out of the page accumulated μ.
  3. 3. 根据权利要求1所述的用于缓存数据处理的方法,其特征在于,所述淘汰权重值具有预设的上限值时,所述页面的淘汰权重基数为预设值。 The method for caching data processing according to claim 1, wherein, out of said weight value with a predetermined upper limit value, out of the page as a preset weight base.
  4. 4. 根据权利要求3所述的用于缓存数据处理的方法,其特征在于,在所述在所述淘汰权重值达到所述上限值后,停止累加所述淘汰权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值之前,所述方法包括: 当所述页面上一次被执行的为写操作时,根据公式ω3= μ threshold计算缓冲区中该页面的淘汰权重上限值; 当所述页面上一次被执行的为读操作时,根据公式ω3 = Threshold计算缓冲区中该页面的淘汰权重上限值; 其中,ω3为所述页面淘汰权重的上限值;Threshold为预设系数;μ为读写差异性系数。 The method for caching data processing according to claim 3, wherein, after said upper limit value of the weight values ​​of said weight reaches out to stop accumulating the weights out of the base, and each when the scan-out, does not satisfy a predetermined condition out right before the second predetermined value Save weight values, the method comprising: when a write operation is calculated according to the formula ω3 = μ threshold time is performed on the page buffer zone out the weight of the upper limit of the page; the page when a read operation is performed, according to the phase-out of the weight calculation formula ω3 = Threshold in the page buffer value; wherein, the page is Omega-3 weight weight out of the upper limit; the Threshold is a predetermined coefficient; [mu] is a coefficient read difference.
  5. 5. 根据权利要求4所述的用于缓存数据处理的方法,其特征在于,若在页面初次读入缓冲区时,所述页面被执行的是读操作,则所述页面的淘汰权重基数为〇,并且该页面的淘汰权重上限值为0。 The method for caching data processing according to claim 4, wherein, if the page is first read into the buffer when the page is a read operation is performed, the weight of the page out cardinality billion, and out of the upper limit of the weight of the right page is zero.
  6. 6. -种用于缓存数据处理的装置,其特征在于, 确定单元,用于在页面初次读入缓冲区时,确定所述页面的淘汰权重基数; 累加单元,用于在所述页面每次被执行操作后,将所述页面的淘汰权重基数累加第一预设数值; 第一计算单元,用于若所述淘汰权重值具有预设的上限值,则在所述淘汰权重值达到所述上限值后,停止累加所述淘汰权重基数,并且在每次进行淘汰扫描时,将不满足预设条件的淘汰权重值减第二预设数值,得到当前对应的页面的淘汰权重值; 第二计算单元,用于若所述淘汰权重值没有预设的上限值,则在每次进行淘汰扫描时, 按照所述不满足所述预设条件的淘汰权重值与对应的页面在所述缓冲区中存储的时间成反比的方式计算,得到当前该页面的淘汰权重值; 删除单元,用于将满足所述预设条件的淘汰权重值对应的页面从所述 6. - species for cache data processing means, wherein the determination unit, configured to, when the page is first read into the buffer, to determine the weight out of the base of the page; accumulation unit, for each page in the after the operation is performed, the weight of the base out of the page a first preset value accumulated; first calculating means for phase-out if the weight value with a predetermined upper limit value is reached the weight out of the weight value when the upper limit value described later, to stop accumulating the weights out of the base, and carried out in each scanning, the weight does not satisfy a predetermined condition out of the second preset value Save weight values, to obtain weight values ​​corresponding to the current out of the page; second calculating means for, if the upper limit value is not out of a predetermined weight, are carried out in each scanning, according to the phase-out does not satisfy the preset condition and weight values ​​corresponding to the page said time stored in the buffer inversely proportional calculation, the weight value of the current out of the page; deletion unit, satisfies the preset condition for the elimination weight value corresponding to the page from 缓冲区中删除; 其中,所述确定单元包括: 第一设置模块,用于若在页面初次读入缓冲区时,所述页面被执行的是读操作,则所述页面的淘汰权重基数为1,若在页面初次读入缓冲区时,所述页面被执行的是写操作,则所述页面的淘汰权重基数为μ ; 所述第二计算单元包括: 第一计算模块,用于若所述不满足所述预设条件的淘汰权重值对应的页面上一次被执行的为写操作,则根据公式ω2= ωι*ΤΙΧ-μ计算当前该页面的淘汰权重值; 第二计算模块,用于若所述不满足所述预设条件的淘汰权重值对应的页面上一次被执行的为读操作,则根据公式ω2 = ωι*ΤΙΧ-1计算该页面当前的淘汰权重值; 其中, Remove buffer; wherein said determining means comprises: a first setting module configured to read into the buffer if the first page, the page is a read operation is performed, the weight of the base out of the page 1 If when the page is first read into the buffer, the page write operation is to be performed, then out of the page [mu] is the weight of the base; said second calculation unit comprises: a first calculating module, configured to, if the the condition does not satisfy the preset weight value corresponding to the phase-out of a page write operation is performed, then ω2 = ωι * ΤΙΧ-μ calculating a current value according to the formula weights out of the page; a second calculating module, configured to, if the read operation does not satisfy the preset condition out weighting value corresponding to a page to be executed, the page is calculated out of the current weight value according to the formula weights ω2 = ωι * ΤΙΧ-1; wherein
    Figure CN102521162BC00031
    为时间局部性系数;为所述不满足所述预设条件的淘汰权重值对应的页面上一次被执行操作后的淘汰权重值;μ为读写差异性系数;ω2为当前所述不满足所述预设条件的淘汰权重值对应的页面的淘汰权重。 Coefficient of temporal locality; time to be performed on the phase-out does not satisfy the preset condition weighting value corresponding to a weight value of the page-out right after operation; [mu] is a coefficient difference reader; [omega] 2 is not satisfied by the current right out of said predetermined condition out of the page corresponding to the weight value of the weight.
  7. 7. 根据权利要求6所述的用于缓存数据处理的装置,其特征在于,所述累加单元包括: 累加模块,用于在所述页面每次被执行读操作后,将所述页面的淘汰权重基数累加1, 在所述页面每次被执行写操作后,将所述页面的淘汰权重基数累加μ。 7. The cache data processing apparatus according to claim 6, wherein said accumulating means comprises: accumulating means for each page, after the read operation is executed, will be out of the page cumulative weight base 1, each time the page write operation is performed, the weight out of the base of the page accumulated μ.
  8. 8. 根据权利要求6所述的用于缓存数据处理的装置,其特征在于,所述淘汰权重值具有预设的上限值时,所述确定单元将所述页面的淘汰权重基数确定为预设值。 8. A data processing apparatus for caching according to claim 6, wherein, when the weight value out of preset upper limit value has, the weight determination unit out of the base of the page pre-determined set value.
  9. 9. 根据权利要求8所述的用于缓存数据处理的装置,其特征在于,所述装置还包括: 第三计算单元,用于当所述页面上一次被执行的为写操作时,根据公式ω 3 = μ ^Threshold计算缓冲区中该页面的淘汰权重上限值; 第四计算单元,用于当所述页面上一次被执行的为读操作时,根据公式ω3 = Threshold计算缓冲区中该页面的淘汰权重上限值; 其中,ω3为所述页面淘汰权重的上限值;Threshold为预设系数;μ为读写差异性系数。 9. A data processing apparatus for caching according to claim 8, characterized in that said apparatus further comprises: a third calculating unit is for a write operation, in accordance with the formula when the first page is performed ω 3 = μ ^ Threshold calculation buffer upper limit of the page-out weights; fourth calculation unit for the time when the page is a read operation is performed, is calculated according to the formula = Threshold buffer the ω3 out of the page back on the weight limit; wherein, ω3 is the weight of the upper limit of the right page out; the Threshold is a predetermined coefficient; [mu] is a coefficient read difference.
  10. 10.根据权利要求9所述的用于缓存数据处理的装置,其特征在于,若在页面初次读入缓冲区时,所述页面被执行的是读操作,则所述确定单元将所述页面的淘汰权重基数确定为0,并且所述第四计算单元将该页面的淘汰权重上限值计算为0。 10. A device for caching the data processing according to claim 9, wherein, if the first read into the page buffer, the page is a read operation is performed, the determining unit sets the page the base weight is determined to be out of 0, and the fourth calculating unit out of the upper limit of the right page of weights is calculated as 0.
CN 201110390186 2011-11-30 2011-11-30 Method and device for cache data processing CN102521162B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN 201110390186 CN102521162B (en) 2011-11-30 2011-11-30 Method and device for cache data processing

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN 201110390186 CN102521162B (en) 2011-11-30 2011-11-30 Method and device for cache data processing
PCT/CN2012/085639 WO2013079014A1 (en) 2011-11-30 2012-11-30 Cached data processing method and device

Publications (2)

Publication Number Publication Date
CN102521162A true CN102521162A (en) 2012-06-27
CN102521162B true CN102521162B (en) 2014-12-31

Family

ID=46292091

Family Applications (1)

Application Number Title Priority Date Filing Date
CN 201110390186 CN102521162B (en) 2011-11-30 2011-11-30 Method and device for cache data processing

Country Status (2)

Country Link
CN (1) CN102521162B (en)
WO (1) WO2013079014A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102521162B (en) * 2011-11-30 2014-12-31 华为技术有限公司 Method and device for cache data processing
CN106294200A (en) * 2016-08-26 2017-01-04 昆明理工大学 Operating system page replacement algorithm

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101008922A (en) * 2007-01-26 2007-08-01 浙江大学 Segmentation and paging data storage space management method facing heterogeneous polynuclear system
CN101443740A (en) * 2006-05-17 2009-05-27 高通股份有限公司 Method and system for maximum residency replacement of cache memory
CN101595459A (en) * 2006-12-01 2009-12-02 美国日本电气实验室公司 Methods and systems for quick and efficient data management and/or processing

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7099999B2 (en) * 2003-09-30 2006-08-29 International Business Machines Corporation Apparatus and method for pre-fetching data to cached memory using persistent historical page table data
US8473684B2 (en) * 2009-12-22 2013-06-25 International Business Machines Corporation Delayed replacement of cache entries
CN102439574B (en) * 2011-04-18 2015-01-28 华为技术有限公司 Data replacement method in system cache and multi-core communication processor
CN102521162B (en) * 2011-11-30 2014-12-31 华为技术有限公司 Method and device for cache data processing

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101443740A (en) * 2006-05-17 2009-05-27 高通股份有限公司 Method and system for maximum residency replacement of cache memory
CN101595459A (en) * 2006-12-01 2009-12-02 美国日本电气实验室公司 Methods and systems for quick and efficient data management and/or processing
CN101008922A (en) * 2007-01-26 2007-08-01 浙江大学 Segmentation and paging data storage space management method facing heterogeneous polynuclear system

Also Published As

Publication number Publication date Type
WO2013079014A1 (en) 2013-06-06 application
CN102521162A (en) 2012-06-27 application

Similar Documents

Publication Publication Date Title
US6807607B1 (en) Cache memory management system and method
US20060271740A1 (en) Performing read-ahead operation for a direct input/output request
US20060090031A1 (en) Using external memory devices to improve system performance
US20110066830A1 (en) Cache prefill on thread migration
CN103186350A (en) Hybrid storage system and hot spot data block migration method
US20100235582A1 (en) Method and mechanism for delaying writing updates to a data cache
US20150378888A1 (en) Controller, flash memory apparatus, and method for writing data into flash memory apparatus
US20120210042A1 (en) Remote memory for virtual machines
US20090216945A1 (en) Storage system which utilizes two kinds of memory devices as its cache memory and method of controlling the storage system
US8473680B1 (en) Hotspot detection and caching for storage devices
US20130290595A1 (en) Dynamic database memory management according to swap rates
US20120151148A1 (en) Systems and methods for background destaging storage tracks
US20130185229A1 (en) Apparatus and method for managing storage of data blocks
US20150046648A1 (en) Implementing dynamic cache enabling and disabling based upon workload
US20130073783A1 (en) Hybrid data storage management taking into account input/output (i/o) priority
CN101788995A (en) Hotspot data identification method and device
US20110219169A1 (en) Buffer Pool Extension for Database Server
US20090327607A1 (en) Apparatus and method for cache utilization
US20130205089A1 (en) Cache Device and Methods Thereof
US20050172076A1 (en) System for managing distributed cache resources on a computing grid
CN103902474A (en) Mixed storage system and method for supporting solid-state disk cache dynamic distribution
Batsakis et al. AWOL: An Adaptive Write Optimizations Layer.
CN103309820A (en) Implementation method for disk array cache
US20060026363A1 (en) Memory control device, move-in buffer control method
CN102298547A (en) A data backup method and apparatus

Legal Events

Date Code Title Description
C06 Publication
C10 Request of examination as to substance
C14 Granted