WO2017015952A1 - Method of replacing stored data in cache and device utilizing same - Google Patents

Method of replacing stored data in cache and device utilizing same Download PDF

Info

Publication number
WO2017015952A1
WO2017015952A1 PCT/CN2015/085571 CN2015085571W WO2017015952A1 WO 2017015952 A1 WO2017015952 A1 WO 2017015952A1 CN 2015085571 W CN2015085571 W CN 2015085571W WO 2017015952 A1 WO2017015952 A1 WO 2017015952A1
Authority
WO
WIPO (PCT)
Prior art keywords
cache
block
weight
replacement
main memory
Prior art date
Application number
PCT/CN2015/085571
Other languages
French (fr)
Chinese (zh)
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
Application filed by 华为技术有限公司 filed Critical 华为技术有限公司
Priority to CN201580081799.4A priority Critical patent/CN107851068A/en
Priority to PCT/CN2015/085571 priority patent/WO2017015952A1/en
Publication of WO2017015952A1 publication Critical patent/WO2017015952A1/en

Links

Images

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

Definitions

  • Embodiments of the present invention relate to the field of computer technologies, and in particular, to a replacement method and a replacement device for storing data in a cache memory.
  • the cache was first proposed by Wilkes in 1951 to compensate for the speed difference between the processor CPU and main memory, and is the most important part of the storage system. As the cache capacity is higher, the price is higher and the difficulty is higher. Therefore, the cache capacity is generally much smaller than the main memory, so some data is not stored in the cache. When accessing this part of the data, a miss occurs (cache). Miss), otherwise known as a hit (cache hit). The performance of the Cache is closely related to the cache hit rate. The higher the cache hit rate, the less time the storage access takes, and the higher the performance of the cache. Conversely, the lower the cache performance.
  • the choice of the replacement algorithm has a greater impact on the hit rate of the cache.
  • the replacement algorithms currently commonly used are the LRU (Least recently used) algorithm and the LFU (Lease Frequently Used) algorithm.
  • the LRU is based on the use of each block, always selecting the least recently used block to be replaced; the LFU algorithm is to replace the content with the least number of accesses out of the cache.
  • the performance of the Cache directly affects the performance of the storage system, and the system of the storage system determines the efficiency of the communication. With the replacement algorithm in the prior art, the performance of the storage system cannot be effectively improved.
  • Embodiments of the present invention provide a replacement method and a replacement device for storing data in a cache memory, which can improve the performance of the storage system.
  • a first aspect of the present invention provides a method for replacing data stored in a cache, including:
  • Determining a cache group corresponding to the main storage block where the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is according to a main memory of the storage data of the cache block. Access rate and access latency are determined;
  • the determined storage data of the replacement cache block is replaced with the storage data of the main storage block.
  • the determining, by the weight of each of the cache blocks in the cache group, the replacement cache block includes:
  • block pointer information the block pointer information being used to indicate a preliminary replacement cache block
  • the prepared replacement cache block is used as the replacement cache block.
  • the method further includes:
  • the determining, by the weight of each of the cache blocks in the cache group, the replacement cache block includes:
  • the preset replacement algorithm Determining, by the preset replacement algorithm, the replacement cache block in the cache block whose weight is less than the second preset weight, wherein the preset replacement algorithm includes an LRU algorithm, an LFU algorithm, and a first in first out algorithm An algorithm.
  • the method further includes :
  • the weight of the cache block in which the stored data reaches the second preset weight in the cache block that does not exist for the preset duration is decremented by one.
  • the method further includes:
  • the stored data of the main memory block is stored in the cache block in which the cache group is free.
  • the determining that the main memory block to be stored in the main memory includes:
  • the receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
  • a second aspect of the present invention provides a device for storing data in a cache, including:
  • a main memory block determining module configured to determine a main memory block to be stored in the main memory
  • a group determining module configured to determine a cache group corresponding to the main memory block, where the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is determined according to the cache block The access rate and access latency of the main memory to which the storage data belongs are determined;
  • a replacement block determining module configured to determine, according to weights of each of the cache blocks in the cache group, a replacement cache block
  • a data replacement module configured to replace the determined storage data of the replacement cache block with the storage data of the primary storage block.
  • the replacement block determining module includes:
  • a pointer information obtaining unit configured to acquire block pointer information, where the block pointer information is used to indicate a preliminary replacement cache block
  • a searching unit configured to search for the prepared replacement cache block according to the block pointer information
  • a determining unit configured to determine whether a weight of the prepared replacement cache block searched by the searching unit is smaller than a first preset weight
  • a first replacement block determining unit configured to use the prepared replacement cache block as the replacement cache block if a weight of the preliminary replacement cache block is smaller than the first preset weight.
  • the apparatus further includes:
  • a weight control module configured to: if the weight of the prepared replacement cache block reaches the first preset weight, reduce the weight of the prepared replacement cache block by one;
  • a pointer information control module configured to: if the weight of the prepared replacement cache block reaches the first Presetting the weight, flipping the block pointer information, and triggering the replacement block determining module to determine the replacement cache block according to the weight of each of the cache blocks in the cache group.
  • the replacement block determining module includes:
  • a filtering unit configured to determine a cache block in the cache group that has a weight less than a second preset weight
  • a second replacement block determining unit configured to determine the replacement cache block in a cache block whose weight is less than a second preset weight according to a preset replacement algorithm, where the preset replacement algorithm includes an LRU algorithm, Any of the LFU algorithm and the first-in first-out algorithm.
  • the screening unit is also used to:
  • the device also includes:
  • the weight control module is configured to reduce the weight of the cache block in which the stored data reaches the second preset weight in the cache block in which the stored data does not exist within the preset duration is reduced by one.
  • the device further includes:
  • a capacity detecting module configured to determine whether the storage space of the cache group is smaller than the data volume of the main storage block, and if the storage space of the cache group is smaller than the data volume of the main storage block, triggering the replacement
  • the block determining module determines, according to the weight of each of the cache blocks in the cache group, a replacement cache block;
  • the data replacement module is also used to:
  • the storage data of the main storage block is stored in the cache block that is free of the cache group.
  • the main memory block determining module is specifically configured to:
  • the receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
  • a third aspect of the present invention further provides a terminal device, where the terminal device includes a processor and a memory, wherein the memory further stores a set of programs, and the processor is configured to invoke a program stored in the memory, so that The terminal device performs the method of any of the first aspects.
  • a fourth aspect of the present invention provides a computer storage medium storing a program, the program comprising the method of any of the first aspect.
  • Each cache group includes at least two cache blocks, and each of the cache blocks is correspondingly provided with a weight, and since the weight is determined according to an access rate and an access delay of the main memory to which the stored data of the cache block belongs, Determining the replacement cache block according to the weight of each of the cache blocks in the determined cache group can reduce the number of times the storage data of the high MISS delay is replaced by the cache, thereby improving the performance of the storage system.
  • Figure 1 shows a schematic diagram of a group associative image
  • FIG. 2 is a flowchart of a method for replacing data stored in a cache according to an embodiment of the present invention
  • FIG. 3 is a schematic diagram showing access rates and access delays of multi-level data
  • FIG. 4 is a flowchart of another method for replacing data stored in a cache according to an embodiment of the present invention.
  • FIG. 5 is a schematic diagram of a device for replacing data stored in a cache according to an embodiment of the present invention.
  • FIG. 6 is a schematic structural diagram of a replacement block determining module according to an embodiment of the present disclosure.
  • FIG. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
  • Address map refers to the pair between the address of a certain data in the main memory and the address in the cache. Should be related.
  • the commonly used address image is a group associative image, wherein the group associative image mode can be divided into several regions of the same size as shown in FIG. 1 , and each region is divided into blocks according to a direct image manner, and Number, therefore, there are multiple cache blocks with the same number in the cache.
  • the main memory is paged according to the size of the area, and each page is divided according to the size of the cache block, and each main memory block can correspond to the cache block of the same block number in different areas.
  • the 0th block of the 0th page of the main memory can correspond to the 0th block of the 0th area of the cache, or the 0th block of the Jth area.
  • the cache corresponding to the main memory block.
  • the block is divided into groups, such as the 0th block of the 0th to the jth regions corresponding to the 0th block of the 0th to the mth pages of the main memory block, and the 0th block of the 0th to the jth areas is divided into
  • a cache group that is, the 0th block of the main memory block to the 0th block of the mth page can be stored in any cache block in the cache group.
  • the number of the cache group can be determined according to the number of the main memory block. For example, it is determined that the cache group consisting of the 0th block of the 0th to the jth zones is the 0th group;
  • the performance of the storage system is usually evaluated by (HIT times * HIT delay + MISS times * MISS delay). For a storage system with only one main memory, if the cache hit rate is increased, the performance of the storage system will be improved accordingly. However, for a storage system with multiple main memories, the storage system includes PL2 (Private L2), SL2 (Shared L2), SL3 (Shared L3), and DDR (Double) due to different access delays of the CPU accessing each main memory. Data Rate, double rate synchronous dynamic random access memory, for example, DDR has the longest access latency and PL2 has the shortest access latency. If it is missed, the MISS delay of CPU access DDR is much larger than the MISS latency of accessing PL2.
  • the embodiment of the present invention improves the performance of the storage system by reducing the number of times the storage data of the high MISS delay is replaced by the cache, which is respectively introduced by the following embodiments.
  • FIG. 2 is a flowchart of a method for replacing data stored in a cache according to an embodiment of the present invention. As shown in FIG. 2, the method may include:
  • Step S201 determining a main memory block to be stored in the main memory.
  • the receiving CPU sends an access request to the storage system, the access request carries an access address, and queries whether the storage data corresponding to the access address is stored in the cache of the storage system, and if the cache does not store the access address corresponding to the access address The data is stored, that is, the cache misses, the CPU queries the main memory, and if the main memory hits, the main memory block hit in the main memory is used as the to-be-stored Main memory block
  • the main memory it is also possible to detect whether the number of hits of the hit main block in the preset duration reaches a preset number threshold, and if so, the main memory block is used as the main memory block to be stored. It should be noted that the preset number of thresholds can be adjusted according to actual needs.
  • Step S202 determining a cache group corresponding to the main storage block, the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is according to the storage data of the cache block.
  • the access rate and access latency of the main memory are determined.
  • the cache group corresponding to the main memory block may be determined.
  • the corresponding cache group may be determined according to the number of the main memory block, as shown in FIG. If the main memory block to be stored is the 0th block of the first page, it can be determined that the corresponding cache group is the 0th group, and the 0th block included in the 0th group is the 0th block of the 0th to the jth.
  • Each cache block in the cache group is correspondingly provided with a weight, and the weight is determined according to an access rate and an access delay of the main memory to which the storage data of the cache block belongs.
  • each main memory is correspondingly provided with a weight.
  • the weight may be an empirical value, and the experience value is determined by referring to an access delay and an access rate of the main memory, and the access delay is longer. And the lower the access rate, the higher the weight.
  • the storage system takes four main memories including PL2, SL2, SL3, and DDR as an example. As shown in Figure 3, the DDR has the lowest access rate and the longest access delay, the highest weight, the highest access rate of PL2, and the access delay. The shortest, the lowest weight, SL2 and SL3 are between the two;
  • the weight of DDR is 3, the weight of SL3 is 2, the weight of SL2 is 1, and the weight of PL2 is 0.
  • the main memory block of DDR is stored in the cache as the main memory block to be stored.
  • the weight of the block is 3; the main memory block of SL3 is stored in the cache as the main memory block to be stored, and the weight of the corresponding cache block is 2; the main memory block of SL2 is stored as the main memory block to be stored.
  • the weight of the corresponding cache block is 1; the main memory block of PL2 is stored in the cache as the main memory block to be stored, and the weight of the corresponding cache block is 0.
  • Step S203 determining a replacement cache block according to weights of each of the cache blocks in the cache group.
  • block pointer information may be obtained, where the block pointer information is used to indicate a preliminary replacement cache block; the preliminary replacement cache block is searched according to the block pointer information, and the preparation is determined. Whether the weight of the replacement cache block is less than the first preset weight; if so, the A prepared replacement cache block is used as the replacement cache block.
  • each cache group can be encoded in binary, as shown in Figure 1.
  • j is equal to 3
  • each cache group includes 4 cache blocks, taking the cache 0 group as an example, and the 0th of the 0th region.
  • the block, the 0th block of the 1st block, the 0th block of the 2nd block, and the 0th block of the 3rd block respectively have a binary code of 00, 01, 10, and 11, and the block pointer information can also be represented by a binary.
  • the block pointer information may be acquired. If the block pointer information is 00, the preliminary replacement cache block is found as the 0th block of the 0th area according to the block pointer information.
  • the weight of the 0th block of the 0th area is smaller than the first preset weight, assuming that the first preset weight is 2, and the data stored in the 0th block of the 0th area is the stored data in the SL2, that is, the right If the value is 1, it can be determined that the weight of the 0th block of the 0th area is smaller than the first preset weight, and the 0th block of the 0th area is used as the replacement cache block.
  • the weight of the prepared replacement cache block reaches the first preset weight, it is assumed that the first preset weight is still 2, and the data stored in the 0th block of the 0th area is stored in the DDR.
  • Data that is, a weight of 3
  • the flipping the block pointer information may be binary Add one, if the block pointer information before flipping is 00, the flipped block pointer information is 01;
  • the access delay of the stored data of the prepared replacement cache block is large, and if the storage data is directly replaced by the cache, When the CPU accesses the stored data, the MISS delay is large, which reduces the performance of the storage system. Therefore, the process directly returns to step S203, and the replacement cache is determined according to the inverted block pointer information, and the spare replacement cache block is prepared. The weight of the weight is reduced by one.
  • the cache block in the cache group whose weight is less than the second preset weight may be determined, and the cache with the weight less than the second preset weight according to the preset replacement algorithm
  • the replacement cache block is determined in the block, wherein the preset replacement algorithm includes any one of an LRU algorithm, an LFU algorithm, and a first in first out algorithm.
  • the replacement cache block in the cache block whose weight is less than the second preset weight according to the preset replacement algorithm it may further determine that the weight in the cache group reaches the location a cache block of the second preset weight, the cache value reaching the cache of the second preset weight
  • the weight of the cache block in the block where the stored data does not exist within the preset duration is decremented by one. As shown in FIG.
  • each cache group includes 4 cache blocks
  • the determined cache group is the 0th group
  • the 0th block of the 0th area has a weight of 3
  • the first area is The weight of the 0th block is 2
  • the weight of the 0th block of the 2nd zone is 2
  • the weight of the 0th block of the 3rd zone is 1
  • the second preset weight is 2, in accordance with the preset replacement algorithm.
  • the weight of the 0th block of the 0th area is reduced to 2
  • the weight of the 0th block of the 1st zone is reduced to 1
  • the weight of the 0th block of the 2nd zone is reduced to 1.
  • step S203 is performed; otherwise, if the storage space of the cache is sufficient to store the storage data of the main storage block, the storage data of the main storage block is directly stored in the cache group. In the cache block.
  • Step S204 replacing the determined storage data of the replacement cache block with the storage data of the main storage block.
  • the replacement cache block is determined according to the weight of each cache block in the cache group, and the weight of each cache block is based on the owner of the cache block.
  • the memory access rate and access delay are determined. The lower the access rate and the longer the access delay, the larger the weight. The larger the weight, the longer the stored data stays in the cache, and the higher the MISS delay. The number of times the stored data is replaced by the cache, which in turn improves the performance of the storage system.
  • FIG. 4 is a flowchart of another method for replacing data stored in a cache according to an embodiment of the present invention.
  • the method as shown in FIG. 4 may include:
  • Step S401 determining a main memory block to be stored in the main memory.
  • the receiving CPU sends an access request to the storage system, the access request carries an access address, and queries whether the storage data corresponding to the access address is stored in the cache of the storage system, and if the cache does not store the access address corresponding to the access address The data is stored, that is, the cache misses, the CPU queries the main memory, and if the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored;
  • the main memory it is also possible to detect that the main memory block hit is within a preset duration Whether the number of hits reaches a preset number of thresholds, and if so, the main memory block is used as the main memory block to be stored. It should be noted that the preset number of thresholds can be adjusted according to actual needs.
  • Step S402 determining a cache group corresponding to the main storage block, the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is according to the storage data of the cache block.
  • the access rate and access latency of the main memory are determined.
  • the cache group corresponding to the main memory block may be determined.
  • the corresponding cache group may be determined according to the number of the main memory block, as shown in FIG. If the main memory block to be stored is the 0th block of the first page, it can be determined that the corresponding cache group is the 0th group, and the 0th block included in the 0th group is the 0th block of the 0th to the jth.
  • Each cache block in the cache group is correspondingly provided with a weight, and the weight is determined according to an access rate and an access delay of the main memory to which the storage data of the cache block belongs.
  • each main memory is correspondingly provided with a weight.
  • the weight may be an empirical value, and the experience value is determined by referring to an access delay and an access rate of the main memory, and the access delay is longer. And the lower the access rate, the higher the weight.
  • the storage system uses four main memories including PL2, SL2, SL3 and DDR as examples. DDR has the longest access delay and the lowest access rate, and has the highest weight. PL2 has the shortest access delay and the highest access rate, and its weight is the lowest. , SL2 and SL3 are somewhere in between;
  • the weight of DDR is 3, the weight of SL3 is 2, the weight of SL2 is 1, and the weight of PL2 is 0.
  • the main memory block of DDR is stored in the cache as the main memory block to be stored.
  • the weight of the block is 3; the main memory block of SL3 is stored in the cache as the main memory block to be stored, and the weight of the corresponding cache block is 2; the main memory block of SL2 is stored as the main memory block to be stored.
  • the weight of the corresponding cache block is 1; the main memory block of PL2 is stored in the cache as the main memory block to be stored, and the weight of the corresponding cache block is 0.
  • Step S403 acquiring block pointer information, where the block pointer information is used to indicate a preliminary replacement cache block.
  • each cache group can be encoded in binary, as shown in Figure 1.
  • j is equal to 3
  • each cache group includes 4 cache blocks, taking the cache 0 group as an example, and the 0th of the 0th region.
  • the block, the 0th block of the 1st block, the 0th block of the 2nd block, and the 0th block of the 3rd block respectively have a binary code of 00, 01, 10, and 11, and the block pointer information can also be represented by a binary.
  • the block pointer information may be acquired.
  • Step S404 searching for the prepared replacement cache block according to the block pointer information.
  • step S405 it is determined whether the weight of the preliminary replacement cache block is smaller than the first preset weight; if the determination result is no, step S406 is performed; otherwise, step S407 is performed.
  • Step S406 the block pointer information is inverted, and the weight of the prepared replacement cache block is decremented by one, and the process returns to step S403.
  • the block pointer information acquired when the step S403 is executed is returned as the inverted block pointer information.
  • Step S407 the prepared replacement cache block is used as a replacement cache block.
  • Step S408 replacing the determined storage data of the replacement cache block with the storage data of the main storage block.
  • each cache group includes at least two cache blocks, and each of the cache blocks is correspondingly provided with a weight, and the weight is accessed according to a main memory to which the stored data of the cache block belongs.
  • Rate and access delay determining, after determining the cache group corresponding to the main memory block, searching for the reserved replacement cache block in the determined cache group according to the block pointer information, if the weight of the prepared replacement cache block reaches the first a preset weight, indicating that the access delay of the stored data of the prepared replacement cache block is large, and the storage data of the prepared replacement cache block is not replaced by the cache, and the storage with a larger MISS delay is added.
  • the time that the data stays in the cache reduces the number of times the stored data of the high MISS delay is replaced by the cache, thereby improving the performance of the storage system.
  • FIG. 5 is a schematic diagram of a device for replacing data stored in a cache according to an embodiment of the present invention.
  • the device for replacing data stored in the embodiment of the present invention may be applied to a base station baseband system or an embedded computer system.
  • the replacement device 5 for storing data as shown in FIG. 5 may at least include a main memory block determining module 51, a group determining module 52, a replacement block determining module 53, and a data replacing module 54, wherein:
  • a main memory block determining module 51 configured to determine a main memory block to be stored in the main memory
  • the main memory block determining module 51 is specifically configured to:
  • the receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
  • the group determining module 52 is configured to determine a cache group corresponding to the main memory block, where the cache group includes at least two cache blocks, and each of the cache blocks is correspondingly provided with a weight, and the weight is according to the cache The access rate and access latency of the main memory to which the block's stored data belongs are determined.
  • the replacement block determining module 53 is configured to determine a replacement cache block according to weights of each of the cache blocks in the cache group.
  • the data replacement module 54 is configured to replace the determined storage data of the replacement cache block with the storage data of the primary storage block.
  • the replacement block determining module 53 may include at least a pointer information acquiring unit 531, a searching unit 532, a determining unit 533, and a first replacement block determining unit 534, as shown in FIG. 6, wherein:
  • a pointer information obtaining unit 531 configured to acquire block pointer information, where the block pointer information is used to indicate a preliminary replacement cache block;
  • the searching unit 532 is configured to search for the prepared replacement cache block according to the block pointer information
  • the determining unit 533 is configured to determine whether the weight of the preliminary replacement cache block searched by the searching unit 532 is smaller than the first preset weight
  • the first replacement block determining unit 534 is configured to use the prepared replacement cache block as the replacement cache block if the weight of the preliminary replacement cache block is smaller than the first preset weight.
  • the storage device replacing device 5 may further include a weight control module 55 and a pointer information control module 56, wherein:
  • the weight control module 55 is configured to: if the weight of the prepared replacement cache block reaches the first preset weight, reduce the weight of the prepared replacement cache block by one;
  • the pointer information control module 56 is configured to: if the weight of the prepared replacement cache block reaches the first preset weight, flip the block pointer information, and trigger the replacement block determining module 53 to be according to the cache group The weight of each of the cache blocks in the determination determines a replacement cache block.
  • the replacement block determining module 53 may at least include: a filtering unit 535 and a second replacement block determining unit 536, as shown in FIG. 6, wherein:
  • the filtering unit 535 is configured to determine a cache block in the cache group that has a weight less than a second preset weight
  • a second replacement block determining unit 536 configured to determine, according to a preset replacement algorithm, the replacement cache block in a cache block whose weight is less than a second preset weight, where the preset replacement algorithm includes an LRU algorithm Any one of the LFU algorithm and the FIFO algorithm.
  • first replacement block determining unit 534 and the second replacement block determining unit 536 may be combined or may be independent of each other, which is not limited by the present invention.
  • screening unit 535 can also be used to:
  • the weight control module 55 is further configured to:
  • the weight of the cache block in which the stored data reaches the second preset weight in the cache block that does not exist for the preset duration is decremented by one.
  • the storage device replacing device 5 may further include a capacity detecting module 57, configured to determine whether the storage space of the cache group is smaller than the data amount of the main storage block, if the cache group is idle storage The space is smaller than the amount of data of the main memory block, and the replacement block determining module 53 is triggered to determine the replacement cache block according to the weight of each of the cache blocks in the cache group;
  • the data replacement module 54 is further configured to:
  • the storage data of the main storage block is stored in the cache block that is free of the cache group.
  • FIG. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
  • the storage system of the terminal device is provided with a cache and at least two main memories.
  • the terminal device 7 may include at least one processor 71, such as a CPU, at least one communication bus 72, and a memory 73.
  • the communication bus 72 is used to implement connection communication between these components.
  • the memory 73 may be a high speed RAM memory or a non-volatile memory such as at least one disk memory. Alternatively, the memory 73 may also be at least one storage device located away from the aforementioned processor 71.
  • a set of program codes is stored in the memory 73, and the processor 71 is configured to call the program code stored in the memory 73 for performing the following operations:
  • Determining a cache group corresponding to the main storage block where the cache group includes at least two cache blocks, each of the cache blocks is correspondingly provided with a weight, and the weight is according to the storage data of the cache block.
  • the access rate and access latency of the main memory are determined;
  • the determined storage data of the replacement cache block is replaced with the storage data of the main storage block.
  • the determining, by the processor 71, the replacement cache block according to the weight of each of the cache blocks in the cache group may be:
  • block pointer information the block pointer information being used to indicate a preliminary replacement cache block
  • the prepared replacement cache block is used as the replacement cache block.
  • the processor 71 may further perform the following operations:
  • the determining, by the processor 71, the replacement cache block according to the weight of each of the cache blocks in the cache group may be:
  • the preset replacement algorithm Determining, by the preset replacement algorithm, the replacement cache block in the cache block whose weight is less than the second preset weight, wherein the preset replacement algorithm includes an LRU algorithm, an LFU algorithm, and a first in first out algorithm An algorithm.
  • the processor may further perform the following operations:
  • the weight of the cache block in which the stored data reaches the second preset weight in the cache block that does not exist for the preset duration is decremented by one.
  • processor 71 determines the cache group corresponding to the main memory block, the following operations may also be performed:
  • the stored data of the main memory block is stored in the cache block in which the cache group is free.
  • the processor 71 determines that the main memory block to be stored in the main memory may be:
  • the receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
  • the embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium stores a program, and the program includes some or all of the steps in the method described in connection with FIG. 1 or FIG. 4 in the embodiment of the present invention.
  • the storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

Abstract

A method of replacing stored data in a cache and a device utilizing the same are provided, wherein the cache is configured to store data in a plurality of main memories, and the cache has different access latencies of accessing each of the plurality of main memories. The method comprises: determining a main memory block containing data to be cached (S201); determining a cache set corresponding to the main memory block and comprising two or more cache blocks, wherein each of the cache blocks is provided with a weight determined according to an access rate and an access latency of main memory that contains cached data in each of the cache block (S202); determining, according to the weight of each of the cache block in the cache set, a replacement cache block (S203); and replacing the cached data in the determined replacement cache block with the data to be cached in the main memory (S204). The method and device can reduce a number of times of replacing cached data having a high cache miss latency, thereby enhancing performance of a data storage system.

Description

一种高速缓冲存储器中存储数据的替换方法和替换装置Replacement method and replacement device for storing data in cache memory 技术领域Technical field
本发明实施例涉及计算机技术领域,尤其涉及一种高速缓冲存储器中存储数据的替换方法和替换装置。Embodiments of the present invention relate to the field of computer technologies, and in particular, to a replacement method and a replacement device for storing data in a cache memory.
背景技术Background technique
高速缓冲存储器(cache)最早是由Wilkes于1951年为了弥补处理器CPU和主存储器之间的速度差异而提出的,是存储系统中最重要的部分。由于cache容量越大其价格越高、实现难度越高,因此,cache的容量一般比主存储器小很多,那么必然有些数据不存储在cache中,当访问这部分数据时,会发生未命中(cache miss),反之称为命中(cache hit)。Cache的性能和cache命中率紧密相连,cache命中率越高,存储访问需要的时间越少,cache的性能越高;反之,cache性能就越低。The cache was first proposed by Wilkes in 1951 to compensate for the speed difference between the processor CPU and main memory, and is the most important part of the storage system. As the cache capacity is higher, the price is higher and the difficulty is higher. Therefore, the cache capacity is generally much smaller than the main memory, so some data is not stored in the cache. When accessing this part of the data, a miss occurs (cache). Miss), otherwise known as a hit (cache hit). The performance of the Cache is closely related to the cache hit rate. The higher the cache hit rate, the less time the storage access takes, and the higher the performance of the cache. Conversely, the lower the cache performance.
替换算法的选择对cache的命中率的影响较大。目前通常使用的替换算法为LRU(Least recently used,最近最少使用)算法和LFU(Lease Frequently Used)算法。其中,LRU是依据各块使用的情况,总是选择最近最少使用的块被替换;LFU算法是将访问次数最少的内容替换出cache。The choice of the replacement algorithm has a greater impact on the hit rate of the cache. The replacement algorithms currently commonly used are the LRU (Least recently used) algorithm and the LFU (Lease Frequently Used) algorithm. Among them, the LRU is based on the use of each block, always selecting the least recently used block to be replaced; the LFU algorithm is to replace the content with the least number of accesses out of the cache.
Cache的性能直接影响着存储系统的性能,而存储系统的系统决定了通信的效率。采用现有技术中的替换算法,存储系统的性能并不能得到有效提高。The performance of the Cache directly affects the performance of the storage system, and the system of the storage system determines the efficiency of the communication. With the replacement algorithm in the prior art, the performance of the storage system cannot be effectively improved.
发明内容Summary of the invention
本发明实施例提供一种高速缓冲存储器中存储数据的替换方法和替换装置,可以提高存储系统的性能。Embodiments of the present invention provide a replacement method and a replacement device for storing data in a cache memory, which can improve the performance of the storage system.
本发明第一方面提供了一种cache中存储数据的替换方法,包括:A first aspect of the present invention provides a method for replacing data stored in a cache, including:
确定主存储器中待存储的主存块;Determining a main memory block to be stored in the main memory;
确定所述主存块对应的cache组,所述cache组包括至少两个cache块,每个所述cache块对应设有权值,所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定; Determining a cache group corresponding to the main storage block, where the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is according to a main memory of the storage data of the cache block. Access rate and access latency are determined;
根据所述cache组中各个所述cache块的权值确定替换cache块;Determining a replacement cache block according to weights of each of the cache blocks in the cache group;
将确定的所述替换cache块的存储数据替换成所述主存块的存储数据。The determined storage data of the replacement cache block is replaced with the storage data of the main storage block.
在第一方面的第一种可能的实现方式中,所述根据所述cache组中各个所述cache块的权值确定替换cache块包括:In a first possible implementation manner of the first aspect, the determining, by the weight of each of the cache blocks in the cache group, the replacement cache block includes:
获取块指针信息,所述块指针信息用于指示预备的替换cache块;Obtaining block pointer information, the block pointer information being used to indicate a preliminary replacement cache block;
根据所述块指针信息查找所述预备的替换cache块,并判断所述预备的替换cache块的权值是否小于第一预设权值;And searching for the prepared replacement cache block according to the block pointer information, and determining whether a weight of the prepared replacement cache block is smaller than a first preset weight;
若是,将所述预备的替换cache块作为所述替换cache块。If so, the prepared replacement cache block is used as the replacement cache block.
结合第一方面的第一种可能的实现方式,在第二种可能的实现方式中,若所述预备的替换cache块的权值达到所述第一预设权值,所述方法还包括:With the first possible implementation of the first aspect, in a second possible implementation, if the weight of the preliminary replacement cache block reaches the first preset weight, the method further includes:
翻转所述块指针信息,并将所述预备的替换cache块的权值减一;Flipping the block pointer information and decrementing the weight of the prepared replacement cache block by one;
返回执行所述根据所述cache组中各个所述cache块的权值确定替换cache块的步骤。Returning to the step of performing the determining to replace the cache block according to the weight of each of the cache blocks in the cache group.
在第一方面的第三种可能的实现方式中,所述根据所述cache组中各个所述cache块的权值确定替换cache块包括:In a third possible implementation manner of the foregoing aspect, the determining, by the weight of each of the cache blocks in the cache group, the replacement cache block includes:
确定所述cache组中权值小于第二预设权值的cache块;Determining, in the cache group, a cache block whose weight is less than a second preset weight;
根据预设替换算法在所述权值小于第二预设权值的cache块中确定出所述替换cache块,其中,所述预设替换算法包括LRU算法、LFU算法和先进先出算法中任一种算法。Determining, by the preset replacement algorithm, the replacement cache block in the cache block whose weight is less than the second preset weight, wherein the preset replacement algorithm includes an LRU algorithm, an LFU algorithm, and a first in first out algorithm An algorithm.
结合第一方面的第三种可能的实现方式,在第四种可能的实现方式中,所述根据所述cache组中各个所述cache块的权值确定替换cache块之后,所述方法还包括:With reference to the third possible implementation of the first aspect, in a fourth possible implementation, after the determining, by the weight of each of the cache blocks in the cache group, the replacement cache block, the method further includes :
确定所述cache组中权值达到所述第二预设权值的cache块;Determining, in the cache group, a cache block whose weight reaches the second preset weight;
将所述权值达到所述第二预设权值的cache块中存储数据在预设时长内不存在访问的cache块的权值减一。The weight of the cache block in which the stored data reaches the second preset weight in the cache block that does not exist for the preset duration is decremented by one.
结合第一方面或第一方面的第一种至第四种中任一种可能的实现方式中,在第五种可能的实现方式中,所述确定所述主存块对应的cache组之后,所述方法还包括:With reference to the first aspect, or any one of the first to the fourth possible implementation manners of the first aspect, in the fifth possible implementation manner, after determining the cache group corresponding to the main memory block, The method further includes:
判断所述cache组空闲的存储空间是否小于所述主存块的数据量; Determining whether the storage space of the cache group is smaller than the data volume of the main storage block;
若是,则执行所述根据所述cache组中各个所述cache块的权值确定替换cache块的步骤;If yes, performing the step of determining a replacement cache block according to weights of each of the cache blocks in the cache group;
否则,将所述主存块的存储数据存储于所述cache组空闲的cache块中。Otherwise, the stored data of the main memory block is stored in the cache block in which the cache group is free.
结合第一方面或第一方面的第一种至第五种中任一种可能的实现方式中,在第六种可能的实现方式中,所述确定主存储器中待存储的主存块包括:With reference to the first aspect, or any one of the first to the fifth possible implementation manners of the first aspect, in the sixth possible implementation, the determining that the main memory block to be stored in the main memory includes:
接收处理器针对存储系统发出的访问请求,若所述cache没命中,且主存储器命中,则将主存储器中命中的主存块作为所述待存储的主存块。The receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
本发明第二方面还提供了一种cache中存储数据的替换装置,包括:A second aspect of the present invention provides a device for storing data in a cache, including:
主存块确定模块,用于确定主存储器中待存储的主存块;a main memory block determining module, configured to determine a main memory block to be stored in the main memory;
组确定模块,用于确定所述主存块对应的cache组,所述cache组包括至少两个cache块,每个所述cache块对应设有权值,所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定;a group determining module, configured to determine a cache group corresponding to the main memory block, where the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is determined according to the cache block The access rate and access latency of the main memory to which the storage data belongs are determined;
替换块确定模块,用于根据所述cache组中各个所述cache块的权值确定替换cache块;a replacement block determining module, configured to determine, according to weights of each of the cache blocks in the cache group, a replacement cache block;
数据替换模块,用于将确定的所述替换cache块的存储数据替换成所述主存块的存储数据。And a data replacement module, configured to replace the determined storage data of the replacement cache block with the storage data of the primary storage block.
在第二方面的第一种可能的实现方式中,所述替换块确定模块包括:In a first possible implementation manner of the second aspect, the replacement block determining module includes:
指针信息获取单元,用于获取块指针信息,所述块指针信息用于指示预备的替换cache块;a pointer information obtaining unit, configured to acquire block pointer information, where the block pointer information is used to indicate a preliminary replacement cache block;
查找单元,用于根据所述块指针信息查找所述预备的替换cache块;a searching unit, configured to search for the prepared replacement cache block according to the block pointer information;
判断单元,用于判断所述查找单元查找到的所述预备的替换cache块的权值是否小于第一预设权值;a determining unit, configured to determine whether a weight of the prepared replacement cache block searched by the searching unit is smaller than a first preset weight;
第一替换块确定单元,用于若所述预备的替换cache块的权值小于所述第一预设权值,将所述预备的替换cache块作为所述替换cache块。And a first replacement block determining unit, configured to use the prepared replacement cache block as the replacement cache block if a weight of the preliminary replacement cache block is smaller than the first preset weight.
结合第二方面的第一种可能的实现方式,在第二种可能的实现方式中,所述装置还包括:In conjunction with the first possible implementation of the second aspect, in a second possible implementation, the apparatus further includes:
权值控制模块,用于若所述预备的替换cache块的权值达到所述第一预设权值,将所述预备的替换cache块的权值减一;a weight control module, configured to: if the weight of the prepared replacement cache block reaches the first preset weight, reduce the weight of the prepared replacement cache block by one;
指针信息控制模块,用于若所述预备的替换cache块的权值达到所述第一 预设权值,翻转所述块指针信息,并触发所述替换块确定模块根据所述cache组中各个所述cache块的权值确定替换cache块。a pointer information control module, configured to: if the weight of the prepared replacement cache block reaches the first Presetting the weight, flipping the block pointer information, and triggering the replacement block determining module to determine the replacement cache block according to the weight of each of the cache blocks in the cache group.
在第二方面的第三种可能的实现方式中,所述替换块确定模块包括:In a third possible implementation manner of the second aspect, the replacement block determining module includes:
筛选单元,用于确定所述cache组中权值小于第二预设权值的cache块;a filtering unit, configured to determine a cache block in the cache group that has a weight less than a second preset weight;
第二替换块确定单元,用于根据预设替换算法在所述权值小于第二预设权值的cache块中确定出所述替换cache块,其中,所述预设替换算法包括LRU算法、LFU算法和先进先出算法中任一种算法。a second replacement block determining unit, configured to determine the replacement cache block in a cache block whose weight is less than a second preset weight according to a preset replacement algorithm, where the preset replacement algorithm includes an LRU algorithm, Any of the LFU algorithm and the first-in first-out algorithm.
结合第二方面的第三种可能的实现方式,在第四种可能的实现方式中,In conjunction with the third possible implementation of the second aspect, in a fourth possible implementation,
所述筛选单元还用于:The screening unit is also used to:
确定所述cache组中权值达到所述第二预设权值的cache块;Determining, in the cache group, a cache block whose weight reaches the second preset weight;
所述装置还包括:The device also includes:
权值控制模块,用于将所述权值达到所述第二预设权值的cache块中存储数据在预设时长内不存在访问的cache块的权值减一。The weight control module is configured to reduce the weight of the cache block in which the stored data reaches the second preset weight in the cache block in which the stored data does not exist within the preset duration is reduced by one.
结合第二方面或第二方面的第一种至第四种中任一种可能的实现方式中,在第五种可能的实现方式中,所述装置还包括:In combination with the second aspect or the possible implementation of any one of the first to fourth aspects of the second aspect, in a fifth possible implementation, the device further includes:
容量检测模块,用于判断所述cache组空闲的存储空间是否小于所述主存块的数据量,若所述cache组空闲的存储空间小于所述主存块的数据量,则触发所述替换块确定模块根据所述cache组中各个所述cache块的权值确定替换cache块;a capacity detecting module, configured to determine whether the storage space of the cache group is smaller than the data volume of the main storage block, and if the storage space of the cache group is smaller than the data volume of the main storage block, triggering the replacement The block determining module determines, according to the weight of each of the cache blocks in the cache group, a replacement cache block;
所述数据替换模块还用于:The data replacement module is also used to:
若所述cache组空闲的存储空间达到所述主存块的数据量,将所述主存块的存储数据存储于所述cache组空闲的cache块中。If the free storage space of the cache group reaches the data amount of the main storage block, the storage data of the main storage block is stored in the cache block that is free of the cache group.
结合第二方面或第二方面的第一种至第五种中任一种可能的实现方式中,在第六种可能的实现方式中,所述主存块确定模块具体用于:With reference to the second aspect, or any one of the first to the fifth possible implementation manners of the second aspect, in the sixth possible implementation, the main memory block determining module is specifically configured to:
接收处理器针对存储系统发出的访问请求,若所述cache没命中,且主存储器命中,则将主存储器中命中的主存块作为所述待存储的主存块。The receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
本发明第三方面还提供了一种终端设备,所述终端设备包括处理器和存储器,其中,所述存储器中还存储一组程序,且处理器用于调用所述存储器中存储的程序,使得所述终端设备执行如第一方面的任一项所述的方法。 A third aspect of the present invention further provides a terminal device, where the terminal device includes a processor and a memory, wherein the memory further stores a set of programs, and the processor is configured to invoke a program stored in the memory, so that The terminal device performs the method of any of the first aspects.
本发明第四方面还提供了一种计算机存储介质,所述计算机存储介质存储有程序,所述程序执行时包括如第一方面的任一项所述的方法。A fourth aspect of the present invention provides a computer storage medium storing a program, the program comprising the method of any of the first aspect.
实施本发明实施例,具有以下有益效果:Embodiments of the present invention have the following beneficial effects:
每个cache组包括至少两个cache块,每个所述cache块对应设有权值,由于所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定,因此,根据确定的cache组中的各个所述cache块的权值确定出替换cache块,可以减少高MISS时延的存储数据被替换出cache的次数,进而,提高存储系统的性能。Each cache group includes at least two cache blocks, and each of the cache blocks is correspondingly provided with a weight, and since the weight is determined according to an access rate and an access delay of the main memory to which the stored data of the cache block belongs, Determining the replacement cache block according to the weight of each of the cache blocks in the determined cache group can reduce the number of times the storage data of the high MISS delay is replaced by the cache, thereby improving the performance of the storage system.
附图说明DRAWINGS
为了更清楚地说明本发明实施例,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the embodiments of the present invention, the drawings, which are used in the embodiments, will be briefly described below. It is obvious that the drawings in the following description are only some embodiments of the present invention. For the personnel, other drawings can be obtained based on these drawings without paying creative labor.
图1示出了组相联映像的示意图;Figure 1 shows a schematic diagram of a group associative image;
图2是本发明实施例提供的一种cache中存储数据的替换方法流程图;2 is a flowchart of a method for replacing data stored in a cache according to an embodiment of the present invention;
图3示出了多级数据的访问率和访问时延的示意图;FIG. 3 is a schematic diagram showing access rates and access delays of multi-level data;
图4是本发明实施例提供的另一种cache中存储数据的替换方法流程图;4 is a flowchart of another method for replacing data stored in a cache according to an embodiment of the present invention;
图5是本发明实施例提供的一种cache中存储数据的替换装置的示意图;FIG. 5 is a schematic diagram of a device for replacing data stored in a cache according to an embodiment of the present invention; FIG.
图6是本发明实施例提供的一种替换块确定模块的结构示意图;FIG. 6 is a schematic structural diagram of a replacement block determining module according to an embodiment of the present disclosure;
图7是本发明实施例提供的一种终端设备的结构示意图。FIG. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention.
具体实施方式detailed description
下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有作出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, but not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
在此部分,首先对本发明中各个实施例均涉及的一些基本概念进行说明。In this section, some basic concepts involved in various embodiments of the present invention are first described.
地址映像是指某一数据在主存储器中的地址与在cache中的地址之间的对 应关系。目前比较常用的地址映像为组相联映像,其中,组相联映像方式可以如图1所示,先将cache分成大小相同的若干区,对每个区按照直接映像的方式进行分块,并且编号,因此,cache中有多个编号相同的cache块。对主存储器按照区的大小进行分页,每页再按照cache块的大小进行分块,每个主存块可以对应不同区中的相同块号的cache块。如图1所示,主存储器第0页的第0块,可以对应cache的第0区的第0块,也可以对应第J区的第0块,为了方便描述,将主存块对应的cache块划分为组,如主存块的第0页~第m页的第0块对应的第0区~第j区的第0块,则将第0区~第j区的第0块划分为一个cache组,即主存块的第0页~第m页的第0块可以存储于该cache组内的任一cache块,为了便于查询,可以根据主存块的编号确定cache组的编号,如确定第0区~第j区的第0块组成的cache组为第0组;Address map refers to the pair between the address of a certain data in the main memory and the address in the cache. Should be related. At present, the commonly used address image is a group associative image, wherein the group associative image mode can be divided into several regions of the same size as shown in FIG. 1 , and each region is divided into blocks according to a direct image manner, and Number, therefore, there are multiple cache blocks with the same number in the cache. The main memory is paged according to the size of the area, and each page is divided according to the size of the cache block, and each main memory block can correspond to the cache block of the same block number in different areas. As shown in Figure 1, the 0th block of the 0th page of the main memory can correspond to the 0th block of the 0th area of the cache, or the 0th block of the Jth area. For convenience of description, the cache corresponding to the main memory block. The block is divided into groups, such as the 0th block of the 0th to the jth regions corresponding to the 0th block of the 0th to the mth pages of the main memory block, and the 0th block of the 0th to the jth areas is divided into A cache group, that is, the 0th block of the main memory block to the 0th block of the mth page can be stored in any cache block in the cache group. For the convenience of query, the number of the cache group can be determined according to the number of the main memory block. For example, it is determined that the cache group consisting of the 0th block of the 0th to the jth zones is the 0th group;
存储系统的性能通常通过(HIT次数*HIT时延+MISS次数*MISS时延)来进行评估,对于只存在一个主存储器的存储系统,如果cache命中率提高,存储系统的性能也相应会得到提高;但对于存在多个主存储器的存储系统,由于CPU访问每个主存储器的访问时延不同,存储系统以包括PL2(Private L2)、SL2(Shared L2)、SL3(Shared L3)、DDR(Double Data Rate,双倍速率同步动态随机存储器)为例,DDR的访问时延最长,PL2的访问时延最短,如果未命中,CPU访问DDR的MISS时延比访问PL2的MISS时延大很多,因此,对于存在多个主存储器的存储系统,不仅需要考虑cache的性能,还需要考虑MISS延时。本发明实施例通过减少高MISS时延的存储数据被替换出cache的次数,以提高存储系统的性能,分别通过以下实施例介绍。The performance of the storage system is usually evaluated by (HIT times * HIT delay + MISS times * MISS delay). For a storage system with only one main memory, if the cache hit rate is increased, the performance of the storage system will be improved accordingly. However, for a storage system with multiple main memories, the storage system includes PL2 (Private L2), SL2 (Shared L2), SL3 (Shared L3), and DDR (Double) due to different access delays of the CPU accessing each main memory. Data Rate, double rate synchronous dynamic random access memory, for example, DDR has the longest access latency and PL2 has the shortest access latency. If it is missed, the MISS delay of CPU access DDR is much larger than the MISS latency of accessing PL2. Therefore, for a storage system with multiple main memories, not only the performance of the cache but also the MISS delay needs to be considered. The embodiment of the present invention improves the performance of the storage system by reducing the number of times the storage data of the high MISS delay is replaced by the cache, which is respectively introduced by the following embodiments.
请参阅图2,图2是本发明实施例提供的一种cache中存储数据的替换方法流程图。如图2所示,所述方法可以包括:Referring to FIG. 2, FIG. 2 is a flowchart of a method for replacing data stored in a cache according to an embodiment of the present invention. As shown in FIG. 2, the method may include:
步骤S201,确定主存储器中待存储的主存块。Step S201, determining a main memory block to be stored in the main memory.
优选的,接收CPU针对存储系统发出的访问请求,所述访问请求携带访问地址,查询所述存储系统的cache中是否存储了该访问地址对应的存储数据,若cache中没存储该访问地址对应的存储数据,即cache没命中,CPU则查询主存储器,若主存储器命中,则将主存储器中命中的主存块作为所述待存储的 主存块;Preferably, the receiving CPU sends an access request to the storage system, the access request carries an access address, and queries whether the storage data corresponding to the access address is stored in the cache of the storage system, and if the cache does not store the access address corresponding to the access address The data is stored, that is, the cache misses, the CPU queries the main memory, and if the main memory hits, the main memory block hit in the main memory is used as the to-be-stored Main memory block
进一步的,若主存储器命中,还可以检测命中的该主存块在预设时长内的命中次数是否达到预设次数阈值,若是,才将该主存块作为所述待存储的主存块。应指出的是,所述预设次数阈值可以根据实际需求调整。Further, if the main memory hits, it is also possible to detect whether the number of hits of the hit main block in the preset duration reaches a preset number threshold, and if so, the main memory block is used as the main memory block to be stored. It should be noted that the preset number of thresholds can be adjusted according to actual needs.
步骤S202,确定所述主存块对应的cache组,所述cache组包括至少两个cache块,每个所述cache块对应设有权值,所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定。Step S202, determining a cache group corresponding to the main storage block, the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is according to the storage data of the cache block. The access rate and access latency of the main memory are determined.
当确定了待存储的主存块,则可以确定所述主存块对应的cache组,优选的,可以根据所述主存块的编号确定对应的cache组,如图1所示,若确定的待存储的主存块为第1页的第0块,则可以确定对应的cache组为第0组,其第0组包括的cache块为第0区~第j区的第0块。When the main memory block to be stored is determined, the cache group corresponding to the main memory block may be determined. Preferably, the corresponding cache group may be determined according to the number of the main memory block, as shown in FIG. If the main memory block to be stored is the 0th block of the first page, it can be determined that the corresponding cache group is the 0th group, and the 0th block included in the 0th group is the 0th block of the 0th to the jth.
其中,cache组中的每个cache块对应设有权值,所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定。具体的,每个主存储器都对应设有权值,优选的,所述权值可以是一个经验值,所述经验值是参考主存储器的访问时延和访问率确定的,访问时延越长及访问率越低,其权值越高。存储系统以包括PL2、SL2、SL3和DDR四个主存储器为例,如图3所示,DDR的访问率最低以及访问时延最长,其权值最高,PL2的访问率最高以及访问时延最短,其权值最低,SL2和SL3介于两者之间;Each cache block in the cache group is correspondingly provided with a weight, and the weight is determined according to an access rate and an access delay of the main memory to which the storage data of the cache block belongs. Specifically, each main memory is correspondingly provided with a weight. Preferably, the weight may be an empirical value, and the experience value is determined by referring to an access delay and an access rate of the main memory, and the access delay is longer. And the lower the access rate, the higher the weight. The storage system takes four main memories including PL2, SL2, SL3, and DDR as an example. As shown in Figure 3, the DDR has the lowest access rate and the longest access delay, the highest weight, the highest access rate of PL2, and the access delay. The shortest, the lowest weight, SL2 and SL3 are between the two;
假设,DDR的权值为3,SL3的权值为2,SL2的权值为1,PL2的权值为0,DDR的主存块作为待存储的主存块存储于cache中,其对应cache块的权值则为3;SL3的主存块作为待存储的主存块存储于cache中,其对应cache块的权值则为2;SL2的主存块作为待存储的主存块存储于cache中,其对应cache块的权值则为1;PL2的主存块作为待存储的主存块存储于cache中,其对应cache块的权值则为0。Assume that the weight of DDR is 3, the weight of SL3 is 2, the weight of SL2 is 1, and the weight of PL2 is 0. The main memory block of DDR is stored in the cache as the main memory block to be stored. The weight of the block is 3; the main memory block of SL3 is stored in the cache as the main memory block to be stored, and the weight of the corresponding cache block is 2; the main memory block of SL2 is stored as the main memory block to be stored. In the cache, the weight of the corresponding cache block is 1; the main memory block of PL2 is stored in the cache as the main memory block to be stored, and the weight of the corresponding cache block is 0.
步骤S203,根据所述cache组中各个所述cache块的权值确定替换cache块。Step S203, determining a replacement cache block according to weights of each of the cache blocks in the cache group.
在一种可选的实施方式中,可以获取块指针信息,所述块指针信息用于指示预备的替换cache块;根据所述块指针信息查找所述预备的替换cache块,并判断所述预备的替换cache块的权值是否小于第一预设权值;若是,将所述 预备的替换cache块作为所述替换cache块。In an optional implementation manner, block pointer information may be obtained, where the block pointer information is used to indicate a preliminary replacement cache block; the preliminary replacement cache block is searched according to the block pointer information, and the preparation is determined. Whether the weight of the replacement cache block is less than the first preset weight; if so, the A prepared replacement cache block is used as the replacement cache block.
每个组中的cache块可以通过二进制进行编码,如图1所示,假设,j等于3,即每个cache组包括4个cache块,以cache 0组为例,其第0区的第0块、第1区的第0块、第2区的第0块、第3区的第0块分别对应的二进制编码为00、01、10、11,所述块指针信息也可以用二进制表示,当确定了待存储的主存块时,可以获取所述块指针信息,假设所述块指针信息为00,则根据该块指针信息查找到预备的替换cache块为第0区的第0块,判断第0区的第0块的权值是否小于第一预设权值,假设,第一预设权值为2,第0区的第0块存储的数据为SL2中的存储数据,即权值为1,可以判定第0区的第0块的权值小于第一预设权值,则将所述第0区的第0块作为所述替换cache块。The cache blocks in each group can be encoded in binary, as shown in Figure 1. Assume that j is equal to 3, that is, each cache group includes 4 cache blocks, taking the cache 0 group as an example, and the 0th of the 0th region. The block, the 0th block of the 1st block, the 0th block of the 2nd block, and the 0th block of the 3rd block respectively have a binary code of 00, 01, 10, and 11, and the block pointer information can also be represented by a binary. When the main memory block to be stored is determined, the block pointer information may be acquired. If the block pointer information is 00, the preliminary replacement cache block is found as the 0th block of the 0th area according to the block pointer information. Determining whether the weight of the 0th block of the 0th area is smaller than the first preset weight, assuming that the first preset weight is 2, and the data stored in the 0th block of the 0th area is the stored data in the SL2, that is, the right If the value is 1, it can be determined that the weight of the 0th block of the 0th area is smaller than the first preset weight, and the 0th block of the 0th area is used as the replacement cache block.
若所述预备的替换cache块的权值达到所述第一预设权值,假设,所述第一预设权值仍为2,第0区的第0块存储的数据为DDR中的存储数据,即权值为3,可以判定第0区的第0块的权值达到所述第一预设权值,则翻转所述块指针信息;其中,翻转所述块指针信息可以是对二进制加一,如翻转前的块指针信息为00,则翻转后的块指针信息为01;If the weight of the prepared replacement cache block reaches the first preset weight, it is assumed that the first preset weight is still 2, and the data stored in the 0th block of the 0th area is stored in the DDR. Data, that is, a weight of 3, may determine that the weight of the 0th block of the 0th region reaches the first preset weight, and then flip the block pointer information; wherein, the flipping the block pointer information may be binary Add one, if the block pointer information before flipping is 00, the flipped block pointer information is 01;
若所述预备的替换cache块的权值达到所述第一预设权值,说明,所述预备的替换cache块的存储数据的访问时延较大,若直接将该存储数据替换出cache,则当CPU访问该存储数据时,MISS时延较大,降低了存储系统的性能,因此,直接返回步骤S203,重新根据翻转后的块指针信息确定替换cache,并且,对该预备的替换cache块的权值减一。If the weight of the prepared replacement cache block reaches the first preset weight, the access delay of the stored data of the prepared replacement cache block is large, and if the storage data is directly replaced by the cache, When the CPU accesses the stored data, the MISS delay is large, which reduces the performance of the storage system. Therefore, the process directly returns to step S203, and the replacement cache is determined according to the inverted block pointer information, and the spare replacement cache block is prepared. The weight of the weight is reduced by one.
在另一种可选的实施方式中,可以确定所述cache组中权值小于第二预设权值的cache块,根据预设替换算法在所述权值小于第二预设权值的cache块中确定出所述替换cache块,其中,所述预设替换算法包括LRU算法、LFU算法和先进先出算法中任一种算法。In another optional implementation manner, the cache block in the cache group whose weight is less than the second preset weight may be determined, and the cache with the weight less than the second preset weight according to the preset replacement algorithm The replacement cache block is determined in the block, wherein the preset replacement algorithm includes any one of an LRU algorithm, an LFU algorithm, and a first in first out algorithm.
需要说明的是,如何根据预设替换算法在权值小于第二预设权值的cache块中确定出所述替换cache块是本领域技术人员可理解的,在此不再赘述。It should be noted that how to determine the replacement cache block in the cache block whose weight is less than the second preset weight according to the preset replacement algorithm is understandable by those skilled in the art, and details are not described herein again.
进一步的,每次或者多次根据预设替换算法在所述权值小于第二预设权值的cache块中确定出所述替换cache块之后,还可以确定所述cache组中权值达到所述第二预设权值的cache块,将所述权值达到所述第二预设权值的cache 块中存储数据在预设时长内不存在访问的cache块的权值减一。如图1所示,假设,j等于3,即每个cache组包括4个cache块,确定的cache组为第0组,且第0区的第0块的权值为3,第1区的第0块的权值为2,第2区的第0块的权值为2,第3区的第0块的权值为1,第二预设权值为2,在根据预设替换算法在所述权值小于第二预设权值的cache块中确定出第3区的第0块为所述替换cache块之后,则将第0区的第0块的权值减为2,第1区的第0块的权值减为1,第2区的第0块的权值减为1。Further, after determining the replacement cache block in the cache block whose weight is less than the second preset weight according to the preset replacement algorithm, it may further determine that the weight in the cache group reaches the location a cache block of the second preset weight, the cache value reaching the cache of the second preset weight The weight of the cache block in the block where the stored data does not exist within the preset duration is decremented by one. As shown in FIG. 1, it is assumed that j is equal to 3, that is, each cache group includes 4 cache blocks, the determined cache group is the 0th group, and the 0th block of the 0th area has a weight of 3, and the first area is The weight of the 0th block is 2, the weight of the 0th block of the 2nd zone is 2, the weight of the 0th block of the 3rd zone is 1, and the second preset weight is 2, in accordance with the preset replacement algorithm. After determining that the 0th block of the third area is the replacement cache block in the cache block whose weight is less than the second preset weight, the weight of the 0th block of the 0th area is reduced to 2, The weight of the 0th block of the 1st zone is reduced to 1, and the weight of the 0th block of the 2nd zone is reduced to 1.
再进一步的,在确定所述主存块对应的cache组之后,还可以先判断所述cache组空闲的存储空间是否小于所述主存块的数据量,若是,说明cache空闲的存储空间不足以存储所述主存块的存储数据,则执行步骤S203;否则,说明cache空闲的存储空间足以存储所述主存块的存储数据,则直接将主存块的存储数据存储于所述cache组空闲的cache块中。Further, after determining the cache group corresponding to the main memory block, it may be further determined whether the storage space of the cache group is smaller than the data volume of the main storage block, and if so, indicating that the storage space of the cache is insufficient If the storage data of the main storage block is stored, step S203 is performed; otherwise, if the storage space of the cache is sufficient to store the storage data of the main storage block, the storage data of the main storage block is directly stored in the cache group. In the cache block.
步骤S204,将确定的所述替换cache块的存储数据替换成所述主存块的存储数据。Step S204, replacing the determined storage data of the replacement cache block with the storage data of the main storage block.
在图2所示的实施例中,在确定主存块对应的cache组后,根据该cache组中各个cache块的权值确定替换cache块,每个cache块的权值根据该cache块所属主存储器的访问率和访问时延确定,访问率越低以及访问时延越长,其权值越大,权值越大其存储数据在cache中停留的时间越长,则减少了高MISS时延的存储数据被替换出cache的次数,进而,提高了存储系统的性能。In the embodiment shown in FIG. 2, after determining the cache group corresponding to the main memory block, the replacement cache block is determined according to the weight of each cache block in the cache group, and the weight of each cache block is based on the owner of the cache block. The memory access rate and access delay are determined. The lower the access rate and the longer the access delay, the larger the weight. The larger the weight, the longer the stored data stays in the cache, and the higher the MISS delay. The number of times the stored data is replaced by the cache, which in turn improves the performance of the storage system.
请参阅图4,图4是本发明实施例提供的另一种cache中存储数据的替换方法流程图。如图4所示所述方法可以包括:Referring to FIG. 4, FIG. 4 is a flowchart of another method for replacing data stored in a cache according to an embodiment of the present invention. The method as shown in FIG. 4 may include:
步骤S401,确定主存储器中待存储的主存块。Step S401, determining a main memory block to be stored in the main memory.
优选的,接收CPU针对存储系统发出的访问请求,所述访问请求携带访问地址,查询所述存储系统的cache中是否存储了该访问地址对应的存储数据,若cache中没存储该访问地址对应的存储数据,即cache没命中,CPU则查询主存储器,若主存储器命中,则将主存储器中命中的主存块作为所述待存储的主存块;Preferably, the receiving CPU sends an access request to the storage system, the access request carries an access address, and queries whether the storage data corresponding to the access address is stored in the cache of the storage system, and if the cache does not store the access address corresponding to the access address The data is stored, that is, the cache misses, the CPU queries the main memory, and if the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored;
进一步的,若主存储器命中,还可以检测命中的该主存块在预设时长内的 命中次数是否达到预设次数阈值,若是,才将该主存块作为所述待存储的主存块。应指出的是,所述预设次数阈值可以根据实际需求调整。Further, if the main memory hits, it is also possible to detect that the main memory block hit is within a preset duration Whether the number of hits reaches a preset number of thresholds, and if so, the main memory block is used as the main memory block to be stored. It should be noted that the preset number of thresholds can be adjusted according to actual needs.
步骤S402,确定所述主存块对应的cache组,所述cache组包括至少两个cache块,每个所述cache块对应设有权值,所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定。Step S402, determining a cache group corresponding to the main storage block, the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is according to the storage data of the cache block. The access rate and access latency of the main memory are determined.
当确定了待存储的主存块,则可以确定所述主存块对应的cache组,优选的,可以根据所述主存块的编号确定对应的cache组,如图1所示,若确定的待存储的主存块为第1页的第0块,则可以确定对应的cache组为第0组,其第0组包括的cache块为第0区~第j区的第0块。When the main memory block to be stored is determined, the cache group corresponding to the main memory block may be determined. Preferably, the corresponding cache group may be determined according to the number of the main memory block, as shown in FIG. If the main memory block to be stored is the 0th block of the first page, it can be determined that the corresponding cache group is the 0th group, and the 0th block included in the 0th group is the 0th block of the 0th to the jth.
其中,cache组中的每个cache块对应设有权值,所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定。具体的,每个主存储器都对应设有权值,优选的,所述权值可以是一个经验值,所述经验值是参考主存储器的访问时延和访问率确定的,访问时延越长及访问率越低,其权值越高。存储系统以包括PL2、SL2、SL3和DDR四个主存储器为例,DDR的访问时延最长及访问率最低,其权值最高,PL2的访问时延最短及访问率最高,其权值最低,SL2和SL3介于两者之间;Each cache block in the cache group is correspondingly provided with a weight, and the weight is determined according to an access rate and an access delay of the main memory to which the storage data of the cache block belongs. Specifically, each main memory is correspondingly provided with a weight. Preferably, the weight may be an empirical value, and the experience value is determined by referring to an access delay and an access rate of the main memory, and the access delay is longer. And the lower the access rate, the higher the weight. The storage system uses four main memories including PL2, SL2, SL3 and DDR as examples. DDR has the longest access delay and the lowest access rate, and has the highest weight. PL2 has the shortest access delay and the highest access rate, and its weight is the lowest. , SL2 and SL3 are somewhere in between;
假设,DDR的权值为3,SL3的权值为2,SL2的权值为1,PL2的权值为0,DDR的主存块作为待存储的主存块存储于cache中,其对应cache块的权值则为3;SL3的主存块作为待存储的主存块存储于cache中,其对应cache块的权值则为2;SL2的主存块作为待存储的主存块存储于cache中,其对应cache块的权值则为1;PL2的主存块作为待存储的主存块存储于cache中,其对应cache块的权值则为0。Assume that the weight of DDR is 3, the weight of SL3 is 2, the weight of SL2 is 1, and the weight of PL2 is 0. The main memory block of DDR is stored in the cache as the main memory block to be stored. The weight of the block is 3; the main memory block of SL3 is stored in the cache as the main memory block to be stored, and the weight of the corresponding cache block is 2; the main memory block of SL2 is stored as the main memory block to be stored. In the cache, the weight of the corresponding cache block is 1; the main memory block of PL2 is stored in the cache as the main memory block to be stored, and the weight of the corresponding cache block is 0.
步骤S403,获取块指针信息,所述块指针信息用于指示预备的替换cache块。Step S403, acquiring block pointer information, where the block pointer information is used to indicate a preliminary replacement cache block.
每个组中的cache块可以通过二进制进行编码,如图1所示,假设,j等于3,即每个cache组包括4个cache块,以cache 0组为例,其第0区的第0块、第1区的第0块、第2区的第0块、第3区的第0块分别对应的二进制编码为00、01、10、11,所述块指针信息也可以用二进制表示,当确定了待存储的主存块时,可以获取所述块指针信息。 The cache blocks in each group can be encoded in binary, as shown in Figure 1. Assume that j is equal to 3, that is, each cache group includes 4 cache blocks, taking the cache 0 group as an example, and the 0th of the 0th region. The block, the 0th block of the 1st block, the 0th block of the 2nd block, and the 0th block of the 3rd block respectively have a binary code of 00, 01, 10, and 11, and the block pointer information can also be represented by a binary. When the main memory block to be stored is determined, the block pointer information may be acquired.
步骤S404,根据所述块指针信息查找所述预备的替换cache块。Step S404, searching for the prepared replacement cache block according to the block pointer information.
步骤S405,判断所述预备的替换cache块的权值是否小于第一预设权值;若判断结果为否,则执行步骤S406;否则,执行步骤S407。In step S405, it is determined whether the weight of the preliminary replacement cache block is smaller than the first preset weight; if the determination result is no, step S406 is performed; otherwise, step S407 is performed.
步骤S406,翻转所述块指针信息,并将所述预备的替换cache块的权值减一,返回执行步骤S403。其中,返回执行步骤S403时获取的块指针信息为翻转后的块指针信息。Step S406, the block pointer information is inverted, and the weight of the prepared replacement cache block is decremented by one, and the process returns to step S403. The block pointer information acquired when the step S403 is executed is returned as the inverted block pointer information.
步骤S407,将所述预备的替换cache块作为替换cache块。Step S407, the prepared replacement cache block is used as a replacement cache block.
步骤S408,将确定的所述替换cache块的存储数据替换成所述主存块的存储数据。Step S408, replacing the determined storage data of the replacement cache block with the storage data of the main storage block.
在图4所示的实施例中,每个cache组包括至少两个cache块,每个所述cache块对应设有权值,所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定,在确定主存块对应的cache组后,根据块指针信息在确定的所述cache组中查找预备的替换cache块,若所述预备的替换cache块的权值达到第一预设权值,说明所述预备的替换cache块的存储数据的访问时延较大,则不将所述预备的替换cache块的存储数据替换出cache,通过增加MISS时延较大的存储数据在cache中停留的时间,减少了高MISS时延的存储数据被替换出cache的次数,进而,提高了存储系统的性能。In the embodiment shown in FIG. 4, each cache group includes at least two cache blocks, and each of the cache blocks is correspondingly provided with a weight, and the weight is accessed according to a main memory to which the stored data of the cache block belongs. Rate and access delay determining, after determining the cache group corresponding to the main memory block, searching for the reserved replacement cache block in the determined cache group according to the block pointer information, if the weight of the prepared replacement cache block reaches the first a preset weight, indicating that the access delay of the stored data of the prepared replacement cache block is large, and the storage data of the prepared replacement cache block is not replaced by the cache, and the storage with a larger MISS delay is added. The time that the data stays in the cache reduces the number of times the stored data of the high MISS delay is replaced by the cache, thereby improving the performance of the storage system.
请参阅图5,图5是本发明实施例提供的一种cache中存储数据的替换装置的示意图;本发明实施例提供的存储数据的替换装置可以应用于基站基带系统或嵌入式计算机系统。如图5所示所述存储数据的替换装置5至少可以包括主存块确定模块51、组确定模块52、替换块确定模块53以及数据替换模块54,其中:Referring to FIG. 5, FIG. 5 is a schematic diagram of a device for replacing data stored in a cache according to an embodiment of the present invention. The device for replacing data stored in the embodiment of the present invention may be applied to a base station baseband system or an embedded computer system. The replacement device 5 for storing data as shown in FIG. 5 may at least include a main memory block determining module 51, a group determining module 52, a replacement block determining module 53, and a data replacing module 54, wherein:
主存块确定模块51,用于确定主存储器中待存储的主存块;a main memory block determining module 51, configured to determine a main memory block to be stored in the main memory;
可选的,所述主存块确定模块51具体可以用于:Optionally, the main memory block determining module 51 is specifically configured to:
接收处理器针对存储系统发出的访问请求,若所述cache没命中,且主存储器命中,则将主存储器中命中的主存块作为所述待存储的主存块。The receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
组确定模块52,用于确定所述主存块对应的cache组,所述cache组包括至少两个cache块,每个所述cache块对应设有权值,所述权值根据所述cache 块的存储数据所属主存储器的访问率和访问时延确定。The group determining module 52 is configured to determine a cache group corresponding to the main memory block, where the cache group includes at least two cache blocks, and each of the cache blocks is correspondingly provided with a weight, and the weight is according to the cache The access rate and access latency of the main memory to which the block's stored data belongs are determined.
替换块确定模块53,用于根据所述cache组中各个所述cache块的权值确定替换cache块。The replacement block determining module 53 is configured to determine a replacement cache block according to weights of each of the cache blocks in the cache group.
数据替换模块54,用于将确定的所述替换cache块的存储数据替换成所述主存块的存储数据。The data replacement module 54 is configured to replace the determined storage data of the replacement cache block with the storage data of the primary storage block.
在一种可选的实施方式中,所述替换块确定模块53如图6所示至少可以包括:指针信息获取单元531、查找单元532、判断单元533以及第一替换块确定单元534,其中:In an optional implementation manner, the replacement block determining module 53 may include at least a pointer information acquiring unit 531, a searching unit 532, a determining unit 533, and a first replacement block determining unit 534, as shown in FIG. 6, wherein:
指针信息获取单元531,用于获取块指针信息,所述块指针信息用于指示预备的替换cache块;a pointer information obtaining unit 531, configured to acquire block pointer information, where the block pointer information is used to indicate a preliminary replacement cache block;
查找单元532,用于根据所述块指针信息查找所述预备的替换cache块;The searching unit 532 is configured to search for the prepared replacement cache block according to the block pointer information;
判断单元533,用于判断所述查找单元532查找到的所述预备的替换cache块的权值是否小于第一预设权值;The determining unit 533 is configured to determine whether the weight of the preliminary replacement cache block searched by the searching unit 532 is smaller than the first preset weight;
第一替换块确定单元534,用于若所述预备的替换cache块的权值小于所述第一预设权值,将所述预备的替换cache块作为所述替换cache块。The first replacement block determining unit 534 is configured to use the prepared replacement cache block as the replacement cache block if the weight of the preliminary replacement cache block is smaller than the first preset weight.
进一步的,所述存储数据的替换装置5还可以包括权值控制模块55以及指针信息控制模块56,其中:Further, the storage device replacing device 5 may further include a weight control module 55 and a pointer information control module 56, wherein:
权值控制模块55,用于若所述预备的替换cache块的权值达到所述第一预设权值,将所述预备的替换cache块的权值减一;The weight control module 55 is configured to: if the weight of the prepared replacement cache block reaches the first preset weight, reduce the weight of the prepared replacement cache block by one;
指针信息控制模块56,用于若所述预备的替换cache块的权值达到所述第一预设权值,翻转所述块指针信息,并触发所述替换块确定模块53根据所述cache组中各个所述cache块的权值确定替换cache块。The pointer information control module 56 is configured to: if the weight of the prepared replacement cache block reaches the first preset weight, flip the block pointer information, and trigger the replacement block determining module 53 to be according to the cache group The weight of each of the cache blocks in the determination determines a replacement cache block.
在另一种可选的实施方式中,所述替换块确定模块53如图6所示至少可以包括:筛选单元535以及第二替换块确定单元536,其中:In another optional implementation manner, the replacement block determining module 53 may at least include: a filtering unit 535 and a second replacement block determining unit 536, as shown in FIG. 6, wherein:
筛选单元535,用于确定所述cache组中权值小于第二预设权值的cache块;The filtering unit 535 is configured to determine a cache block in the cache group that has a weight less than a second preset weight;
第二替换块确定单元536,用于根据预设替换算法在所述权值小于第二预设权值的cache块中确定出所述替换cache块,其中,所述预设替换算法包括LRU算法、LFU算法和先进先出算法中任一种算法。 a second replacement block determining unit 536, configured to determine, according to a preset replacement algorithm, the replacement cache block in a cache block whose weight is less than a second preset weight, where the preset replacement algorithm includes an LRU algorithm Any one of the LFU algorithm and the FIFO algorithm.
应指出的是,第一替换块确定单元534和第二替换块确定单元536可以合并,也可以是相互独立,本发明不做限定。It should be noted that the first replacement block determining unit 534 and the second replacement block determining unit 536 may be combined or may be independent of each other, which is not limited by the present invention.
进一步的,所述筛选单元535还可以用于:Further, the screening unit 535 can also be used to:
确定所述cache组中权值达到所述第二预设权值的cache块;Determining, in the cache group, a cache block whose weight reaches the second preset weight;
所述权值控制模块55还用于:The weight control module 55 is further configured to:
将所述权值达到所述第二预设权值的cache块中存储数据在预设时长内不存在访问的cache块的权值减一。The weight of the cache block in which the stored data reaches the second preset weight in the cache block that does not exist for the preset duration is decremented by one.
再进一步的,所述存储数据的替换装置5还可以包括容量检测模块57,用于判断所述cache组空闲的存储空间是否小于所述主存块的数据量,若所述cache组空闲的存储空间小于所述主存块的数据量,则触发所述替换块确定模块53根据所述cache组中各个所述cache块的权值确定替换cache块;Further, the storage device replacing device 5 may further include a capacity detecting module 57, configured to determine whether the storage space of the cache group is smaller than the data amount of the main storage block, if the cache group is idle storage The space is smaller than the amount of data of the main memory block, and the replacement block determining module 53 is triggered to determine the replacement cache block according to the weight of each of the cache blocks in the cache group;
所述数据替换模块54还用于:The data replacement module 54 is further configured to:
若所述cache组空闲的存储空间达到所述主存块的数据量,将所述主存块的存储数据存储于所述cache组空闲的cache块中。If the free storage space of the cache group reaches the data amount of the main storage block, the storage data of the main storage block is stored in the cache block that is free of the cache group.
可理解的是,本实施例的存储数据的替换装置5的各功能模块的功能可根据上述方法实施例中的方法具体实现,可以具体对应参考图1或图4方法实施例的相关描述,此处不再赘述。It can be understood that the functions of the function modules of the data storage device 5 of the present embodiment may be specifically implemented according to the method in the foregoing method embodiment, and may specifically correspond to the related description of the method embodiment of FIG. 1 or FIG. I won't go into details here.
请参阅图7,图7是本发明实施例提供的一种终端设备的结构示意图。所述终端设备的存储系统设有cache和至少两个主存储器。如图7所示,所述终端设备7可以包括:至少一个处理器71,例如CPU,至少一个通信总线72以及存储器73。其中,通信总线72用于实现这些组件之间的连接通信。存储器73可以是高速RAM存储器,也可以是非易失的存储器(non-volatile memory),例如至少一个磁盘存储器。可选的,存储器73还可以是至少一个位于远离前述处理器71的存储装置。存储器73中存储一组程序代码,且处理器71用于调用存储器73中存储的程序代码,用于执行以下操作:Referring to FIG. 7, FIG. 7 is a schematic structural diagram of a terminal device according to an embodiment of the present invention. The storage system of the terminal device is provided with a cache and at least two main memories. As shown in FIG. 7, the terminal device 7 may include at least one processor 71, such as a CPU, at least one communication bus 72, and a memory 73. Among them, the communication bus 72 is used to implement connection communication between these components. The memory 73 may be a high speed RAM memory or a non-volatile memory such as at least one disk memory. Alternatively, the memory 73 may also be at least one storage device located away from the aforementioned processor 71. A set of program codes is stored in the memory 73, and the processor 71 is configured to call the program code stored in the memory 73 for performing the following operations:
确定主存储器中待存储的主存块;Determining a main memory block to be stored in the main memory;
确定所述主存块对应的cache组,所述cache组包括至少两个cache块,每个所述cache块对应设有权值,所述权值根据所述cache块的存储数据所属 主存储器的访问率和访问时延确定;Determining a cache group corresponding to the main storage block, where the cache group includes at least two cache blocks, each of the cache blocks is correspondingly provided with a weight, and the weight is according to the storage data of the cache block. The access rate and access latency of the main memory are determined;
根据所述cache组中各个所述cache块的权值确定替换cache块;Determining a replacement cache block according to weights of each of the cache blocks in the cache group;
将确定的所述替换cache块的存储数据替换成所述主存块的存储数据。The determined storage data of the replacement cache block is replaced with the storage data of the main storage block.
在一种可选的实施方式中,所述处理器71根据所述cache组中各个所述cache块的权值确定替换cache块具体可以为:In an optional implementation manner, the determining, by the processor 71, the replacement cache block according to the weight of each of the cache blocks in the cache group may be:
获取块指针信息,所述块指针信息用于指示预备的替换cache块;Obtaining block pointer information, the block pointer information being used to indicate a preliminary replacement cache block;
根据所述块指针信息查找所述预备的替换cache块,并判断所述预备的替换cache块的权值是否小于第一预设权值;And searching for the prepared replacement cache block according to the block pointer information, and determining whether a weight of the prepared replacement cache block is smaller than a first preset weight;
若是,将所述预备的替换cache块作为所述替换cache块。If so, the prepared replacement cache block is used as the replacement cache block.
进一步的,若所述预备的替换cache块的权值达到所述第一预设权值,所述处理器71还可以执行以下操作:Further, if the weight of the preliminary replacement cache block reaches the first preset weight, the processor 71 may further perform the following operations:
翻转所述块指针信息,并将所述预备的替换cache块的权值减一;Flipping the block pointer information and decrementing the weight of the prepared replacement cache block by one;
返回执行所述根据所述cache组中各个所述cache块的权值确定替换cache块的步骤。Returning to the step of performing the determining to replace the cache block according to the weight of each of the cache blocks in the cache group.
在另一种可选的实施方式中,所述处理器71根据所述cache组中各个所述cache块的权值确定替换cache块具体可以为:In another optional implementation manner, the determining, by the processor 71, the replacement cache block according to the weight of each of the cache blocks in the cache group may be:
确定所述cache组中权值小于第二预设权值的cache块;Determining, in the cache group, a cache block whose weight is less than a second preset weight;
根据预设替换算法在所述权值小于第二预设权值的cache块中确定出所述替换cache块,其中,所述预设替换算法包括LRU算法、LFU算法和先进先出算法中任一种算法。Determining, by the preset replacement algorithm, the replacement cache block in the cache block whose weight is less than the second preset weight, wherein the preset replacement algorithm includes an LRU algorithm, an LFU algorithm, and a first in first out algorithm An algorithm.
进一步的,所述处理器根据所述cache组中各个所述cache块的权值确定替换cache块之后,还可以执行以下操作:Further, after the processor determines to replace the cache block according to the weight of each of the cache blocks in the cache group, the processor may further perform the following operations:
确定所述cache组中权值达到所述第二预设权值的cache块;Determining, in the cache group, a cache block whose weight reaches the second preset weight;
将所述权值达到所述第二预设权值的cache块中存储数据在预设时长内不存在访问的cache块的权值减一。The weight of the cache block in which the stored data reaches the second preset weight in the cache block that does not exist for the preset duration is decremented by one.
再进一步的,所述处理器71确定所述主存块对应的cache组之后,还可以执行以下操作:Further, after the processor 71 determines the cache group corresponding to the main memory block, the following operations may also be performed:
判断所述cache组空闲的存储空间是否小于所述主存块的数据量;Determining whether the storage space of the cache group is smaller than the data volume of the main storage block;
若是,则执行所述根据所述cache组中各个所述cache块的权值确定替换 cache块的步骤;If yes, performing the determining and replacing according to the weight of each of the cache blocks in the cache group The steps of the cache block;
否则,将所述主存块的存储数据存储于所述cache组空闲的cache块中。Otherwise, the stored data of the main memory block is stored in the cache block in which the cache group is free.
其中,所述处理器71确定主存储器中待存储的主存块具体可以为:The processor 71 determines that the main memory block to be stored in the main memory may be:
接收处理器针对存储系统发出的访问请求,若所述cache没命中,且主存储器命中,则将主存储器中命中的主存块作为所述待存储的主存块。The receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
可理解的是,本实施例的终端设备7的各功能模块的功能可根据上述方法实施例中的方法具体实现,可以具体对应参考图1或图4方法实施例的相关描述,此处不再赘述。It is to be understood that the functions of the functional modules of the terminal device 7 of the present embodiment may be specifically implemented according to the method in the foregoing method embodiment, and may be specifically related to the related description of the method embodiment of FIG. 1 or FIG. Narration.
本发明实施例还提出了一种计算机存储介质,所述计算机存储介质存储有程序,所述程序执行时包括本发明实施例结合图1或图4所描述的方法中的部分或全部的步骤。The embodiment of the present invention further provides a computer storage medium, wherein the computer storage medium stores a program, and the program includes some or all of the steps in the method described in connection with FIG. 1 or FIG. 4 in the embodiment of the present invention.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的程序可存储于一计算机可读取存储介质中,该程序在执行时,可包括如上述各方法的实施例的流程。其中,所述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)或随机存储记忆体(Random Access Memory,RAM)等。One of ordinary skill in the art can understand that all or part of the process of implementing the foregoing embodiments can be completed by a computer program to instruct related hardware, and the program can be stored in a computer readable storage medium. When executed, the flow of an embodiment of the methods as described above may be included. The storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).
以上所揭露的仅为本发明较佳实施例而已,当然不能以此来限定本发明之权利范围,因此依本发明权利要求所作的等同变化,仍属本发明所涵盖的范围。 The above is only the preferred embodiment of the present invention, and the scope of the present invention is not limited thereto, and thus equivalent changes made in the claims of the present invention are still within the scope of the present invention.

Claims (16)

  1. 一种高速缓冲存储器cache中存储数据的替换方法,其特征在于,所述方法包括:An alternative method for storing data in a cache cache, the method comprising:
    确定主存储器中待存储的主存块;Determining a main memory block to be stored in the main memory;
    确定所述主存块对应的cache组,所述cache组包括至少两个cache块,每个所述cache块对应设有权值,所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定;Determining a cache group corresponding to the main storage block, where the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is according to a main memory of the storage data of the cache block. Access rate and access latency are determined;
    根据所述cache组中各个所述cache块的权值确定替换cache块;Determining a replacement cache block according to weights of each of the cache blocks in the cache group;
    将确定的所述替换cache块的存储数据替换成所述主存块的存储数据。The determined storage data of the replacement cache block is replaced with the storage data of the main storage block.
  2. 如权利要求1所述的方法,其特征在于,所述根据所述cache组中各个所述cache块的权值确定替换cache块包括:The method of claim 1, wherein the determining the replacement cache block according to the weight of each of the cache blocks in the cache group comprises:
    获取块指针信息,所述块指针信息用于指示预备的替换cache块;Obtaining block pointer information, the block pointer information being used to indicate a preliminary replacement cache block;
    根据所述块指针信息查找所述预备的替换cache块,并判断所述预备的替换cache块的权值是否小于第一预设权值;And searching for the prepared replacement cache block according to the block pointer information, and determining whether a weight of the prepared replacement cache block is smaller than a first preset weight;
    若是,将所述预备的替换cache块作为所述替换cache块。If so, the prepared replacement cache block is used as the replacement cache block.
  3. 如权利要求2所述的方法,其特征在于,若所述预备的替换cache块的权值达到所述第一预设权值,所述方法还包括:The method of claim 2, wherein if the weight of the preliminary replacement cache block reaches the first predetermined weight, the method further comprises:
    翻转所述块指针信息,并将所述预备的替换cache块的权值减一;Flipping the block pointer information and decrementing the weight of the prepared replacement cache block by one;
    返回执行所述根据所述cache组中各个所述cache块的权值确定替换cache块的步骤。Returning to the step of performing the determining to replace the cache block according to the weight of each of the cache blocks in the cache group.
  4. 如权利要求1所述的方法,其特征在于,所述根据所述cache组中各个所述cache块的权值确定替换cache块包括:The method of claim 1, wherein the determining the replacement cache block according to the weight of each of the cache blocks in the cache group comprises:
    确定所述cache组中权值小于第二预设权值的cache块;Determining, in the cache group, a cache block whose weight is less than a second preset weight;
    根据预设替换算法在所述权值小于第二预设权值的cache块中确定出所述替换cache块,其中,所述预设替换算法包括LRU算法、LFU算法和先进先 出算法中任一种算法。Determining, by the preset replacement algorithm, the replacement cache block in the cache block whose weight is less than the second preset weight, where the preset replacement algorithm includes an LRU algorithm, an LFU algorithm, and an advanced first Any algorithm in the algorithm.
  5. 如权利要求4所述的方法,其特征在于,所述根据所述cache组中各个所述cache块的权值确定替换cache块之后,所述方法还包括:The method of claim 4, wherein after the determining the replacement cache block according to the weight of each of the cache blocks in the cache group, the method further comprises:
    确定所述cache组中权值达到所述第二预设权值的cache块;Determining, in the cache group, a cache block whose weight reaches the second preset weight;
    将所述权值达到所述第二预设权值的cache块中存储数据在预设时长内不存在访问的cache块的权值减一。The weight of the cache block in which the stored data reaches the second preset weight in the cache block that does not exist for the preset duration is decremented by one.
  6. 如权利要求1-5任一项所述的方法,其特征在于,所述确定所述主存块对应的cache组之后,所述方法还包括:The method according to any one of claims 1-5, wherein after the determining the cache group corresponding to the main memory block, the method further comprises:
    判断所述cache组空闲的存储空间是否小于所述主存块的数据量;Determining whether the storage space of the cache group is smaller than the data volume of the main storage block;
    若是,则执行所述根据所述cache组中各个所述cache块的权值确定替换cache块的步骤;If yes, performing the step of determining a replacement cache block according to weights of each of the cache blocks in the cache group;
    否则,将所述主存块的存储数据存储于所述cache组空闲的cache块中。Otherwise, the stored data of the main memory block is stored in the cache block in which the cache group is free.
  7. 如权利要求1-6任一项所述的方法,其特征在于,所述确定主存储器中待存储的主存块包括:The method according to any one of claims 1-6, wherein the determining the main memory block to be stored in the main memory comprises:
    接收处理器针对存储系统发出的访问请求,若所述cache没命中,且主存储器命中,则将主存储器中命中的主存块作为所述待存储的主存块。The receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
  8. 一种cache中存储数据的替换装置,其特征在于,所述装置包括:A device for storing data in a cache, characterized in that the device comprises:
    主存块确定模块,用于确定主存储器中待存储的主存块;a main memory block determining module, configured to determine a main memory block to be stored in the main memory;
    组确定模块,用于确定所述主存块对应的cache组,所述cache组包括至少两个cache块,每个所述cache块对应设有权值,所述权值根据所述cache块的存储数据所属主存储器的访问率和访问时延确定;a group determining module, configured to determine a cache group corresponding to the main memory block, where the cache group includes at least two cache blocks, each of the cache blocks corresponding to a weight, and the weight is determined according to the cache block The access rate and access latency of the main memory to which the storage data belongs are determined;
    替换块确定模块,用于根据所述cache组中各个所述cache块的权值确定替换cache块;a replacement block determining module, configured to determine, according to weights of each of the cache blocks in the cache group, a replacement cache block;
    数据替换模块,用于将确定的所述替换cache块的存储数据替换成所述主存块的存储数据。 And a data replacement module, configured to replace the determined storage data of the replacement cache block with the storage data of the primary storage block.
  9. 如权利要求8所述的装置,其特征在于,所述替换块确定模块包括:The apparatus according to claim 8, wherein said replacement block determining module comprises:
    指针信息获取单元,用于获取块指针信息,所述块指针信息用于指示预备的替换cache块;a pointer information obtaining unit, configured to acquire block pointer information, where the block pointer information is used to indicate a preliminary replacement cache block;
    查找单元,用于根据所述块指针信息查找所述预备的替换cache块;a searching unit, configured to search for the prepared replacement cache block according to the block pointer information;
    判断单元,用于判断所述查找单元查找到的所述预备的替换cache块的权值是否小于第一预设权值;a determining unit, configured to determine whether a weight of the prepared replacement cache block searched by the searching unit is smaller than a first preset weight;
    第一替换块确定单元,用于若所述预备的替换cache块的权值小于所述第一预设权值,将所述预备的替换cache块作为所述替换cache块。And a first replacement block determining unit, configured to use the prepared replacement cache block as the replacement cache block if a weight of the preliminary replacement cache block is smaller than the first preset weight.
  10. 如权利要求9所述的装置,其特征在于,所述装置还包括:The device of claim 9 wherein said device further comprises:
    权值控制模块,用于若所述预备的替换cache块的权值达到所述第一预设权值,将所述预备的替换cache块的权值减一;a weight control module, configured to: if the weight of the prepared replacement cache block reaches the first preset weight, reduce the weight of the prepared replacement cache block by one;
    指针信息控制模块,用于若所述预备的替换cache块的权值达到所述第一预设权值,翻转所述块指针信息,并触发所述替换块确定模块根据所述cache组中各个所述cache块的权值确定替换cache块。a pointer information control module, configured to: if the weight of the prepared replacement cache block reaches the first preset weight, flip the block pointer information, and trigger the replacement block determining module according to each of the cache groups The weight of the cache block determines the replacement cache block.
  11. 如权利要求8所述的装置,其特征在于,所述替换块确定模块包括:The apparatus according to claim 8, wherein said replacement block determining module comprises:
    筛选单元,用于确定所述cache组中权值小于第二预设权值的cache块;a filtering unit, configured to determine a cache block in the cache group that has a weight less than a second preset weight;
    第二替换块确定单元,用于根据预设替换算法在所述权值小于第二预设权值的cache块中确定出所述替换cache块,其中,所述预设替换算法包括LRU算法、LFU算法和先进先出算法中任一种算法。a second replacement block determining unit, configured to determine the replacement cache block in a cache block whose weight is less than a second preset weight according to a preset replacement algorithm, where the preset replacement algorithm includes an LRU algorithm, Any of the LFU algorithm and the first-in first-out algorithm.
  12. 如权利要求11所述的装置,其特征在于,The device of claim 11 wherein:
    所述筛选单元还用于:The screening unit is also used to:
    确定所述cache组中权值达到所述第二预设权值的cache块;Determining, in the cache group, a cache block whose weight reaches the second preset weight;
    所述装置还包括:The device also includes:
    权值控制模块,用于将所述权值达到所述第二预设权值的cache块中存储数据在预设时长内不存在访问的cache块的权值减一。 The weight control module is configured to reduce the weight of the cache block in which the stored data reaches the second preset weight in the cache block in which the stored data does not exist within the preset duration is reduced by one.
  13. 如权利要求8-12任一项所述的装置,其特征在于,所述装置还包括:The device of any of claims 8-12, wherein the device further comprises:
    容量检测模块,用于判断所述cache组空闲的存储空间是否小于所述主存块的数据量,若所述cache组空闲的存储空间小于所述主存块的数据量,则触发所述替换块确定模块根据所述cache组中各个所述cache块的权值确定替换cache块;a capacity detecting module, configured to determine whether the storage space of the cache group is smaller than the data volume of the main storage block, and if the storage space of the cache group is smaller than the data volume of the main storage block, triggering the replacement The block determining module determines, according to the weight of each of the cache blocks in the cache group, a replacement cache block;
    所述数据替换模块还用于:The data replacement module is also used to:
    若所述cache组空闲的存储空间达到所述主存块的数据量,将所述主存块的存储数据存储于所述cache组空闲的cache块中。If the free storage space of the cache group reaches the data amount of the main storage block, the storage data of the main storage block is stored in the cache block that is free of the cache group.
  14. 如权利要求8-13任一项所述的装置,其特征在于,A device according to any of claims 8-13, wherein
    所述主存块确定模块具体用于:The main memory block determining module is specifically configured to:
    接收处理器针对存储系统发出的访问请求,若所述cache没命中,且主存储器命中,则将主存储器中命中的主存块作为所述待存储的主存块。The receiving processor sends an access request to the storage system. If the cache misses and the main memory hits, the main memory block hit in the main memory is used as the main memory block to be stored.
  15. 一种终端设备,其特征在于,所述终端设备包括处理器和存储器,其中,所述存储器中还存储一组程序,且处理器用于调用所述存储器中存储的程序,使得所述终端设备执行如权利要求1-7任一项所述的方法。A terminal device, comprising: a processor and a memory, wherein the memory further stores a set of programs, and the processor is configured to invoke a program stored in the memory, so that the terminal device performs A method as claimed in any one of claims 1 to 7.
  16. 一种计算机存储介质,其特征在于,所述计算机存储介质存储有程序,所述程序执行时包括权利要求1-7中任一项所述的方法。 A computer storage medium, characterized in that the computer storage medium stores a program, the program comprising the method of any one of claims 1-7.
PCT/CN2015/085571 2015-07-30 2015-07-30 Method of replacing stored data in cache and device utilizing same WO2017015952A1 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201580081799.4A CN107851068A (en) 2015-07-30 2015-07-30 The replacement method and alternative of data storage in a kind of cache memory
PCT/CN2015/085571 WO2017015952A1 (en) 2015-07-30 2015-07-30 Method of replacing stored data in cache and device utilizing same

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2015/085571 WO2017015952A1 (en) 2015-07-30 2015-07-30 Method of replacing stored data in cache and device utilizing same

Publications (1)

Publication Number Publication Date
WO2017015952A1 true WO2017015952A1 (en) 2017-02-02

Family

ID=57883936

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2015/085571 WO2017015952A1 (en) 2015-07-30 2015-07-30 Method of replacing stored data in cache and device utilizing same

Country Status (2)

Country Link
CN (1) CN107851068A (en)
WO (1) WO2017015952A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112395221B (en) * 2020-11-20 2023-02-10 华中科技大学 Cache replacement method and device based on energy consumption characteristics of MLC STT-RAM

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1255986A (en) * 1997-03-14 2000-06-07 艾利森电话股份有限公司 Penalty-based cache storage and replacement techniques
CN102207909A (en) * 2011-05-31 2011-10-05 孟小峰 Cost-based buffer area replacement method of flash memory database
CN102289354A (en) * 2011-06-17 2011-12-21 华中科技大学 VDF (Victim Disk First) based cache memory replacement method
CN103150122A (en) * 2011-12-07 2013-06-12 华为技术有限公司 Method and device for managing disk cache space

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7496711B2 (en) * 2006-07-13 2009-02-24 International Business Machines Corporation Multi-level memory architecture with data prioritization
CN104375957B (en) * 2013-08-15 2018-10-09 华为技术有限公司 A kind of method and apparatus that data are replaced

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1255986A (en) * 1997-03-14 2000-06-07 艾利森电话股份有限公司 Penalty-based cache storage and replacement techniques
CN102207909A (en) * 2011-05-31 2011-10-05 孟小峰 Cost-based buffer area replacement method of flash memory database
CN102289354A (en) * 2011-06-17 2011-12-21 华中科技大学 VDF (Victim Disk First) based cache memory replacement method
CN103150122A (en) * 2011-12-07 2013-06-12 华为技术有限公司 Method and device for managing disk cache space

Also Published As

Publication number Publication date
CN107851068A (en) 2018-03-27

Similar Documents

Publication Publication Date Title
CN105740164B (en) Multi-core processor supporting cache consistency, reading and writing method, device and equipment
TWI684099B (en) Profiling cache replacement
US10929308B2 (en) Performing maintenance operations
US8095734B2 (en) Managing cache line allocations for multiple issue processors
EP3121703A1 (en) Data caching method, cache and computer system
US20130262767A1 (en) Concurrently Accessed Set Associative Overflow Cache
US10007615B1 (en) Methods and apparatus for performing fast caching
US9552301B2 (en) Method and apparatus related to cache memory
WO2017184497A1 (en) Object tagged memory monitoring method and processing apparatus
EP3023878B1 (en) Memory physical address query method and apparatus
CN108073527A (en) It is a kind of to cache the method and apparatus replaced
WO2016015583A1 (en) Memory management method and device, and memory controller
JP6027562B2 (en) Cache memory system and processor system
US10831673B2 (en) Memory address translation
US20080307169A1 (en) Method, Apparatus, System and Program Product Supporting Improved Access Latency for a Sectored Directory
CN107562806B (en) Self-adaptive sensing acceleration method and system of hybrid memory file system
US10853262B2 (en) Memory address translation using stored key entries
WO2017015952A1 (en) Method of replacing stored data in cache and device utilizing same
US20180052778A1 (en) Increase cache associativity using hot set detection
CN107861819B (en) Cache group load balancing method and device and computer readable storage medium
WO2021008552A1 (en) Data reading method and apparatus, and computer-readable storage medium
KR101976320B1 (en) Last level cache memory and data management method thereof
JP7311959B2 (en) Data storage for multiple data types
CN116069719A (en) Processor, memory controller, system-on-chip and data prefetching method
CN117222989A (en) DRAM aware cache

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15899304

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15899304

Country of ref document: EP

Kind code of ref document: A1