WO2022226770A1 - 访问缓存行的方法和装置 - Google Patents

访问缓存行的方法和装置 Download PDF

Info

Publication number
WO2022226770A1
WO2022226770A1 PCT/CN2021/090189 CN2021090189W WO2022226770A1 WO 2022226770 A1 WO2022226770 A1 WO 2022226770A1 CN 2021090189 W CN2021090189 W CN 2021090189W WO 2022226770 A1 WO2022226770 A1 WO 2022226770A1
Authority
WO
WIPO (PCT)
Prior art keywords
cache lines
cache
state
state identifier
data
Prior art date
Application number
PCT/CN2021/090189
Other languages
English (en)
French (fr)
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 PCT/CN2021/090189 priority Critical patent/WO2022226770A1/zh
Publication of WO2022226770A1 publication Critical patent/WO2022226770A1/zh

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 technical field of data access, and in particular, to a method and apparatus for accessing a cache line.
  • Cache is a cache memory between the central processing unit CPU and the main memory, or between the main memory and the disk, which is mainly used to solve the problem of mismatching data read and write speeds in the system.
  • Cache caches the data used in the running process of the program.
  • the data is stored in the on-chip cache unit.
  • the data can be exchanged in units of cache lines, and then the corresponding data flag bits can be used.
  • the address information of the data is recorded, and the status bit records the usage of the corresponding Cache unit. In this way, the hit status of the cache can be known according to the data flag bit. If it hits, the data can be read from the Cache. If there is no hit, the corresponding data can be read from the main memory, and then the cache can be replaced according to a certain replacement strategy. , to improve data reuse.
  • the replacement strategy can directly affect the performance of the Cache system, among them, the Least Recently Used (LRU) algorithm is used as the replacement strategy. Because of its time locality, a better cache hit can be obtained during the running of the computer program. , therefore, the application of LRU replacement strategy is more common.
  • LRU replacement strategy in the prior art consumes a lot of logic resources, and the determined replacement result is not a globally optimal result, but a locally optimal result, thus affecting the quality and effect of data replacement.
  • the embodiment of the present invention provides a method and device for accessing a cache line, which can solve the problem that the existing technology consumes a lot of logic resources, and the determined replacement result is not a globally optimal result, but a locally optimal result, This affects the quality and effect of data replacement.
  • a first aspect of the present invention is to provide a method for accessing a cache line, comprising:
  • the state identifiers corresponding to each of the multiple cache lines are acquired, wherein the number of bits of the binary number corresponding to the state identifier and the number of the multiple cache lines related;
  • the data in the first cache line is updated to the data to be accessed.
  • a second aspect of the present invention is to provide a method for accessing a cache line, comprising:
  • the state identifiers are used to identify the storage duration of the data in the cache lines, and the number of bits of the binary numbers corresponding to the state identifiers is related to the number of the multiple cache lines;
  • the data to be accessed is processed based on the state identifier, and the respective state identifiers corresponding to the multiple cache lines are updated.
  • a third aspect of the present invention is to provide a device for accessing a cache line, comprising:
  • a processor for running a computer program stored in the memory to achieve:
  • the state identifiers corresponding to each of the multiple cache lines are acquired, wherein the number of bits of the binary number corresponding to the state identifier and the number of the multiple cache lines related;
  • the stored data in the first cache line is updated to the data to be accessed.
  • a fourth aspect of the present invention is to provide a device for accessing a cache line, comprising:
  • a processor for running a computer program stored in the memory to achieve:
  • the data to be accessed is processed based on the state identifier, and the respective state identifiers corresponding to the multiple cache lines are updated.
  • a fifth aspect of the present invention is to provide a computer-readable storage medium, the storage medium is a computer-readable storage medium, and program instructions are stored in the computer-readable storage medium, and the program instructions are used in the first aspect. method for accessing a cache line as described above.
  • a sixth aspect of the present invention is to provide a computer-readable storage medium, the storage medium is a computer-readable storage medium, and program instructions are stored in the computer-readable storage medium, and the program instructions are used in the second aspect. method for accessing a cache line as described above.
  • the respective state identifiers corresponding to the multiple cache lines are acquired; and then based on the multiple cache lines
  • the corresponding state identifiers determine the first cache line among the multiple cache lines, and update the data in the first cache line to the data to be accessed, effectively realizing the need to analyze and process when the acquisition is obtained.
  • the cache line with the longest data storage duration is used as the first cache line for processing the data to be accessed, and then the first cache line can be used for processing the data to be accessed.
  • the data in the line is updated to the data to be accessed, so that the data in the cache line can be replaced and updated in time, and this implementation method is simple in design, low power consumption, and good timing, and the determined first cache behavior is global
  • This optimal result thereby effectively ensuring the practicability of the method for accessing the cache line, is beneficial to the promotion and application of the market.
  • FIG. 1 is a schematic diagram of the mapping relationship between the main memory and the cache provided by the related art
  • FIG. 2 is a schematic diagram of a cache replacement process provided by the related art
  • FIG. 3 is a schematic diagram of an LRU replacement process implemented based on a counter provided by the related art
  • FIG. 4 is a schematic diagram of a binary tree-based replacement process provided by the related art
  • FIG. 5 is a schematic flowchart of a method for accessing a cache line according to an embodiment of the present invention
  • FIG. 6 is a schematic flowchart of another method for accessing a cache line according to an embodiment of the present invention.
  • FIG. 7 is a schematic flowchart of another method for accessing a cache line provided by an embodiment of the present invention.
  • FIG. 8 is a schematic flowchart of determining a first cache line in the multiple cache lines based on the respective corresponding state identifiers of the multiple cache lines provided by an embodiment of the present invention
  • FIG. 9 is a schematic flowchart of another method for accessing a cache line provided by an embodiment of the present invention.
  • FIG. 10 is a schematic flowchart 1 of updating the status identifiers of other cache lines according to an embodiment of the present invention
  • FIG. 11 is a second schematic flowchart of updating the status identifiers of other cache lines according to an embodiment of the present invention.
  • FIG. 12 is a schematic flowchart of another method for accessing a cache line provided by an embodiment of the present invention.
  • FIG. 13 is a schematic schematic diagram of a method for accessing a cache line provided by an application embodiment of the present invention.
  • FIG. 14 is a schematic structural diagram of an apparatus for accessing a cache line according to an embodiment of the present invention.
  • FIG. 15 is a schematic structural diagram of another apparatus for accessing a cache line according to an embodiment of the present invention.
  • Cache is a cache memory between the central processing unit CPU and the main memory, or between the main memory and the disk, which is mainly used to solve the problem of mismatching data read and write speeds in the system.
  • a small part of the on-chip cache space in the Cache can be mapped to the larger space of the main memory DDR, which can improve the repeated utilization of data and reduce the system load.
  • Bandwidth as shown in Figure 1, provides a directly mapped Cache and main memory mapping relationship.
  • the Cache caches the data used by the program running process, usually the data is stored in the on-chip cache unit, and then the data flag bit "Tag" can be used to record the address information of the data, and the data status bit records the corresponding Cache cache unit. usage.
  • the hit situation of the cache unit can be known according to the Tag information. If it hits, the data can be read from the Cache; if it is not hit, the corresponding data can be read from the main memory, and then the Cache can be read according to a certain replacement strategy. The cached data is replaced to improve the data reuse rate.
  • LRU replacement strategy When replacing the cached data, the performance of the replacement algorithm directly affects the performance of the Cache system.
  • Common replacement algorithms include: random algorithm, first-in first-out and least recently used algorithm (Least Recently Used, referred to as LRU), etc., among which , LRU replacement strategy can achieve better cache hits in the running process of computer programs because of its time locality. Therefore, the application of LRU replacement strategy is more common. The following is a brief description of the implementation of several common LRU replacement strategies:
  • the LRU replacement method implemented by the linked list is to record or save the access situation of the data by maintaining a linked list, and the label information corresponding to the new data is inserted into the linked list header; specifically, as shown in Figure 2, whenever the cache hits ( That is, the cached data is accessed), then move the tag information to the head of the linked list; when the cache is full and misses, the new data replaces the data corresponding to the end of the list.
  • the head of the linked list corresponds to the recently accessed data
  • the tail of the list is the data with the longest time since the last access.
  • the cache LRU replacement strategy can be implemented by means of counters.
  • N counters need to be maintained. Specifically, as shown in Figure 3, all N counters are initialized to the maximum value; The counter corresponding to the cache line of the new data or access hit is set to 0, and the other counters are accumulated by 1, and the count is maintained; when the cache is full and the cache line is not hit, the cache line corresponding to the largest N counter values is replaced.
  • the counter When the counter is full, it loses the characteristics of LRU (multiple counters are full, and the access sequence of data cannot be distinguished), so the bit width of the counter is usually large to ensure that the access within a period of time will not cause the counter to be full. For example: 16bit bit width at worst can guarantee 65535 accesses without overflow.
  • N-1bit can be used to represent the cache line that needs to be replaced.
  • a binary tree described by N-1bit is provided.
  • the corresponding node is When it is 0, it means that the replaced cache line is on the left side of the node, and when the corresponding node is 1, it means that the replaced cache line is on the right side of the node.
  • the empty cache line is replaced first; when the cache is full, the cache line pointed to by the binary tree can be selected; then the bit data corresponding to the node can be updated according to the accessed cache line on the left or right side of the node If it is 0 or 1, the node that has not passed through can keep the original value.
  • Table 1 the state transition rules are shown in Table 1:
  • the above implementation method only needs to maintain a binary tree represented by N-1bit, and the transfer rules are relatively simple and fixed.
  • ASIC or FPGA it has low power consumption and fast update, and can achieve a relatively high system. clock.
  • the above implementation method is to update the visited binary tree nodes each time, keep the unvisited nodes, and only use 1 bit to represent left or right, each node is a locally optimal choice, and cannot include all the bottom leaf nodes After multiple nodes are connected in series, it is not a globally optimal choice. In some cases, wrong replacement decisions will be made, so it is an approximate representation of LRU, also known as pseudo-least-recent-used replacement algorithm (Pseudo LRU, referred to as PLRU).
  • Pseudo LRU also known as pseudo-least-recent-used replacement algorithm
  • a 4-way cache system is used as an example to illustrate PLRU and LRU.
  • the initialization binary tree is (0,0,0), in the access sequence At 5
  • the PLRU implementation is not a globally optimal replacement strategy, but a sub-optimal choice, which will cause a sub-optimal data C to be replaced when new data from series 6 is accessed.
  • a cache miss will occur, and the C data needs to be re-read and updated to the cache (because the data is localized in time and space during the running of the program, so the data accessed by the access sequence 7 is the probability of occurrence of C is usually greater than B or data before C), when the cost of cache misses is large, the performance of LRU is more obvious than that of PLRU, and the replacement strategy implemented by binary tree requires that the number of cache lines must meet the power of 2, such as: 2, 4, 8, 16, 32, etc., cannot be used when the cache line is 12.
  • the related technology has the following defects:
  • the LRU replacement strategy implemented by the linked list is complex to implement and is a serial operation, which is not suitable for implementation in ASIC or FPGA.
  • the binary tree has the characteristics of simple design, low power consumption, and good timing performance, but it implements a pseudo-least-recent-use strategy, which specifically implements a local optimal rather than global optimal result, and the cache
  • the number of lines must be 2 K , where k is an integer and k>0.
  • the present embodiment provides a method and device for accessing a cache line, wherein the method for accessing a cache line obtains the data to be accessed, and does not store the data in the multiple cache lines.
  • the state identifiers corresponding to each of the multiple cache lines are obtained; then based on the respective state identifiers of the multiple cache lines, the first cache line is determined among the multiple cache lines, and the first cache line is determined.
  • the data in a cache line is updated to the data to be accessed, which effectively realizes that when the data to be accessed that needs to be analyzed and processed is obtained, the data can be stored in multiple cache lines based on the state identifier of the cache line.
  • the cache line with the longest duration is used as the first cache line for processing the data to be accessed, and then the data in the first cache line can be updated to the data to be accessed, which effectively realizes the timely processing of the data in the cache line.
  • Replace and update operations, and this implementation method is simple in design, low power consumption, and good timing, and the determined first cache line is the globally optimal result, which effectively ensures the practicability of the method of accessing the cache line. , which is conducive to the promotion and application of the market.
  • FIG. 5 is a schematic flowchart of a method for accessing a cache line provided by an embodiment of the present invention; with reference to FIG. 5 , this embodiment provides a method for accessing a cache line, and the execution body of the method is to access the cache
  • a device for a cache line the device can be implemented as software, or a combination of software and hardware.
  • the method for accessing a cache line can include the following steps:
  • Step S501 Acquire data to be accessed.
  • Step S502 When the data to be accessed is not stored in the multiple cache lines, obtain the state identifiers corresponding to each of the multiple cache lines, wherein the number of bits of the binary number corresponding to the state identifiers is the same as the number of bits of the multiple cache lines. quantity is related.
  • Step S503 Determine the first cache line among the multiple cache lines based on the respective state identifiers of the multiple cache lines, and the storage duration of the data in the first cache line is longer than the storage duration of the data in other cache lines.
  • Step S504 Update the data in the first cache line to the data to be accessed.
  • Step S501 Acquire data to be accessed.
  • the data to be accessed refers to the data that needs to be read from the memory, or it can also refer to the data that needs to be written into the memory.
  • a corresponding operation can be performed on the device accessing the cache line, so that the device accessing the cache line can directly obtain the data to be accessed; or, when the user has a read and write demand
  • the request is executed, a corresponding operation can be performed on the client, so that the client can generate read and write requirements and the data to be accessed corresponding to the read and write requirements.
  • the client After the client obtains the data to be accessed, it can send the data to be accessed to the A device for a cache line, so that a device for accessing a cache line can obtain the data to be accessed.
  • Step S502 When the data to be accessed is not stored in the multiple cache lines, obtain the state identifiers corresponding to each of the multiple cache lines, wherein the number of bits of the binary number corresponding to the state identifiers is the same as the number of bits of the multiple cache lines. quantity is related.
  • the data stored in multiple cache lines can be analyzed and compared with the data to be accessed to identify whether the data to be accessed is stored in the cache line. , when the data stored in a cache line is the same as the data to be accessed, it is determined that the data to be accessed is stored in the cache line, and when the data stored in all cache lines is different from the data to be accessed, it is determined to be accessed. Access data is not stored on the cache line.
  • the data to be accessed needs to be stored in the cache line, and then it is necessary to determine a user in multiple cache lines.
  • the first cache line that stores the data to be accessed.
  • a state flag can be configured for each cache line, and the state flag is used to identify the cache line. Information on how long to store data.
  • the state identifiers corresponding to each of the multiple cache lines can be obtained. Specifically, the state identifiers corresponding to the cache lines can be stored in the preset area, and the preset area can be accessed by accessing the preset area. You can get the corresponding status ID of the cache line.
  • the state identifier corresponding to the cache line obtained above may be represented by a binary number.
  • the number of bits of the binary number corresponding to the state identifier is related to the number of multiple cache lines.
  • the number of bits of the binary number corresponding to the status flag is log 2 (N).
  • the status flags may be "1", “2", "3” and "4" corresponding to the above four cache lines.
  • Step S503 Determine the first cache line among the multiple cache lines based on the respective state identifiers of the multiple cache lines, and the storage duration of the data in the first cache line is longer than the storage duration of the data in other cache lines.
  • the multiple cache lines can be analyzed and processed based on the respective state identifiers corresponding to the multiple cache lines, so as to determine the first cache line among the multiple cache lines, wherein all the The determined storage duration of data in the first cache line is greater than the storage duration of data in other cache lines.
  • multiple cache lines and their corresponding status identifiers are respectively: cache line1-ID1, cache line2-ID2, cache line3-ID3 and cache line4-ID4, assuming that ID1 corresponds to time t1, ID2 Corresponding to time t2, flag 3 corresponds to time t3, flag 4 corresponds to time t4, when t1 is earlier than t2, t2 is earlier than t3, and t3 is earlier than t4, if the data to be accessed is obtained and the above cache line does not store the data to be accessed , the first cache line can be determined among the above-mentioned multiple cache lines. Since the duration of storing data in cache line 1 is the longest, it can be determined that cache line 1 is the first cache line, thus effectively guaranteeing the first cache line. The exact reliability of the determination of the line.
  • Step S504 Update the data in the first cache line to the data to be accessed.
  • the data in the first cache line can be updated to the data to be accessed, thereby effectively realizing that when the data to be accessed is not stored in the cache line, the data to be accessed can be timely and effectively stored
  • the data is stored in the cache line with the longest data storage time, which is beneficial to improve the data reuse utilization.
  • the respective state identifiers corresponding to the multiple cache lines are obtained;
  • the corresponding state identifiers of the cache lines determine the first cache line among multiple cache lines, and update the data in the first cache line to the data to be accessed, which effectively realizes when there is data to be accessed that needs to be analyzed and processed. , then based on the status identifier of the cache line, among multiple cache lines, the cache line with the longest data storage time can be used as the first cache line for processing the data to be accessed, and then the data in the first cache line can be updated.
  • FIG. 6 is a schematic flowchart of another method for accessing a cache line provided by an embodiment of the present invention; with reference to FIG. 6, in order to ensure the practicability of the method for accessing a cache line Before the state identification of , the method in this embodiment may further include:
  • Step S601 Obtain quantity information corresponding to multiple cache lines.
  • Step S602 Configure initial state identifiers for multiple cache lines based on the quantity information, and different cache lines correspond to different initial state identifiers.
  • the quantity information corresponding to multiple cache lines can be obtained, and then the initial state identifiers can be configured for multiple cache lines based on the quantity information.
  • the initial state identifiers can be configured for multiple cache lines based on the quantity information.
  • the state identification may include: determining continuous initial state identifications corresponding to multiple cache lines based on quantity information; and mapping the initial state identifications to multiple cache lines.
  • the quantity information can be analyzed and processed to determine the continuous initial state identifiers corresponding to multiple cache lines, and then the initial state identifiers can be mapped to multiple cache lines, thereby effectively realizing multiple cache lines.
  • Each cache line configures the corresponding initial state identifier, so that the data in multiple cache lines can be updated and replaced based on the initial state identifier.
  • the continuous initial state identifiers corresponding to the multiple cache lines may be determined based on the quantity information, and the continuous initial state identifiers may be 0, 1, 2 and 3, and then the consecutive initial state identifiers can be mapped to 4 cache lines in turn.
  • the consecutive initial state identifiers can be 1, 2, 3, and 4, and then the consecutive initial state identifiers can be sequentially mapped to 4 cache lines.
  • the consecutive initial state identifiers may be 3, 4, 5, and 6, and then the consecutive initial state identifiers may be sequentially mapped to 4 cache lines.
  • determining continuous initial state identifiers corresponding to multiple cache lines based on quantity information may include: updating multiple cache lines based on quantity information Sort to obtain a sequence of multiple cache lines; in the sequence of multiple cache lines, determine the sequence number information corresponding to the cache line as a continuous initial state identifier corresponding to the cache line.
  • multiple cache lines are cache lineA, cache lineB, cache lineC, and cache lineD, and then the above-mentioned multiple cache lines are sorted based on the quantity information, so that the sorting sequence of multiple cache lines can be obtained, and the sequence is cache lineA (serial number is 1)-cache lineB (serial number is 2)-cache lineC (serial number is 3)-cache lineD (serial number is 4), and then the sequence number information can be determined as the initial state identifier corresponding to the cache line, which is convenient for many Viewing the status of each cache line further ensures the quality and efficiency of updating the data in the cache line.
  • the cache line configures the corresponding initial state identifier, so that the data in multiple cache lines can be updated and replaced based on the initial state identifier, which further ensures the stability and reliability of the method of accessing the cache line.
  • FIG. 7 is a schematic flowchart of another method for accessing a cache line provided by an embodiment of the present invention; with reference to FIG. 7 , in order to ensure the accuracy and reliability of the method for accessing a cache line After each cache line is configured with an initial state identifier, the method in this embodiment may further include:
  • Step S701 Obtain data access requests for multiple cache lines.
  • Step S702 Update the initial state identifiers corresponding to the multiple cache lines based on the data access request, and obtain the respective state identifiers corresponding to the multiple cache lines.
  • the initial state identifiers for multiple cache lines after configuring the initial state identifiers for multiple cache lines based on the quantity information, users can perform data access operations on multiple cache lines according to their needs, so as to obtain data access requests for multiple cache lines.
  • the access request can be a data read request or a data storage request.
  • the data access request After the data access request is obtained, since the data access request includes the data to be accessed, the data in multiple cache lines needs to be updated based on the data to be accessed. At this time, the storage duration of the data in the multiple cache lines has changed.
  • the initial state identifier used to identify the storage duration of data in multiple cache lines needs to be updated. After the initial state identifier is updated, the corresponding state identifiers of multiple cache lines can be obtained.
  • the The data access request of the cache line updates the respective initial state identifiers of the multiple cache lines, and ensures the accuracy and reliability of obtaining the respective state identifiers of the multiple cache lines, which further improves the access to the cache line of the cache line.
  • FIG. 8 is a schematic flowchart of determining a first cache line among multiple cache lines based on the corresponding state identifiers of multiple cache lines according to an embodiment of the present invention; with reference to FIG. 8 , this embodiment provides a method for determining The implementation of the first cache line, specifically, in this embodiment, based on the respective corresponding state identifiers of the multiple cache lines, determining the first cache line among the multiple cache lines may include:
  • Step S801 Determine the respective storage durations of the stored data in the multiple cache lines based on the respective state identifiers corresponding to the multiple cache lines.
  • Step S802 Based on the storage duration, determine the first cache line among the multiple cache lines.
  • the respective state identifiers corresponding to the multiple cache lines can be analyzed and processed to determine the respective storage durations of the stored data in the multiple cache lines. Specifically, There is a positive correlation between the size of the state ID and the storage duration; alternatively, there is a negative correlation between the size of the status ID and the storage duration.
  • there is a positive correlation between the size of the state identifier and the storage duration if the state identifier corresponding to the cache line is larger, the storage duration of the data in the cache line is longer; if the state identifier corresponding to the cache line is smaller, the The shorter the storage time of data in the cache line.
  • the storage duration of the data in the cache line is shorter; if the state identifier corresponding to the cache line is smaller, the The longer the storage duration of the data in the cache line, the more accurate and reliable the determination of the respective storage durations of the stored data in multiple cache lines is effectively guaranteed.
  • the storage duration can be analyzed and processed to determine the first cache line among the multiple cache lines, wherein the storage duration of the data in the first cache line It is longer than the storage time of data in other cache lines, which effectively ensures the accuracy and reliability of the determination of the first cache line.
  • the method in this embodiment may further include: updating the state identifiers corresponding to each of the multiple cache lines.
  • the state identifiers corresponding to each of the multiple cache lines may include: when there is a positive correlation between the size of the state identifier and the storage duration, setting the state identifier information of the first cache line to zero, and setting the multiple cache lines to zero.
  • the state identifiers corresponding to other cache lines in each cache line are increased by one; when there is a negative correlation between the size of the state identifier and the storage duration, the state identifier of the first cache line is configured as the maximum state identifier, and multiple The state flags corresponding to other cache lines in the cache line are decremented by one.
  • multiple cache lines include cache line0, cache line1, cache line2 and cache line3, cache line0 stores data E, cache line1 stores data C, cache line2 stores data B and cache line3 stores data A.
  • the status identifiers corresponding to cache line0, cache line1, cache line2 and cache line3 are C0, C1, C2 and C3.
  • the data to be accessed is A
  • the data to be accessed A is stored in cache line 3. Therefore, it means that A is stored in the cache line, and then the status identifiers corresponding to multiple cache lines can be updated.
  • the determined state identifier of the first cache line (that is, cache line 3) can be set to zero, that is, the cache The flag "3" in line 3 is changed to "0”, and the corresponding state flags of other cache lines are added by 1, and then the state flags corresponding to multiple cache lines can be determined.
  • Cache line0 corresponds to the state flag "1
  • Cache line1 corresponds to the status ID "2
  • cache line2 corresponds to the status ID "3”
  • cache line3 corresponds to the status ID "0".
  • the determined state identifier of the first cache line (that is, cache line2) can be set to zero, that is, the cache
  • the flag "3" in line 2 is changed to "0”
  • the corresponding state flags of other cache lines are added by 1, and then the state flags corresponding to multiple cache lines can be determined.
  • the state flag of cache line0 corresponds to "2”
  • the cache line1 corresponds to the state flag "3”
  • the cache line2 corresponds to the state flag "0”
  • the cache line3 corresponds to the state flag "1".
  • the corresponding state identifiers of multiple cache lines can be updated from "2, 3, 0, 1" to "3, 0, 1, 2" based on the data C to be accessed. , thereby effectively realizing the update operation of the corresponding state identifiers of multiple cache lines, and ensuring the accuracy and reliability of updating the state identifiers.
  • multiple cache lines include cache line0, cache line1, cache line2 and cache line3, cache line0 stores data E, cache line1 stores data C, cache line2 stores data B and cache line3 stores data A.
  • the status identifiers corresponding to cache line0, cache line1, cache line2 and cache line3 are C0, C1, C2 and C3.
  • the determined state identifier of the first cache line (that is, cache line0) can be configured as the maximum state Identification, that is, change the identification "O” in cache line 0 to "3”, and decrement the corresponding status identifications of other cache lines by 1, and then the status identifications corresponding to multiple cache lines can be determined, and cache line0 corresponds to the status identification.
  • cache line1 corresponds to the state flag "0”
  • cache line2 corresponds to the state flag "1”
  • cache line3 corresponds to the state flag "2”.
  • the determined state identifier of the first cache line (that is, cache line1) can be configured as the maximum state Identification, that is, change the identification "0" in cache line 1 to "3", and subtract 1 from the corresponding status identifications of other cache lines, and then determine the status identifications corresponding to multiple cache lines, and cache line0 corresponds to the status identification "2", cache line1 corresponds to the state flag "3", cache line2 corresponds to the state flag "0”, cache line3 corresponds to the state flag "1".
  • the corresponding state identifiers of multiple cache lines can be updated from "2, 3, 0, 1" to "1, 2, 3, 0" based on the data to be accessed B. , thereby effectively realizing the update operation of the corresponding state identifiers of multiple cache lines, and ensuring the accuracy and reliability of updating the state identifiers.
  • the state identifier information of the first cache line is set to zero, and the state identifiers corresponding to other cache lines in the multiple cache lines are incremented by one.
  • configure the state identifier of the first cache line as the maximum state identifier, and reduce the state identifiers corresponding to other cache lines in multiple cache lines by one Thus, the update operation of the respective corresponding state identifiers of multiple cache lines is effectively implemented, and the stability and reliability of the method for accessing the cache lines of the cache lines are further ensured.
  • Fig. 9 is a schematic flowchart of another method for accessing a cache line provided by an embodiment of the present invention. with reference to Fig. 9, specifically, the method in this embodiment may further include:
  • Step S901 When the data to be accessed is stored in multiple cache lines, a second cache line for storing the data to be accessed is determined.
  • Step S902 Update the state identifiers of other cache lines, and update the state identifiers of the second cache line to the set state identifiers, wherein the set state identifiers are used to identify that the storage duration of data in the second cache line is shorter than that of other cache lines. How long to store data in the cache line.
  • the second cache line for storing the data to be accessed can be determined. After the second cache line is determined, since the second cache line has been stored in the cache line The data to be accessed can be updated to the status flags of the second cache line and other cache lines. It should be noted that, in order to represent that the storage duration of the data in the second cache line is shorter than the storage duration of the data in other cache lines, the state identifier of the second cache line can be updated to a set state identifier, the set state identifier.
  • the set state identifier may be the smallest state identifier among the state identifiers corresponding to each of the multiple cache lines; a negative relationship between the size of the state identifier and the storage duration
  • the set state flag can be the largest state flag among the state flags corresponding to each of the multiple cache lines.
  • this embodiment does not limit the execution sequence of the above-mentioned steps of “update the state identifiers of other cache lines” and steps of “update the state identifiers of the second cache line to the set state identifiers”.
  • the status ID of the line is updated to the set status ID, and then the status IDs of other cache lines are updated; alternatively, the steps “update the status IDs of other cache lines” and the steps “update the status IDs of the second cache line to set status IDs" "Confirmed state identification” can be executed synchronously.
  • the second cache line storing the data to be accessed is determined, and then the state identifiers of other cache lines are updated, and the state of the second cache line is updated.
  • the identifier is updated to the set state identifier, which effectively realizes that when the data to be accessed is stored in the cache line, the state identifiers of the second cache line and other cache lines can be updated based on the data to be accessed, which effectively guarantees
  • the timing corresponding to the status identification of each cache line ensures the practicability of the method of accessing the cache line of the cache line, which is beneficial to the promotion and application of the market.
  • Fig. 10 is a schematic flow chart 1 of updating the state identifiers of other cache lines provided by an embodiment of the present invention; with reference to Fig. 10, when the state identifier is set as the maximum state identifier, that is, the size of the state identifier and the storage duration There is a negative correlation between them. At this time, updating the status flags of other cache lines can include:
  • Step S1001 Obtain the pre-adjustment state identifier of the second cache line.
  • Step S1002 For a cache line whose state identifier is smaller than the state identifier before adjustment, keep the state identifier of the cache line unchanged.
  • Step S1003 For a cache line whose state identifier is greater than the state identifier before adjustment, the state identifiers of the cache lines are respectively decremented by 1.
  • multiple cache lines include cache line0, cache line1, cache line2, and cache line3.
  • Data E is stored in cache line0
  • data C is stored in cache line1
  • data B is stored in cache line2
  • data is stored in cache line3.
  • the statuses corresponding to cache line0, cache line1, cache line2 and cache line3 are identified as C0, C1, C2 and C3.
  • the strategy for updating data and identifiers in multiple cache lines is shown in Table 6 below:
  • the data to be accessed is B
  • the data to be accessed B is stored in cache line 2. Therefore, it means that B is stored in the cache line, and then the status identifiers corresponding to multiple cache lines can be updated.
  • a second cache line ie, cache line2
  • the pre-adjustment state identifier of where the second cache line is the cache line that stores the data B to be accessed. At this time, the pre-adjustment state identifier of the second cache line is "2".
  • Multiple cache lines can be divided into two groups.
  • the first group of cache lines is the cache lines whose status ID is smaller than the status ID before adjustment (cache line0, cache line1), and the second group of cache lines is the cache line whose status ID is larger than the status ID before adjustment. line(cache line3).
  • the state identifier of the cache line is kept unchanged, even if the identifier of the cache line0 remains 0, the cache line The identifier of line1 remains 1; for the cache line whose status identifier is greater than the status identifier before adjustment, the state identifier of the cache line is decremented by 1, that is, the identifier of cache line3 is adjusted from “3" to "2". It should be noted that at this time, the identifier of the second cache line is adjusted from "2" to the maximum state identifier "3".
  • the data to be accessed is C
  • the data to be accessed C is stored in the cache line1
  • the status identifiers corresponding to multiple cache lines can be updated.
  • the second cache line ie, cache line1
  • the pre-adjustment status identifier of the second cache line is the cache line that stores the data C to be accessed. At this time, the pre-adjustment status identifier of the second cache line is "1".
  • cache lines can be divided into two groups.
  • the first group of cache lines is the cache line (cache line0) whose status ID is smaller than the status ID before adjustment
  • the second group of cache lines is the cache line whose status ID is greater than the status ID before adjustment (cache line line2, cache line3).
  • the state identifier of the cache line is kept unchanged, that is, the identifier of cache line0 remains 0; If the status ID is greater than the cache line with the status ID before adjustment, the status ID of the cache line is decremented by 1, that is, the ID of cache line 2 is adjusted from “3" to "2", and the ID of cache line 3 is adjusted from "2" to " 1". It should be noted that at this time, the identifier of the second cache line is adjusted from "1" to the maximum state identifier "3".
  • the corresponding status identifiers of multiple cache lines can be updated from "0, 1, 3, 2" to "0, 2, 1, 3" based on the data A to be accessed , thereby effectively realizing the update operation of the corresponding state identifiers of multiple cache lines, and ensuring the accuracy and reliability of updating the state identifiers.
  • the set state identifier is the maximum state identifier, that is, the size of the state identifier and the storage duration are negatively correlated, by obtaining the pre-adjustment state identifier of the second cache line, for the state identifier smaller than the pre-adjustment state identifier If the cache line is set, the status ID of the cache line is kept unchanged, and for the cache line whose status ID is greater than the status ID before adjustment, the status ID of the cache line is decremented by 1, thereby effectively realizing the status of other cache lines.
  • the identifier is updated accurately and effectively, which further ensures the stability and reliability of the method of accessing the cache line.
  • FIG. 11 is a schematic flowchart 2 of updating the state identifiers of other cache lines according to an embodiment of the present invention.
  • the state identifier is set as the minimum state identifier, that is, the difference between the size of the state identifier and the storage duration There is a positive correlation between them.
  • updating the status flags of other cache lines can include:
  • Step S1101 obtaining the pre-adjustment state identifier of the second cache line
  • Step S1102 When the pre-adjustment state identifier of the second cache line is the largest state identifier, adjust the largest state identifier to the smallest state identifier, and add 1 to the state identifiers of other cache lines respectively.
  • multiple cache lines include cache line0, cache line1, cache line2, and cache line3.
  • Data E is stored in cache line0
  • data C is stored in cache line1
  • data B is stored in cache line2
  • data is stored in cache line3.
  • the statuses corresponding to cache line0, cache line1, cache line2 and cache line3 are identified as C0, C1, C2 and C3.
  • the strategy for updating data and identifiers in multiple cache lines is shown in Table 7 below:
  • the data to be accessed is A
  • the data A to be accessed is stored in the cache line3, therefore, it means that A is stored in the cache line, and then the status identifiers corresponding to multiple cache lines can be updated.
  • a second cache line that is, cache line3
  • the pre-adjustment status identifier of where the second cache line is the cache line that stores the data A to be accessed. At this time, the pre-adjustment status identifier of the second cache line is "3".
  • the pre-adjustment status identifier After the pre-adjustment status identifier is obtained, It can identify whether the pre-adjustment state identifier of the second cache line is the largest state identifier.
  • the largest state identifier can be adjusted to the smallest state identifier, that is, the second cache line (i.e. cache line3) is adjusted from “3" to "0", and the other cache line's state flags are respectively increased by 1, that is, the state flag of cache line0 is adjusted from "0" to "1", cache line1
  • the status flag of cache line2 is adjusted from “1" to "2”
  • the state flag of cache line2 is adjusted from "2" to "3".
  • the data to be accessed is B
  • the data to be accessed B is stored in the cache line2
  • the status identifiers corresponding to multiple cache lines can be updated.
  • a second cache line ie, cache line2
  • the pre-adjustment state identifier of where the second cache line is the cache line that stores the data B to be accessed. At this time, the pre-adjustment state identifier of the second cache line is "3".
  • the pre-adjustment state identifier of the second cache line After obtaining the pre-adjustment state identifier, It can identify whether the pre-adjustment state identifier of the second cache line is the largest state identifier.
  • the largest state identifier can be adjusted to the smallest state identifier, that is, the second cache line (that is, cache line2) is adjusted from “3" to "0", and the state flags of other cache lines are increased by 1, that is, the state flag of cache line0 is adjusted from “1” to "2", cache line1
  • the status flag of cache line3 is adjusted from “2” to "3”
  • the state flag of cache line3 is adjusted from "0" to "1".
  • the corresponding status identifiers of multiple cache lines can be updated from "2, 3, 0, 1" to "0, 3, 1, 2" based on the data C to be accessed. , thereby effectively realizing the update operation of the corresponding state identifiers of multiple cache lines, and ensuring the accuracy and reliability of updating the state identifiers.
  • the pre-adjustment state identifier of the second cache line is obtained by obtaining the pre-adjustment state identifier of the second cache line.
  • the identification is the maximum status identification
  • the maximum status identification is adjusted to the minimum status identification, and the status identifications of other cache lines are increased by 1, thereby effectively realizing the accurate and effective update operation of the status identifications of other cache lines. This further ensures the stability and reliability of the method of accessing the cache line.
  • updating the state identifiers of other cache lines may also include:
  • Step S1103 When the pre-adjustment state identifier of the second cache line is smaller than the maximum state identifier, for the cache line whose state identifier is greater than the pre-adjustment state identifier, the state identifier of the cache line is kept unchanged.
  • Step S1104 For a cache line whose state identifier is smaller than the state identifier before adjustment, add 1 to the state identifier of the cache line.
  • multiple cache lines include cache line 0, cache line 1, cache line 2 and cache line 3.
  • Cache line 0 stores data E
  • cache line 1 stores data C
  • cache line 2 stores data B
  • cache line 3 Data A is stored
  • the statuses corresponding to cache line0, cache line1, cache line2, and cache line3 are identified as C0, C1, C2, and C3.
  • Table 9 the strategy for updating data and identifiers in multiple cache lines is shown in Table 9 below:
  • the data to be accessed is C
  • the data to be accessed C is stored in the cache line1
  • the status identifiers corresponding to multiple cache lines can be updated.
  • the second cache line ie, cache line1
  • the pre-adjustment status ID of the second cache line is “1” at this time. After the pre-adjustment status ID is obtained, it can be identified whether the status ID of the second cache line is the maximum status ID.
  • the first group of cache lines is the cache line (cache line2, cache line3) whose state identifier is greater than the state identifier before adjustment.
  • the group cache line is the cache line (cache line0) whose status ID is smaller than the status ID before adjustment.
  • the status flag of the cache line is incremented by 1, that is, the status flag of the cache line0 is adjusted from "0" to "1". It should be noted that at this time, the flag of the second cache line is adjusted from "1" to the minimum state flag "0".
  • the data to be accessed is B
  • the data to be accessed B is stored in the cache line2
  • the status identifiers corresponding to multiple cache lines can be updated.
  • a second cache line ie, cache line2
  • the pre-adjustment state identifier of the second cache line is the cache line that stores the data B to be accessed. At this time, the pre-adjustment state identifier of the second cache line is "2", and the pre-adjustment state identifier is smaller than the maximum state identifier.
  • the status ID of the cache line can be kept unchanged, that is, the ID of cache line 3 is kept as 3; for the status ID smaller than the pre-adjustment status ID If there is a cache line, the state flag of the cache line is increased by 1, that is, the state flag of cache line0 is adjusted from “1” to "2", and the state flag of cache line1 is adjusted from "0" to "1". It should be noted that at this time, the state flag of the second cache line is adjusted from "2" to the minimum state flag "0".
  • the corresponding state identifiers of multiple cache lines can be updated from "2, 1, 0, 3" to "0, 2, 1, 3" based on the data to be accessed E. , thereby effectively realizing the update operation of the corresponding state identifiers of multiple cache lines, and ensuring the accuracy and reliability of updating the state identifiers.
  • the set state identifier is the minimum state identifier, that is, there is a positive correlation between the size of the state identifier and the storage duration
  • the pre-adjustment state identifier of the second cache line is smaller than the maximum state identifier
  • the state identifier greater than For the cache line with the status mark before adjustment, keep the status mark of the cache line unchanged; for the cache line whose status mark is smaller than the status mark before adjustment, add 1 to the status mark of the cache line respectively, thus effectively realizing that the cache line can be used for other caches.
  • the state identifier of the line is updated accurately and effectively, which further ensures the stability and reliability of the method of accessing the cache line.
  • FIG. 12 is a schematic flowchart of another method for accessing a cache line provided by an embodiment of the present invention. with reference to FIG. 12 , this embodiment provides another method for accessing a cache line, and the execution body of the method is A device for accessing a cache line, the device can be implemented as software, or a combination of software and hardware. Specifically, the method for accessing a cache line can include the following steps:
  • Step S1201 Acquire data to be accessed.
  • Step S1202 Determine the state identifiers corresponding to each of the multiple cache lines.
  • the state identifier is used to identify the storage duration of the data in the cache line, and the number of bits of the binary number corresponding to the state identifier is related to the number of the multiple cache lines.
  • Step S1203 Process the data to be accessed based on the state identifier, and update the state identifiers corresponding to each of the multiple cache lines.
  • Step S1201 Acquire data to be accessed.
  • the data to be accessed refers to the data that needs to be read from the memory, or it can also refer to the data that needs to be written into the memory.
  • the specific implementation process and implementation effect of obtaining the data to be accessed in this embodiment are the same as The specific implementation process and implementation effect of the foregoing step S501 are similar. For details, reference may be made to the foregoing statement content, which will not be repeated here.
  • Step S1202 Determine the state identifiers corresponding to each of the multiple cache lines.
  • the state identifier is used to identify the storage duration of the data in the cache line, and the number of bits of the binary number corresponding to the state identifier is related to the number of the multiple cache lines.
  • an initial state identifier used to identify the storage duration of data in the cache line is preconfigured for multiple cache lines.
  • the configured initial state identifier can be updated, so that the updated state identifier can be obtained.
  • the state identifiers are used to identify How long to store data in the cache line. Specifically, this embodiment does not limit the specific way of determining the status identifiers corresponding to the multiple cache lines. Those skilled in the art can set them according to specific application scenarios and application requirements.
  • the state identifier can be stored in a preset area, and the state identifier corresponding to each of the multiple cache lines can be obtained by accessing the preset area.
  • state identifiers corresponding to the multiple cache lines determined above may be pre-configured initial state identifiers, or may also be state identifiers obtained after updating the initial state identifiers.
  • the number of multiple cache lines is N
  • the number of bits of the binary number corresponding to the status flag is log 2 (N).
  • Step S1203 Process the data to be accessed based on the state identifier, and update the state identifiers corresponding to each of the multiple cache lines.
  • the data to be accessed may be processed based on the state identifier.
  • the processing of the data to be accessed based on the state identifier may include: when the data to be accessed is not stored in multiple cache lines, The first cache line is determined in each cache line, and the storage duration of the data in the first cache line is longer than the storage duration of the data in other cache lines; the data in the first cache line is updated to the data to be accessed.
  • the method in this embodiment may further include: when storing the data to be accessed in multiple cache lines, determining a second cache line that stores the data to be accessed; updating the state identifiers of other cache lines, and updating The state identifier of the second cache line is updated to a set state identifier, wherein the set state identifier is used to identify that the storage duration of data in the second cache line is shorter than the storage duration of data in other cache lines.
  • the set state identifier includes any one of the following: the largest state identifier among the state identifiers corresponding to each of the multiple cache lines, and the smallest state identifier among the state identifiers corresponding to each of the multiple cache lines.
  • updating the state identifiers of other cache lines may include: acquiring the pre-adjustment state identifier of the second cache line; for cache lines whose state identifier is smaller than the pre-adjustment state identifier , the status ID of the cache line remains unchanged; for the cache line whose status ID is greater than the status ID before adjustment, the status ID of the cache line is decremented by 1.
  • updating the state identifiers of other cache lines may include: acquiring the pre-adjustment state identifiers of the second cache line; obtaining the pre-adjustment state identifiers of the second cache line When it is the largest state flag, adjust the largest state flag to the smallest state flag, and add 1 to the state flags of other cache lines.
  • updating the state identifiers of other cache lines may include: when the pre-adjustment state identifiers of the second cache line are smaller than the maximum state identifiers, for cache lines whose state identifiers are greater than the pre-adjustment state identifiers, keeping the cache line The status ID of the line remains unchanged; for the cache line whose status ID is smaller than the status ID before adjustment, the status ID of the cache line is incremented by 1.
  • updating the state identifiers corresponding to each of the multiple cache lines may include: when there is a positive correlation between the size of the state identifier and the storage duration, setting the state identifier of the first cache line to zero, and setting the state identifiers of the multiple cache lines to zero.
  • the state flags corresponding to other cache lines in the cache line are increased by one; when there is a negative correlation between the size of the state flag and the storage duration, the state flag of the first cache line is configured as the maximum state flag, and multiple caches
  • the state flags corresponding to other cache lines in the line are decremented by one.
  • this application embodiment provides a method for accessing a cache system composed of N-way cache lines, which not only realizes the timely and It can be updated effectively, and a globally optimal LRU replacement strategy can be realized through the configured N log 2 (N) bits of state identifiers (the record value can be 0 to N-1). Specifically, the method includes the following steps:
  • Step 1 Obtain N log 2 (N) bits of state identifier values for configuring N-way cache lines, so that each cache line corresponds to a state identifier value, and each cache line corresponds to a state identifier Values do not repeat, there is only one.
  • Step 2 Initialize the state identifier values into the N state identifiers corresponding to the N-way cache lines, respectively.
  • the mapping method may be sequential mapping, that is, lru_weight[0 to N-1] is N log 2 (N )bit's status flag value.
  • N log 2
  • the state identifier values corresponding to the above N cache lines can be 0 to N-1; referring to FIG. 13, w0 -w3 can be the status flag value of lru_weight[0-3] respectively.
  • w0-w3 are: 1-3 respectively, it is realized that 4 cache lines are identified by 4 2-bit binary status flag values.
  • the data realization level can be realized in the following ways:
  • Step 3 Obtain access data, and update the data and status identifiers in the N cache lines based on the access data.
  • the access data is A
  • the cache line is hit, and then the number way_id of the hit cache line can be obtained; if the access data A is not stored in the N cache lines, no access data A is stored in the N cache lines. If the cache line is hit, the number way_id of the corresponding replaced cache line can be obtained.
  • the status flag lru_weight[way_id] corresponding to the above cache line can be obtained, and then the size relationship between each state flag value and lru_weight[way_id] is compared respectively. If it is less than lru_weight [way_id], then add 1 to the state flag value corresponding to the cache line, and set lru_weight[way_id] to 0. At this time, the above state value "0" is used to identify the latest data stored in the cache line, "N -1" is used to identify the oldest data stored in the cache line.
  • the data implementation level can be implemented in the following ways:
  • Step 4 When the access data does not hit the cache line, you can select the cache line corresponding to N-1 in the lru_weight, which is recorded as rpl_way_id.
  • the data implementation level can be implemented in the following ways:
  • each access will update the status flag value according to the above logic, and the next replacement can be obtained based on the status flag value. Based on the following table, it can be determined that the data replacement result obtained in this embodiment is the globally optimal LRU replacement result.
  • the access data A can be stored in the cache line 0, and the state identifier value corresponding to the cache line is set by "3" is updated to "0".
  • the corresponding status flag value is updated from “1” to "2".
  • the access data operation at this time hits the cache line, and the state identifier value corresponding to the cache line can be updated based on the above-mentioned access data A Operation, specifically, you can update the status ID value in cache line0 from “3" to "0", and add 1 to the status ID value of other cache lines, that is, update the status ID value in cache line1 from “2” to “3", update the status flag value in cache line2 from “1” to "2”, and update the state flag value in cache line3 from "0" to "1".
  • the target cache line for storing the access data E can be obtained.
  • the line can be the cache line1 corresponding to the state identifier value of "3”, and then the access data E can be stored in the cache line1, and the state identifier value of the cache line can be updated.
  • the state identifier value is updated from “3" to "0”, and the state identifier value corresponding to other cache lines is increased by 1, that is, the state identifier value corresponding to cache line0 is updated from "0" to "1”, and the state identifier value corresponding to cache line2 is updated.
  • the corresponding state identification value is updated from “2” to "3", and the state identification value corresponding to cache line 3 is updated from "1" to "2", thus effectively realizing the access data and the state identification value of the cache line. update operation.
  • the state identifier value of the cache line can be updated based on the access data C, that is, the state identifier value corresponding to the 4-way cache line can be changed from “1", “0", “3", “2” are updated to “2", “1", “0”, “3”.
  • the cache line can be updated based on the access data F, and the state identifier value of the cache line can be updated, that is, the state identifier value corresponding to the 4-way cache line can be changed from “2", “1", “0", “3” are updated to “3", “2", “1", “0".
  • the method for accessing a cache line provided by this application embodiment effectively realizes that when there is data to be accessed that needs to be analyzed and processed, the data storage duration can be stored in multiple cache lines based on the state identifier of the cache line.
  • the largest cache line is used as the first cache line for processing the data to be accessed, and then the data in the first cache line can be updated to the data to be accessed. This is achieved by using N log 2 (N) bits of status bits.
  • the globally optimal LRU replacement strategy consumes less logic resources, and the status bit update and search can be operated in parallel, with high speed, which is conducive to the timely replacement and update of the data in the cache line, and this implementation is designed Simple, low power consumption, and good timing, which effectively ensures the practicability of the method for accessing the cache line, which is beneficial to the promotion and application of the market.
  • FIG. 14 is a schematic structural diagram of an apparatus for accessing a cache line provided by an embodiment of the present invention; with reference to FIG. 14 , this embodiment provides an apparatus for accessing a cache line, which is used to execute the above-mentioned FIG. 5 The method shown to access the cache line cache line.
  • the device may include:
  • a first memory 12 for storing computer programs
  • the first processor 11 is used for running the computer program stored in the first memory 12 to realize:
  • the respective state identifiers corresponding to the multiple cache lines are obtained, wherein the number of bits of the binary number corresponding to the state identifier and the number of the multiple cache lines related;
  • the first cache line is determined among the multiple cache lines, and the storage duration of the data stored in the first cache line is longer than the storage duration of the data stored in other cache lines;
  • the first processor 11 is further configured to execute all or part of the steps in at least some of the embodiments shown in FIG. 5 to FIG. 11 and FIG. 13 .
  • the structure of the electronic device may further include a first communication interface 13 for the electronic device to communicate with other devices or a communication network.
  • the first processor 11 before acquiring the state identifiers corresponding to each of the multiple cache lines, is further configured to: acquire quantity information corresponding to the multiple cache lines; configure initial state identifiers for the multiple cache lines based on the quantity information , different cache lines correspond to different initial state identifiers.
  • the first processor 11 when the first processor 11 configures initial state identifiers for multiple cache lines based on the quantity information, the first processor 11 is configured to: determine, based on the quantity information, consecutive initial states corresponding to the multiple cache lines Identifier; maps initial state identifiers to multiple cache lines.
  • the first processor 11 determines continuous initial state identifiers corresponding to multiple cache lines based on the quantity information
  • the first processor 11 is configured to: sort the multiple cache lines based on the quantity information, Obtain the sequence of multiple cache lines; in the sequence of multiple cache lines, determine the sequence number information corresponding to the cache line as the continuous initial state identifier corresponding to the cache line.
  • the first processor 11 is configured to: obtain data access requests for the multiple cache lines; correspond to each of the multiple cache lines based on the data access requests The initial state identifier of the cache line is updated to obtain the corresponding state identifiers of multiple cache lines.
  • the first processor 11 determines the first cache line among the multiple cache lines based on the respective state identifiers of the multiple cache lines
  • the first processor 11 is configured to: based on the respective corresponding state identifiers of the multiple cache lines determine the corresponding storage duration of the stored data in multiple cache lines; based on the storage duration, determine the first cache line among multiple cache lines.
  • the first processor 11 after updating the stored data in the first cache line to the data to be accessed, is configured to: update the state identifiers corresponding to each of the multiple cache lines.
  • the first processor 11 when the first processor 11 updates the state identifiers corresponding to the multiple cache lines, the first processor 11 is configured to: when there is a positive correlation between the size of the state identifier and the storage duration, update the first processor 11 The state identification information of the cache line is set to zero, and the corresponding state identifications of other cache lines in multiple cache lines are increased by one; when the size of the state identification and the storage duration are negatively correlated, the first cache line The status ID is configured as the maximum status ID, and the status IDs corresponding to other cache lines in multiple cache lines are decremented by one.
  • the first processor 11 is configured to: when storing data to be accessed in multiple cache lines, determine a second cache line that stores the data to be accessed; update the state identifiers of other cache lines, and The state identifier of the second cache line is updated to a set state identifier, wherein the set state identifier is used to identify that the storage duration of data in the second cache line is shorter than the storage duration of data in other cache lines.
  • setting the state identifier includes any one of the following: the largest state identifier among the state identifiers corresponding to each of the multiple cache lines, and the smallest state identifier among the state identifiers corresponding to each of the multiple cache lines.
  • the first processor 11 when the state identifier is set as the maximum state identifier, when the first processor 11 updates the state identifiers of other cache lines, the first processor 11 is configured to: obtain the pre-adjustment state of the second cache line For the cache line whose status ID is smaller than the status ID before adjustment, keep the status ID of the cache line unchanged; for the cache line whose status ID is larger than the status ID before adjustment, decrease the status ID of the cache line by 1.
  • the first processor 11 when the state identifier is set as the minimum state identifier, when the first processor 11 updates the state identifiers of other cache lines, the first processor 11 is configured to: obtain the pre-adjustment state of the second cache line ID; when the pre-adjustment status ID of the second cache line is the maximum status ID, adjust the maximum status ID to the minimum status ID, and add 1 to the status IDs of other cache lines.
  • the first processor 11 when the processor updates the state identifiers of other cache lines, the first processor 11 is configured to: when the pre-adjustment state identifier of the second cache line is smaller than the maximum state identifier, the state identifier is greater than the pre-adjustment state identifier. For the cache line with the status mark, keep the status mark of the cache line unchanged; for the cache line whose status mark is smaller than the status mark before adjustment, add 1 to the status mark of the cache line.
  • the number of bits of the binary number corresponding to the state identifier is log 2 (N).
  • the device for accessing the cache line shown in FIG. 14 can execute the method of the embodiment shown in FIG. 5-FIG. 11 and FIG. 13 .
  • FIG. 5-FIG. 11 and FIG. 13 Relevant description of the embodiment shown.
  • the execution process and technical effects of the technical solution refer to the descriptions in the embodiments shown in FIG. 5 to FIG. 11 and FIG. 13 , which will not be repeated here.
  • an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by an electronic device, including a cache for executing at least some of the embodiments shown in FIG. 5 to FIG. 11 and FIG. 13 .
  • the program involved in the method of the line cache line is not limited to a computer storage medium.
  • FIG. 15 is a schematic structural diagram of another apparatus for accessing a cache line provided by an embodiment of the present invention. with reference to FIG. 15 , this embodiment provides another apparatus for accessing a cache line, which is used to execute the above The method of accessing the cache line shown in Figure 12.
  • the device may include:
  • the second processor 21 is used for running the computer program stored in the second memory 22 to realize:
  • the state identifier is used to identify the storage duration of the data stored in the cache line, and the number of bits of the binary number corresponding to the state identifier is related to the number of the multiple cache lines;
  • the data to be accessed is processed based on the state identifier, and the corresponding state identifiers of multiple cache lines are updated.
  • the second processor 21 is further configured to execute all or part of the steps in at least some of the embodiments shown in FIG. 12 to FIG. 13 .
  • the structure of the electronic device may further include a second communication interface 23 for the electronic device to communicate with other devices or a communication network.
  • the second processor 21 when the second processor 21 processes the data to be accessed based on the state identifier, the second processor 21 is configured to: when the data to be accessed is not stored in the multiple cache lines, in the multiple cache lines Determine the first cache line, the storage duration of the data in the first cache line is longer than the storage duration of the data in other cache lines; update the data in the first cache line to the data to be accessed.
  • the second processor 21 is further configured to: when storing the data to be accessed in multiple cache lines, determine the second cache line that stores the data to be accessed; update the state identifiers of other cache lines, The state identifier of the second cache line is updated to a set state identifier, wherein the set state identifier is used to identify that the storage duration of data in the second cache line is shorter than the storage duration of data in other cache lines.
  • setting the state identifier includes any one of the following: the largest state identifier among the state identifiers corresponding to each of the multiple cache lines, and the smallest state identifier among the state identifiers corresponding to each of the multiple cache lines.
  • the second processor 21 when the state identifier is set to be the maximum state identifier, when the second processor 21 updates the state identifiers of other cache lines, the second processor 21 is configured to: obtain the pre-adjustment state of the second cache line For the cache line whose status ID is smaller than the status ID before adjustment, keep the status ID of the cache line unchanged; for the cache line whose status ID is larger than the status ID before adjustment, decrease the status ID of the cache line by 1.
  • the second processor 21 when the state flag is set to be the minimum state flag, when the second processor 21 updates the state flags of other cache lines, the second processor 21 is configured to: obtain the pre-adjustment state of the second cache line ID; when the pre-adjustment status ID of the second cache line is the maximum status ID, adjust the maximum status ID to the minimum status ID, and add 1 to the status IDs of other cache lines.
  • the second processor 21 when the second processor 21 updates the state identifiers of other cache lines, the second processor 21 is configured to: when the pre-adjustment state identifiers of the second cache line are smaller than the maximum state identifiers, then for the state identifiers If the cache line is larger than the state flag before adjustment, keep the state flag of the cache line unchanged; for the cache line whose state flag is smaller than the state flag before adjustment, the state flag of the cache line is incremented by 1.
  • the second processor 21 when the second processor 21 updates the state flags corresponding to each of the multiple cache lines, the second processor 21 is configured to: when there is a positive correlation between the size of the state flag and the storage duration, update the first The state flag of the cache line is set to zero, and the corresponding state flags of other cache lines in multiple cache lines are added by one; when the size of the state flag is negatively correlated with the storage duration, the state of the first cache line is set to The ID is configured as the maximum status ID, and the status IDs corresponding to other cache lines in multiple cache lines are decremented by one.
  • the number of bits of the binary number corresponding to the state identifier is log 2 (N).
  • the device for accessing a cache line shown in FIG. 15 can execute the method of the embodiment shown in FIG. 12-FIG. 13.
  • FIG. 12-FIG. 13. related instructions.
  • the execution process and technical effect of the technical solution refer to the descriptions in the embodiments shown in FIG. 12 to FIG. 13 , which will not be repeated here.
  • an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by an electronic device, which includes a cache line for accessing a cache line in at least some of the embodiments shown in FIG. 12 to FIG. 13 .
  • the procedures involved in the method are not limited to the procedures involved in the method.
  • the disclosed related detection apparatus and method may be implemented in other manners.
  • the embodiments of the detection apparatus described above are only illustrative.
  • the division of the modules or units is only a logical function division.
  • Another point, the mutual coupling or direct coupling or communication connection shown or discussed may be through some interfaces, and the indirect coupling or communication connection of detection devices or units may be in electrical, mechanical or other forms.
  • the units described as separate components may or may not be physically separated, and components displayed as units may or may not be physical units, that is, may be located in one place, or may be distributed to multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution in this embodiment.
  • each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically alone, or two or more units may be integrated into one unit.
  • the above-mentioned integrated units may be implemented in the form of hardware, or may be implemented in the form of software functional units.
  • the integrated unit if implemented in the form of a software functional unit and sold or used as an independent product, may be stored in a computer-readable storage medium.
  • the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium , including several instructions for causing a computer processor (processor) to perform all or part of the steps of the methods described in the various embodiments of the present invention.
  • the aforementioned storage medium includes: U disk, mobile hard disk, Read-Only Memory (ROM, Read-Only Memory), Random Access Memory (RAM, Random Access Memory), magnetic disk or optical disk and other media that can store program codes.

Landscapes

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

Abstract

一种访问缓存行的方法和装置。方法包括:获取待访问数据;在多个缓存行中未存储待访问数据时,则获取多个缓存行各自对应的状态标识,状态标识所对应的二进制数的位数与多个缓存行的数量相关;基于多个缓存行各自对应的状态标识,在多个缓存行中确定第一缓存行,第一缓存行中数据的存储时长大于其他缓存行中数据的存储时长,将第一缓存行中的数据更新为待访问数据。本实施例有效地实现了在获取到待访问数据和状态标识之后,可以基于状态标识进行数据的替换和更新操作。

Description

访问缓存行的方法和装置 技术领域
本发明实施例涉及数据访问技术领域,尤其涉及一种访问缓存行的方法和装置。
背景技术
Cache是介于中央处理器CPU与主存储器、或者主存储器与磁盘之间的高速缓冲存储器,其主要用于解决系统中数据读写速度不匹配的问题。Cache缓存着程序运行过程使用到的数据,通常数据存储在片上缓存单元,在将数据存储在片上缓存单元时,可以以缓存行(cache line)为单位进行数据交换,而后可以使用对应数据标志位记录数据的地址信息,状态位记录对应Cache缓存单元的使用情况。这样根据数据标志位就可以知道缓存的命中情况,如果命中,就可以从Cache中读取数据,如果没有命中,则可以从主存中读取对应的数据,然后根据一定的替换策略进行缓存替换,以提高数据的重复利用率。
由于替换策略能够直接影响Cache系统的性能,其中,最近最少使用算法(Least Recently Used,简称LRU)作为替换策略,因为其具有时间的局部性,在计算机程序运行过程中可以取得比较好的缓存命中,因此,LRU替换策略的应用较为普遍。然而,现有技术中的LRU替换策略存在逻辑资源消耗较多,并且,所确定的替换结果不是全局最优的结果,而是局部最优的结果,从而影响了数据替换的质量和效果。
发明内容
本发明实施例提供了一种访问缓存行的方法和装置,可以解决现有技术中存在的逻辑资源消耗较多,所确定的替换结果不是全局最优的结果,而是局部最优的结果,从而影响了数据替换的质量和效果的问题。
本发明的第一方面是为了提供一种访问缓存行的方法,包括:
获取待访问数据;
在多个缓存行中未存储所述待访问数据时,则获取多个缓存行各自对应 的状态标识,其中,所述状态标识所对应的二进制数的位数与所述多个缓存行的数量相关;
基于所述多个缓存行各自对应的状态标识,在所述多个缓存行中确定第一缓存行,所述第一缓存行中数据的存储时长大于其他缓存行中数据的存储时长;
将所述第一缓存行中的数据更新为所述待访问数据。
本发明的第二方面是为了提供一种访问缓存行的方法,包括:
获取待访问数据;
确定多个缓存行各自对应的状态标识,所述状态标识用于标识缓存行中数据的存储时长,且所述状态标识所对应的二进制数的位数与所述多个缓存行的数量相关;
基于所述状态标识对所述待访问数据进行处理,并对所述多个缓存行各自对应的状态标识进行更新。
本发明的第三方面是为了提供一种访问缓存行的装置,包括:
存储器,用于存储计算机程序;
处理器,用于运行所述存储器中存储的计算机程序以实现:
获取待访问数据;
在多个缓存行中未存储所述待访问数据时,则获取多个缓存行各自对应的状态标识,其中,所述状态标识所对应的二进制数的位数与所述多个缓存行的数量相关;
基于所述多个缓存行各自对应的状态标识,在所述多个缓存行中确定第一缓存行,所述第一缓存行中存储数据的存储时长大于其他缓存行中存储数据的存储时长;
将所述第一缓存行中的存储数据更新为所述待访问数据。
本发明的第四方面是为了提供一种访问缓存行的装置,包括:
存储器,用于存储计算机程序;
处理器,用于运行所述存储器中存储的计算机程序以实现:
获取待访问数据;
确定多个缓存行各自对应的状态标识,所述状态标识用于标识缓存行中存储数据的存储时长,且所述状态标识所对应的二进制数的位数与所述多个缓存行的数量相关;
基于所述状态标识对所述待访问数据进行处理,并对所述多个缓存行各自对应的状态标识进行更新。
本发明的第五方面是为了提供一种计算机可读存储介质,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于第一方面所述的访问缓存行的方法。
本发明的第六方面是为了提供一种计算机可读存储介质,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于第二方面所述的访问缓存行的方法。
本发明实施例提供的技术方案,通过获取待访问数据,在多个缓存行中未存储所述待访问数据时,则获取多个缓存行各自对应的状态标识;而后基于所述多个缓存行各自对应的状态标识,在所述多个缓存行中确定第一缓存行,并将所述第一缓存行中的数据更新为所述待访问数据,有效地实现了当获取到需要进行分析处理的待访问数据时,则可以基于缓存行的状态标识,在多个缓存行中,将数据存储时长最大的缓存行作为用于对待访问数据进行处理的第一缓存行,而后可以将第一缓存行中的数据更新为待访问数据,这样可以对缓存行中的数据进行及时的替换和更新操作,并且这种实现方式设计简单、功耗小、时序性好,所确定的第一缓存行为全局最优的结果,进而有效地保证了访问缓存行的方法的实用性,有利于市场的推广与应用。
附图说明
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:
图1为相关技术提供的主存与cache的映射关系示意图;
图2为相关技术提供的缓存替换过程的示意图;
图3为相关技术提供的基于计数器所实现的LRU替换过程的示意图;
图4为相关技术提供的基于二叉树替换过程的示意图;
图5为本发明实施例提供的一种访问缓存行的方法的流程示意图;
图6为本发明实施例提供的另一种访问缓存行的方法的流程示意图;
图7为本发明实施例提供的又一种访问缓存行的方法的流程示意图;
图8为本发明实施例提供的基于所述多个缓存行各自对应的状态标识,在 所述多个缓存行中确定第一缓存行的流程示意图;
图9为本发明实施例提供的又一种访问缓存行的方法的流程示意图;
图10为本发明实施例提供的对其他缓存行的状态标识进行更新的流程示意图一;
图11为本发明实施例提供的对其他缓存行的状态标识进行更新的流程示意图二;
图12为本发明实施例提供的又一种访问缓存行的方法的流程示意图;
图13为本发明应用实施例提供的一种访问缓存行的方法的原理示意图;
图14为本发明实施例提供的一种访问缓存行的装置的结构示意图;
图15为本发明实施例提供的另一种访问缓存行的装置的结构示意图。
具体实施方式
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例中的附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例是本发明一部分实施例,而不是全部的实施例。基于本发明中的实施例,本领域普通技术人员在没有做出创造性劳动前提下所获得的所有其他实施例,都属于本发明保护的范围。
除非另有定义,本文所使用的所有的技术和科学术语与属于本发明的技术领域的技术人员通常理解的含义相同。本文中在本发明的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本发明。
为了能够理解本实施例中技术方案的具体实现过程,首先对相关技术进行相关说明:
Cache是介于中央处理器CPU与主存储器、或者主存储器与磁盘之间的高速缓冲存储器,其主要用于解决系统中数据读写速度不匹配的问题。在计算机领域,由于计算机程序运行的过程中,数据具有时间和空间的局部性,通过Cache少部分的片上缓存空间映射到主存DDR更大的空间,可以提高数据的重复利用率,减少系统的带宽,如图1所示,提供了一种直接映射的Cache与主存的映射关系。
在数据处理的过程中,Cache缓存着程序运行过程使用到的数据,通常数据存储在片上缓存单元,而后可以使用数据标志位“Tag”记录数据的地址信息,数据状态位记录对应Cache缓存单元的使用情况。这样根据Tag信息就可 以知道缓存单元的命中情况,如果命中,就可以从Cache中读取数据;如果未命中,则可以从主存中读取对应的数据,然后根据一定的替换策略对Cache中的缓存数据进行替换,以提高数据的重复利用率。
在对缓存数据进行替换操作时,替换算法的性能直接影响了Cache系统的性能,常见的替换算法包括:随机算法、先进先出和最近最少使用算法(Least Recently Used,简称LRU)等等,其中,LRU替换策略因为其具有时间的局部性,在计算机程序运行过程中可以取得比较好的缓存命中,因此,LRU替换策略的应用较为普遍。下面对常见的几种LRU替换策略的实现方式进行简单说明:
实现方式一:链表实现的LRU替换策略
其中,链表实现的LRU替换方式是通过维护一个链表来记录或者保存数据的访问情况,新的数据对应的标签信息插入到链表表头;具体的,如图2所示,每当缓存命中时(即缓存的数据被访问),则将标签信息移到链表头部;当缓存已满且未命中时,则新来的数据替换表尾对应的数据。通过这样的替换方式就可以实现在链表中表头对应的是最近访问过的数据,表尾是距离上一次访问时间最长的数据。
承接上述陈述内容可知,在一个4路(cache一组能容纳的缓存行cache line数)cache系统中,需要维护一个长度为4的单链表,替换过程涉及链表节点的删除和插入操作,并且上述替换操作为串行操作,因此,上述通过链表实现的LRU替换策略的速度较慢,不适合在专用集成电路(Application Specific Integrated Circuit,简称ASIC)或者现场可编程逻辑门阵列(Field Programmable Gate Array,简称FPGA)FPGA中实现。
实现方式二:计数器实现的LRU替换策略
在FPGA或者ASIC中,可以采用计数器的方式实现cache LRU替换策略,在一个N路的cache系统中,需要维护N个计数器,具体的,如图3所示,初始化N个计数器全为最大值;新的数据或者访问命中的cache line对应的计数器置0,其他计数器累加1,计满保持;当缓存已满且未命中时,则替换N个计数器数值最大所对应的cache line。
计数器维护可以并行操作且设计简单,因此解决了链表操作不适合在硬件实现的问题,但是也存在以下问题:
(1)计数器计满就失去了LRU的特性(多个计数器计满则无法区分数据的访问先后关系),所以通常计数器的位宽较大,保证一段时间内的访问不会导 致计数器计满,例如:16bit位宽最差可以保证65535次访问不溢出。
(2)每次发生数据访问时,所有的计数器都需要更新,在ASIC或者FPGA中的功耗较大。
(3)在Cache line的数量和计数器的位宽较大时,查找最大的逻辑时序较差,会成为提升系统运行时钟的瓶颈。
实现方式三:二叉树实现的LRU替换策略
对于一个N路cache系统而言,可以使用N-1bit来表示需要替换的cache line,以一个4路cache为例,如图4所示,提供了一个N-1bit描述的二叉树,在对应节点为0时,则表示替换的cache line在节点左边,在对应节点为1时,则表示替换的cache line在节点右边。在cache未满时,优先替换空的cache line;在cache已满时,则可以选择二叉树所指向的cache line;而后可以根据访问的cache line在节点的左边或者右边,将节点对应的bit数据更新为0或者1,未经过的节点可以保持原值,具体的,状态转移规则如表1所示:
表1
Figure PCTCN2021090189-appb-000001
对于一个N路cache系统而言,上述实现方式只需要维护一个N-1bit所表示的二叉树,转移规则也比较简单固定,在ASIC或者FPGA中具有功耗小,更新快,可以实现比较高的系统时钟。
但是,上述实现方式是每次更新访问过的二叉树节点,保留未访问过的节点,且仅用1bit来表示左或者右,每个节点都是一个局部最优的选择,不能包含所有底部叶子节点的信息,多个节点串联之后,并不是全局最优的选择,在某些情况下,会做出错误的替换决策,因此是LRU的近似表示,又称伪最近最少使用替换算法(Pseudo LRU,简称PLRU)。
下面参考表2和表3所示,以一个4路cache系统为例来对PLRU与LRU进行说明,现在有一个数据的访问系列为ABCDAECF,初始化二叉树为(0,0,0),在访问序列5时,PLRU实现的不是全局最优的替换策略,是一个次优的选择,这样 会导致在访问系列6的新数据进来时,替换了一个次优数据C,如果在访问系列7要访问C时,则会发生缓存未命中的情况,需要重新读取C数据,并更新到缓存中(因为程序运行过程中数据具有时间空间的局部性,因此访问序列7访问的数据是C的发生概率通常大于B或者是C之前的数据),当缓存未命中的代价较大时,LRU的性能优于PLRU的趋势更明显,并且二叉树实现的替换策略要求cache line数量必须满足2的次幂,如:2、4、8、16、32等,类似cache line为12时无法使用。
表2:PLRU的替换策略实现
Figure PCTCN2021090189-appb-000002
表3:LRU的替换策略实现
Figure PCTCN2021090189-appb-000003
总结来说,相关技术存在以下缺陷:
(1)链表实现的LRU替换策略实现复杂,且为串行操作,不适合在ASIC或者FPGA中实现。
(2)计数器实现的LRU替换策略,计数器位宽较大,每次访问所有的计 数器都需要更新,且最大值查找逻辑在ASIC或者FPGA中的时序较差。
(3)二叉树具有设计简单、功耗小、时序性能好等特点,但实现的是一种伪最近最少使用策略,其具体实现的是一种局部最优而不是全局最优的结果,且cache line数量必须为2 K,其中,k为整数,且k>0。
为了解决上述技术问题,本实施例提供了一种访问缓存行cache line的方法和装置,其中,访问缓存行cache line的方法通过获取待访问数据,在多个缓存行cache line中未存储所述待访问数据时,则获取多个cache line各自对应的状态标识;而后基于所述多个cache line各自对应的状态标识,在所述多个cache line中确定第一cache line,并将所述第一cache line中的数据更新为所述待访问数据,有效地实现了当获取到需要进行分析处理的待访问数据时,则可以基于cache line的状态标识,在多个cache line中,将数据存储时长最大的cache line作为用于对待访问数据进行处理的第一cache line,而后可以将第一cache line中的数据更新为待访问数据,这样有效地实现了可以对cache line中的数据进行及时的替换和更新操作,并且这种实现方式设计简单、功耗小、时序性好,所确定的第一cache line为全局最优的结果,这样有效地保证了访问缓存行cache line的方法的实用性,有利于市场的推广与应用。
下面结合附图,对本发明中一种访问缓存行cache line的方法和装置的一些实施方式作详细说明。在各实施例之间不冲突的情况下,下述的实施例及实施例中的特征可以相互组合。
图5为本发明实施例提供的一种访问缓存行的方法的流程示意图;参考附图5所示,本实施例提供了一种访问缓存行cache line的方法,该方法的执行主体为访问缓存行cache line的装置,该装置可以实现为软件、或者软件和硬件的组合,具体的,该访问缓存行cache line的方法可以包括以下步骤:
步骤S501:获取待访问数据。
步骤S502:在多个缓存行cache line中未存储待访问数据时,则获取多个cache line各自对应的状态标识,其中,状态标识所对应的二进制数的位数与所述多个cache line的数量相关。
步骤S503:基于多个cache line各自对应的状态标识,在多个cache line中确定第一cache line,第一cache line中数据的存储时长大于其他cache line中数据的存储时长。
步骤S504:将第一cache line中的数据更新为待访问数据。
下面对上述各个步骤的具体实现过程和实现效果进行详细说明:
步骤S501:获取待访问数据。
其中,待访问数据是指需要从内存中读取的数据,或者,也可以是指需要写入到内存中的数据。具体的,在用户存在读写需求时,则可以对访问缓存行cache line的装置执行相应操作,从而可以使得访问缓存行cache line的装置直接获取到待访问数据;或者,在用户存在读写需求时,则可以对客户端执行相应操作,从而使得客户端可以生成读写需求以及与读写需求相对应的待访问数据,在客户端获取到待访问数据之后,可以将待访问数据发送至访问缓存行cache line的装置,从而使得访问缓存行cache line的装置获取到待访问数据。
当然的,本领域技术人员还可以采用其他的方式来获取待访问数据,只要能够保证对待访问数据进行获取的准确可靠性即可,在此不再赘述。
步骤S502:在多个缓存行cache line中未存储待访问数据时,则获取多个cache line各自对应的状态标识,其中,状态标识所对应的二进制数的位数与所述多个cache line的数量相关。
其中,在获取到待访问数据之后,可以将多个cache line(即为缓存行)中所存储的数据与待访问数据进行分析比较,以识别待访问数据是否被存储在cache line中,具体的,在某一cache line中所存储的数据与待访问数据相同时,则确定待访问数据被存储在cache line中,在所有的cache line中所存储的数据与待访问数据不同时,则确定待访问数据未被存储在cache line中。
在确定多个缓存行cache line中未存储待访问数据时,此时,为了提高数据的重复利用率,则需要将待访问数据存储在cache line中,进而需要在多个cache line中确定一个用于存储待访问数据的第一cache line。而在利用多个cache line对数据进行处理时,为了能够使得用户及时了解到cache line中各自存储数据的时长特征,则可以对每个cache line配置状态标识,该状态标识用于标识cache line中存储数据的时长信息。此时,为了能够准确地确定出第一cache line,则可以获取多个cache line各自对应的状态标识,具体的,cache line各自对应的状态标识可以存储在预设区域中,通过访问预设区域即可获取cache line各自对应的状态标识。
另外,上述所获得的cache line所对应的状态标识可以由二进制数进行表示,此时,状态标识所对应的二进制数的位数与多个cache line的数量相关,在一些实例中,在多个cache line的数量为N时,状态标识所对应的二进制数的位数为log 2(N)。举例来说,在多个cache line的数量为4时,状态标识可以为上述4个cache line相对应的“1”、“2”、“3”和“4”,上述状态标识所对应的二进制数的位数为log 2(4)=2。在多个cache line的数量为8时,状态标识可以为上述4个cache line相对应的“1”、“2”、“3”、“4”、“5”、“6”、“7”及“8”,上述状态标识所对应的二进制数的位数为log 2(8)=3。相类似的,在多个cache line的数量为16时,状态标识所对应的二进制数的位数为log 2(16)=4。
步骤S503:基于多个cache line各自对应的状态标识,在多个cache line中确定第一cache line,第一cache line中数据的存储时长大于其他cache line中数据的存储时长。
在获取到多个cache line各自对应的状态标识之后,可以基于多个cache line各自对应的状态标识对多个cache line进行分析处理,以在多个cache line中确定第一cache line,其中,所确定的第一cache line中数据的存储时长大于其他cache line中数据的存储时长。
举例来说,多个cache line以及各自对应的状态标识分别为:cache line1-标识1、cache line2-标识2、cache line3-标识3和cache line4-标识4,假设标识1对应t1时刻,标识2对应t2时刻,标识3对应t3时刻,标识4对应t4时刻,在t1早于t2,t2早于t3,t3早于t4时,若获取到待访问数据、且上述的cache line未存储待访问数据时,则可以在上述的多个cache line中确定第一cache line,由于cache line1中存储数据的时长最长,因此,可以确定cache line1为第一cache line,从而有效地保证了对第一cache line进行确定的准确可靠性。
步骤S504:将第一cache line中的数据更新为待访问数据。
在获取到第一cache line和待访问数据之后,可以将第一cache line中的数据更新为待访问数据,从而有效地实现在cache line中未存储待访问数据时,可以及时有效地将待访问数据存储在数据存储时长最长的cache line中,从而有利于提高数据的重复利用率。
本实施例提供的访问缓存行cache line的方法,通过获取待访问数据, 在多个缓存行cache line中未存储待访问数据时,则获取多个cache line各自对应的状态标识;而后基于多个cache line各自对应的状态标识,在多个cache line中确定第一cache line,并将第一cache line中的数据更新为待访问数据,有效地实现了当存在需要进行分析处理的待访问数据时,则可以基于cache line的状态标识,在多个cache line中,将数据存储时长最大的cache line作为用于对待访问数据进行处理的第一cache line,而后可以将第一cache line中的数据更新为待访问数据,这样有效地实现了可以对cache line中的数据进行及时的替换和更新操作,实现方式设计简单、功耗小、时序性好,并且所确定的第一cache line为全局最优的结果,这样有效地保证了访问缓存行cache line的方法的实用性,有利于市场的推广与应用。
图6为本发明实施例提供的另一种访问缓存行的方法的流程示意图;参考附图6所示,为了能够保证访问缓存行cache line的方法的实用性,在获取多个cache line各自对应的状态标识之前,本实施例中的方法还可以包括:
步骤S601:获取多个cache line所对应的数量信息。
步骤S602:基于数量信息为多个cache line配置初始状态标识,不同cache line对应有不同的初始状态标识。
其中,在cache系统确定之后,则可以获得多个cache line所对应的数量信息,之后则可以基于数量信息为多个cache line配置初始状态标识,具体的,基于数量信息为多个cache line配置初始状态标识可以包括:基于数量信息,确定与多个cache line相对应的连续的初始状态标识;将初始状态标识映射至多个cache line。
在获取到数量信息之后,可以对数量信息进行分析处理,以确定与多个cache line相对应的连续的初始状态标识,而后可以将初始状态标识映射至多个cache line,从而有效地实现了为多个cache line配置相对应的初始状态标识,以便之后基于初始状态标识对多个cache line中的数据进行更新替换操作。
举例来说,在多个cache line的数量信息为4个时,则可以基于数量信息确定与多个cache line相对应的连续的初始状态标识,连续的初始状态标识可以为0、1、2和3,而后可以将连续的初始状态标识依次映射到4个cache line中。或者,连续的初始状态标识可以为1、2、3和4,而后可以将连续的初始状态标识依次映射到4个cache line中。或者,连续的初始状态标识可以为3、 4、5和6,而后可以将连续的初始状态标识依次映射到4个cache line中。
为了方便对多个cache line中的数据进行准确的更新操作,本实施例中的基于数量信息,确定与多个cache line相对应的连续的初始状态标识可以包括:基于数量信息对多个cache line进行排序,获取多个cache line的序列;在多个cache line的序列中,将与cache line相对应的序号信息确定为与cache line相对应的连续的初始状态标识。
举例来说,多个cache line分别为cache lineA、cache lineB、cache lineC和cache lineD,而后基于数量信息对上述多个cache line进行排序,从而可以获得多个cache line的排序序列,序列为cache lineA(序号为1)-cache lineB(序号为2)-cache lineC(序号为3)-cache lineD(序号为4),而后可以将序号信息确定为cache line相对应的初始状态标识,这样方便对多个cache line中的状态进行查看,进一步保证了对cache line中数据进行更新的质量和效率。
本实施例中,通过获取多个cache line所对应的数量信息,而后基于数量信息为多个cache line配置初始状态标识,不同cache line对应有不同的初始状态标识,从而有效地实现了为多个cache line配置相对应的初始状态标识,以便之后基于初始状态标识对多个cache line中的数据进行更新替换操作,进一步保证了访问缓存行cache line的方法使用的稳定可靠性。
图7为本发明实施例提供的又一种访问缓存行的方法的流程示意图;参考附图7所示,为了能够保证访问缓存行cache line的方法使用的准确可靠性,在基于数量信息为多个cache line配置初始状态标识之后,本实施例中的方法还可以包括:
步骤S701:获取针对多个cache line的数据访问请求。
步骤S702:基于数据访问请求对多个cache line各自对应的初始状态标识进行更新,获得多个cache line各自对应的状态标识。
其中,在基于数量信息为多个cache line配置初始状态标识之后,用户可以根据需求对多个cache line进行数据访问操作,从而可以获得针对多个cache line的数据访问请求,可以理解的是,数据访问请求可以为数据读取请求或者数据存储请求。在获取到数据访问请求之后,由于数据访问请求中包括有待访问数据,而后需要基于待访问数据对多个cache line中的数据进行更新,此时,多个cache line中数据的存储时长已发生变化,此时,需要 对用于标识多个cache line中数据的存储时长的初始状态标识进行更新,在对初始状态标识进行更新之后,即可获取到多个cache line各自对应的状态标识。
本实施例中,通过获取针对多个cache line的数据访问请求,而后基于数据访问请求对多个cache line各自对应的初始状态标识进行更新,从而有效地实现了可以及时、有效地基于针对多个cache line的数据访问请求对多个cache line各自对应的初始状态标识进行更新操作,并且保证了对多个cache line各自对应的状态标识进行获取的准确可靠性,进一步提高了该访问缓存行cache line的方法使用的准确可靠性。
图8为本发明实施例提供的基于多个缓存行各自对应的状态标识,在多个缓存行中确定第一缓存行的流程示意图;参考附图8所示,本实施例提供了一种确定第一cache line的实现方式,具体的,本实施例中的基于多个cache line各自对应的状态标识,在多个cache line中确定第一cache line可以包括:
步骤S801:基于多个cache line各自对应的状态标识,确定多个cache line中的存储数据各自对应的存储时长。
步骤S802:基于存储时长,在多个cache line中确定第一cache line。
其中,在获取到多个cache line各自对应的状态标识之后,可以对多个cache line各自对应的状态标识进行分析处理,以确定多个cache line中的存储数据各自对应的存储时长,具体的,状态标识的大小与存储时长之间呈正相关;或者,状态标识的大小与存储时长之间呈负相关。在状态标识的大小与存储时长之间呈正相关时,若cache line所对应的状态标识越大,则该cache line中数据的存储时长越长;若cache line所对应的状态标识越小,则该cache line中数据的存储时长越短。
在状态标识的大小与存储时长之间呈负相关时,若cache line所对应的状态标识越大,则该cache line中数据的存储时长越短;若cache line所对应的状态标识越小,则该cache line中数据的存储时长越长,从而有效地保证了对多个cache line中的存储数据各自对应的存储时长进行确定的准确可靠性。
在获取到多个cache line中的存储数据各自对应的存储时长之后,可以对存储时长进行分析处理,以在多个cache line中确定第一cache line,其 中,第一cache line中数据的存储时长长于其他cache line中数据的存储时长,这样有效地保证了对第一cache line进行确定的准确可靠性。
在一些实例中,在将第一cache line中的存储数据更新为待访问数据之后,本实施例中的方法还可以包括:对多个cache line各自对应的状态标识进行更新。
其中,在将第一cache line中的存储数据更新为待访问数据时,则说明多个cache line中存储的数据时长已经发生变化,为了能够保证后续对多个cache line进行数据更新的准确性,则需要对多个cache line所对应的状态标识进行更新操作。
具体的,在对多个cache line各自对应的状态标识进行更新时,可以包括:在状态标识的大小与存储时长之间呈正相关时,将第一cache line的状态标识信息置零,并将多个cache line中的其他cache line各自所对应的状态标识加一;在状态标识的大小与存储时长之间呈负相关时,将第一cache line的状态标识配置为最大状态标识,并将多个cache line中的其他cache line各自所对应的状态标识减一。
举例1,多个cache line包括cache line0、cache line1、cache line2和cache line3,cache line0中存储有数据E、cache line1中存储有数据C、cache line2中存储有数据B和cache line3中存储有数据A,cache line0、cache line1、cache line2和cache line3所对应的状态标识为C0、C1、C2和C3。此时,对多个cache line中数据和标识进行更新的策略如下表4所示:
表4
Figure PCTCN2021090189-appb-000004
在待访问数据为A时,待访问数据A存储在cache line3中,因此,则说明A被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。在状态标识的大小与存储时长之间呈正相关时,为了能够表明cache  line3中的数据存储时长最短,则可以将所确定的第一cache line(即为cache line3)的状态标识置零,即将cache line 3中的标识“3”更改为“0”,并将其他cache line各自对应的状态标识加1,进而可以确定与多个cache line各自对应的状态标识,cache line0对应状态标识“1”,cache line1对应状态标识“2”,cache line2对应状态标识“3”,cache line3对应状态标识“0”。
相类似的,在待访问数据为B时,待访问数据B存储在cache line2中,因此,则说明B被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。在状态标识的大小与存储时长之间呈正相关时,为了能够表明cache line2中的数据存储时长最短,则可以将所确定的第一cache line(即为cache line2)的状态标识置零,即将cache line 2中的标识“3”更改为“0”,并将其他cache line各自对应的状态标识加1,进而可以确定与多个cache line各自对应的状态标识,cache line0对应状态标识“2”,cache line1对应状态标识“3”,cache line2对应状态标识“0”,cache line3对应状态标识“1”。
相类似的,在待访问数据为C时,则可以基于待访问数据C将多个cache line各自对应的状态标识由“2、3、0、1”更新为“3、0、1、2”,从而有效地实现了对多个cache line各自对应的状态标识进行更新操作,保证了对状态标识进行更新的准确可靠性。
举例2,多个cache line包括cache line0、cache line1、cache line2和cache line3,cache line0中存储有数据E、cache line1中存储有数据C、cache line2中存储有数据B和cache line3中存储有数据A,cache line0、cache line1、cache line2和cache line3所对应的状态标识为C0、C1、C2和C3。此时,对多个cache line中数据和标识进行更新的策略如下表5所示:
表5
Figure PCTCN2021090189-appb-000005
Figure PCTCN2021090189-appb-000006
在待访问数据为E时,待访问数据E存储在cache line0中,因此,则说明E被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。在状态标识的大小与存储时长之间呈负相关时,为了能够表明cache line0中的数据存储时长最短,则可以将所确定的第一cache line(即为cache line0)的状态标识配置为最大状态标识,即将cache line 0中的标识“O”更改为“3”,并将其他cache line各自对应的状态标识减1,进而可以确定与多个cache line各自对应的状态标识,cache line0对应状态标识“3”,cache line1对应状态标识“0”,cache line2对应状态标识“1”,cache line3对应状态标识“2”。
相类似的,在待访问数据为C时,待访问数据C存储在cache line1中,因此,则说明C被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。在状态标识的大小与存储时长之间呈负相关时,为了能够表明cache line1中的数据存储时长最短,则可以将所确定的第一cache line(即为cache line1)的状态标识配置为最大状态标识,即将cache line 1中的标识“0”更改为“3”,并将其他cache line各自对应的状态标识减1,进而可以确定与多个cache line各自对应的状态标识,cache line0对应状态标识“2”,cache line1对应状态标识“3”,cache line2对应状态标识“0”,cache line3对应状态标识“1”。
相类似的,在待访问数据为B时,则可以基于待访问数据B将多个cache line各自对应的状态标识由“2、3、0、1”更新为“1、2、3、0”,从而有效地实现了对多个cache line各自对应的状态标识进行更新操作,保证了对状态标识进行更新的准确可靠性。
本实施例中,在状态标识的大小与存储时长之间呈正相关时,将第一cache line的状态标识信息置零,并将多个cache line中的其他cache line各自所对应的状态标识加一;在状态标识的大小与存储时长之间呈负相关时,将第一cache line的状态标识配置为最大状态标识,并将多个cache line中的其他cache line各自所对应的状态标识减一,从而有效地实现了对多个cache line各自对应的状态标识进行更新操作,进一步保证了访问缓存行cache line的方法使用的稳定可靠性。
图9为本发明实施例提供的又一种访问缓存行的方法的流程示意图;参考 附图9所示,具体的,本实施例中的方法还可以包括:
步骤S901:在多个缓存行cache line中存储待访问数据时,则确定存储待访问数据的第二cache line。
步骤S902:对其他cache line的状态标识进行更新,并将第二cache line的状态标识更新为设定状态标识,其中,设定状态标识用于标识第二cache line中数据的存储时长短于其他cache line中数据的存储时长。
其中,在获取到待访问数据已被存储于缓存行cache line中时,则可以确定用于存储待访问数据的第二cache line,在确定第二cache line之后,由于第二cache line中已存储有待访问数据,则可以对第二cache line和其他cache line的状态标识进行更新操作。需要注意的是,为了能够表征第二cache line中数据的存储时长短于其他cache line中数据的存储时长,则可以将第二cache line的状态标识更新为设定状态标识,该设定状态标识包括以下任意之一:多个cache line各自对应的状态标识中的最大状态标识、多个cache line各自对应的状态标识中的最小状态标识。具体的,在状态标识的大小与存储时长之间呈正相关时,设定状态标识可以为多个cache line各自对应的状态标识中的最小状态标识;在状态标识的大小与存储时长之间呈负相关时,设定状态标识可以为多个cache line各自对应的状态标识中的最大状态标识。
另外,本实施例对于上述步骤“对其他cache line的状态标识进行更新”和步骤“将第二cache line的状态标识更新为设定状态标识”的执行先后顺序不做限定,本领域技术人员可以根据具体的应用场景和应用需求进行设置,例如:可以先对其他cache line的状态标识进行更新,而后将第二cache line的状态标识更新为设定状态标识;或者,也可以先将第二cache line的状态标识更新为设定状态标识,而后对其他cache line的状态标识进行更新;或者,步骤“对其他cache line的状态标识进行更新”和步骤“将第二cache line的状态标识更新为设定状态标识”可以同步执行。
本实施例中,在多个缓存行cache line中存储待访问数据时,通过确定存储待访问数据的第二cache line,而后对其他cache line的状态标识进行更新,并将第二cache line的状态标识更新为设定状态标识,从而有效地实现了当cache line中存储有待访问数据时,则可以基于待访问数据对第二cache line以及其他cache line的状态标识进行更新操作,这样有效地保证 了各个cache line的状态标识所对应的时序性,进而保证了访问缓存行cache line的方法的实用性,有利于市场的推广与应用。
图10为本发明实施例提供的对其他缓存行的状态标识进行更新的流程示意图一;参考附图10所示,在设定状态标识为最大状态标识时,即状态标识的大小与存储时长之间呈负相关,此时,对其他cache line的状态标识进行更新可以包括:
步骤S1001:获取第二cache line的调整前状态标识。
步骤S1002:对于状态标识小于调整前状态标识的cache line,则保持cache line的状态标识不变。
步骤S1003:对于状态标识大于调整前状态标识的cache line,则将cache line的状态标识各自减1。
举例来说,多个cache line包括cache line0、cache line1、cache line2和cache line3,cache line0中存储有数据E、cache line1中存储有数据C、cache line2中存储有数据B和cache line3中存储有数据A,cache line0、cache line1、cache line2和cache line3所对应的状态标识为C0、C1、C2和C3。此时,对多个cache line中数据和标识进行更新的策略如下表6所示:
表6
Figure PCTCN2021090189-appb-000007
在待访问数据为B时,待访问数据B存储在cache line2中,因此,则说明B被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。具体的,在对多个cache line所对应的状态标识进行更新时,为了保证对多个cache line所对应的状态标识进行更新的准确可靠性,则可以获取第二cache line(即为cache line2)的调整前状态标识,其中,第二cache line即为存储有待访问数据B的cache line,此时,第二cache line的调整前状态标识即为“2”,在获取到调整前状态标识之后,可以将多个cache line划分 为两组,第一组cache line为状态标识小于调整前状态标识的cache line(cache line0、cache line1),第二组cache line为状态标识大于调整前状态标识的cache line(cache line3)。
在状态标识的大小与存储时长之间呈负相关时,对于状态标识小于调整前状态标识的cache line而言,则保持cache line的状态标识不变,即使得cache line0的标识保持为0,cache line1的标识保持为1;对于状态标识大于调整前状态标识的cache line,则将cache line的状态标识各自减1,即使得cache line3的标识由“3”调整为“2”。需要注意的是,此时,第二cache line的标识由“2”调整为最大状态标识“3”。
相类似的,在待访问数据为C时,待访问数据C存储在cache line1中,因此,则说明C被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。具体的,在对多个cache line所对应的状态标识进行更新时,为了保证对多个cache line所对应的状态标识进行更新的准确可靠性,则可以获取第二cache line(即为cache line1)的调整前状态标识,其中,第二cache line即为存储有待访问数据C的cache line,此时,第二cache line的调整前状态标识即为“1”,在获取到调整前状态标识之后,可以将多个cache line划分为两组,第一组cache line为状态标识小于调整前状态标识的cache line(cache line0),第二组cache line为状态标识大于调整前状态标识的cache line(cache line2、cache line3)。
在状态标识的大小与存储时长之间呈负相关时,对于状态标识小于调整前状态标识的cache line而言,则保持cache line的状态标识不变,即使得cache line0的标识保持为0;对于状态标识大于调整前状态标识的cache line,则将cache line的状态标识各自减1,即使得cache line2的标识由“3”调整为“2”,使得cache line3的标识由“2”调整为“1”。需要注意的是,此时,第二cache line的标识由“1”调整为最大状态标识“3”。
相类似的,在待访问数据为A时,则可以基于待访问数据A将多个cache line各自对应的状态标识由“0、1、3、2”更新为“0、2、1、3”,从而有效地实现了对多个cache line各自对应的状态标识进行更新操作,保证了对状态标识进行更新的准确可靠性。
本实施例中,在设定状态标识为最大状态标识时,即状态标识的大小与存储时长之间呈负相关,通过获取第二cache line的调整前状态标识,对于 状态标识小于调整前状态标识的cache line,则保持cache line的状态标识不变,而对于状态标识大于调整前状态标识的cache line,则将cache line的状态标识各自减1,从而有效地实现了可以对其他cache line的状态标识进行准确、有效地更新操作,进一步保证了访问缓存行cache line的方法使用的稳定可靠性。
图11为本发明实施例提供的对其他缓存行的状态标识进行更新的流程示意图二;参考附图11所示,在设定状态标识为最小状态标识时,即状态标识的大小与存储时长之间呈正相关,此时,对其他cache line的状态标识进行更新可以包括:
步骤S1101:获取第二cache line的调整前状态标识;
步骤S1102:在第二cache line的调整前状态标识为最大状态标识时,将最大状态标识调整为最小状态标识,并将其他cache line的状态标识各自加1。
举例来说,多个cache line包括cache line0、cache line1、cache line2和cache line3,cache line0中存储有数据E、cache line1中存储有数据C、cache line2中存储有数据B和cache line3中存储有数据A,cache line0、cache line1、cache line2和cache line3所对应的状态标识为C0、C1、C2和C3。此时,对多个cache line中数据和标识进行更新的策略如下表7所示:
表7
Figure PCTCN2021090189-appb-000008
在待访问数据为A时,待访问数据A被存储在cache line3中,因此,则说明A被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。具体的,在对多个cache line所对应的状态标识进行更新时,为了保证对多个cache line所对应的状态标识进行更新的准确可靠性,则可以获取第二cache line(即为cache line3)的调整前状态标识,其中,第二cache line即为存储有待访问数据A的cache line,此时,第二cache line的调整前 状态标识即为“3”,在获取到调整前状态标识之后,可以识别第二cache line的调整前状态标识是否为最大状态标识,在第二cache line的调整前状态标识为最大状态标识时,则可以将最大状态标识调整为最小状态标识,即将第二cache line(即为cache line3)的状态标识由“3”调整为“0”,并将其他cache line的状态标识各自加1,即使得cache line0的状态标识由“0”调整为“1”,cache line1的状态标识由“1”调整为“2”,cache line2的状态标识由“2”调整为“3”。
相类似的,在待访问数据为B时,待访问数据B被存储在cache line2中,因此,则说明B被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。具体的,在对多个cache line所对应的状态标识进行更新时,为了保证对多个cache line所对应的状态标识进行更新的准确可靠性,则可以获取第二cache line(即为cache line2)的调整前状态标识,其中,第二cache line即为存储有待访问数据B的cache line,此时,第二cache line的调整前状态标识即为“3”,在获取到调整前状态标识之后,可以识别第二cache line的调整前状态标识是否为最大状态标识,在第二cache line的调整前状态标识为最大状态标识时,则可以将最大状态标识调整为最小状态标识,即将第二cache line(即为cache line2)的状态标识由“3”调整为“0”,并将其他cache line的状态标识各自加1,即使得cache line0的状态标识由“1”调整为“2”,cache line1的状态标识由“2”调整为“3”,cache line3的状态标识由“0”调整为“1”。
相类似的,在待访问数据为C时,则可以基于待访问数据C将多个cache line各自对应的状态标识由“2、3、0、1”更新为“0、3、1、2”,从而有效地实现了对多个cache line各自对应的状态标识进行更新操作,保证了对状态标识进行更新的准确可靠性。
本实施例中,在设定状态标识为最小状态标识时,即状态标识的大小与存储时长之间呈正相关,通过获取第二cache line的调整前状态标识,在第二cache line的调整前状态标识为最大状态标识时,将最大状态标识调整为最小状态标识,并将其他cache line的状态标识各自加1,从而有效地实现了可以对其他cache line的状态标识进行准确、有效地更新操作,进一步保证了访问缓存行cache line的方法使用的稳定可靠性。
在另一些实例中,在设定状态标识为最小状态标识时,即状态标识的大 小与存储时长之间呈正相关,对其他cache line的状态标识进行更新还可以包括:
步骤S1103:在第二cache line的调整前状态标识小于最大状态标识时,则对于状态标识大于调整前状态标识的cache line,则保持cache line的状态标识不变。
步骤S1104:对于状态标识小于调整前状态标识的cache line,则将cache line的状态标识各自加1。
承接上述举例来说,多个cache line包括cache line0、cache line1、cache line2和cache line3,cache line0中存储有数据E、cache line1中存储有数据C、cache line2中存储有数据B和cache line3中存储有数据A,cache line0、cache line1、cache line2和cache line3所对应的状态标识为C0、C1、C2和C3。此时,对多个cache line中数据和标识进行更新的策略如下表9所示:
表9
Figure PCTCN2021090189-appb-000009
在待访问数据为C时,待访问数据C被存储在cache line1中,因此,则说明C被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。具体的,在对多个cache line所对应的状态标识进行更新时,为了保证对多个cache line所对应的状态标识进行更新的准确可靠性,则可以获取第二cache line(即为cache line1)的调整前状态标识,此时,第二cache line的状态标识即为“1”,在获取到调整前状态标识之后,可以识别第二cache line的状态标识是否为最大状态标识,在第二cache line的调整前状态标识小于最大状态标识时,则可以将多个cache line划分为两组,第一组cache line为状态标识大于调整前状态标识的cache line(cache line2、cache line3),第二组cache line为状态标识小于调整前状态标识的cache line (cache line0)。
对于状态标识大于调整前状态标识的cache line而言,则保持cache line的状态标识不变,即使得cache line2的状态标识保持为2,cache line3的状态标识保持为3;对于状态标识小于调整前状态标识的cache line,则将cache line的状态标识各自加1,即使得cache line0的状态标识由“0”调整为“1”。需要注意的是,此时,第二cache line的标识由“1”调整为最小状态标识“0”。
相类似的,在待访问数据为B时,待访问数据B被存储在cache line2中,因此,则说明B被存储在cache line中,而后可以对多个cache line所对应的状态标识进行更新。具体的,在对多个cache line所对应的状态标识进行更新时,为了保证对多个cache line所对应的状态标识进行更新的准确可靠性,则可以获取第二cache line(即为cache line2)的调整前状态标识,其中,第二cache line即为存储有待访问数据B的cache line,此时,第二cache line的调整前状态标识即为“2”,该调整前状态标识小于最大状态标识“3”,此时,对于状态标识大于调整前状态标识“2”的cache line,则可以保持cache line的状态标识不变,即将cache line3的标识保持为3;对于状态标识小于调整前状态标识的cache line,则将cache line的状态标识各自加1,即使得cache line0的状态标识由“1”调整为“2”,使得cache line1的状态标识由“0”调整为“1”。需要注意的是,此时,第二cache line的状态标识由“2”调整为最小状态标识“0”。
相类似的,在待访问数据为E时,则可以基于待访问数据E将多个cache line各自对应的状态标识由“2、1、0、3”更新为“0、2、1、3”,从而有效地实现了对多个cache line各自对应的状态标识进行更新操作,保证了对状态标识进行更新的准确可靠性。
本实施例中,在设定状态标识为最小状态标识时,即状态标识的大小与存储时长之间呈正相关,在第二cache line的调整前状态标识小于最大状态标识时,则对于状态标识大于调整前状态标识的cache line,则保持cache line的状态标识不变;对于状态标识小于调整前状态标识的cache line,则将cache line的状态标识各自加1,从而有效地实现了可以对其他cache line的状态标识进行准确、有效地更新操作,进一步保证了访问缓存行cache line的方法使用的稳定可靠性。
图12为本发明实施例提供的又一种访问缓存行的方法的流程示意图;参 考附图12所示,本实施例提供了又一种访问缓存行cache line的方法,该方法的执行主体为访问缓存行cache line的装置,该装置可以实现为软件、或者软件和硬件的组合,具体的,该访问缓存行cache line的方法可以包括以下步骤:
步骤S1201:获取待访问数据。
步骤S1202:确定多个cache line各自对应的状态标识,状态标识用于标识cache line中数据的存储时长,且状态标识所对应的二进制数的位数与多个cache line的数量相关。
步骤S1203:基于状态标识对待访问数据进行处理,并对多个cache line各自对应的状态标识进行更新。
下面对上述各个步骤的具体实现过程和实现效果进行详细说明:
步骤S1201:获取待访问数据。
其中,待访问数据是指需要从内存中读取的数据,或者,也可以是指需要写入到内存中的数据,具体的,本实施例中获取待访问数据的具体实现过程和实现效果与上述步骤S501的具体实现过程和实现效果相类似,具体可参考上述陈述内容,在此不再赘述。
步骤S1202:确定多个cache line各自对应的状态标识,状态标识用于标识cache line中数据的存储时长,且状态标识所对应的二进制数的位数与多个cache line的数量相关。
其中,为了方便用户及时了解多个cache line中数据的存储状态和存储时长,针对多个cache line预先配置有用于标识cache line中数据的存储时长的初始状态标识,当针对多个cache line存在数据访问操作时,则可以对所配置的初始状态标识进行更新,从而可以获得进行更新之后的状态标识。
在获取到待访问数据之后,为了能够实现准确地基于待访问数据对多个cache line各自对应的状态标识进行更新操作,则需要确定多个cache line各自对应的状态标识,该状态标识用于标识cache line中数据的存储时长。具体的,本实施例对于多个cache line各自对应的状态标识的具体确定方式不做限定,本领域技术人员可以根据具体的应用场景和应用需求进行设置,例如:与多个cache line各自对应的状态标识可以存储在预设区域中,通过访问预设区域即可获取到与多个cache line各自对应的状态标识。需要注意的是,上述所确定的多个cache line各自对应的状态标识可以为预先配置的 初始状态标识,或者,也可以是通过对初始状态标识进行更新之后所获得的状态标识,在一些实例中,在多个cache line的数量为N时,状态标识所对应的二进制数的位数为log 2(N)。
步骤S1203:基于状态标识对待访问数据进行处理,并对多个cache line各自对应的状态标识进行更新。
在获取到状态标识之后,可以基于状态标识对待访问数据进行处理,在一些实例中,基于状态标识对待访问数据进行处理可以包括:在多个缓存行cache line中未存储待访问数据时,在多个cache line中确定第一cache line,第一cache line中数据的存储时长大于其他cache line中数据的存储时长;将第一cache line中的数据更新为待访问数据。
此外,本实施例中的方法还可以包括:在多个缓存行cache line中存储待访问数据时,则确定存储待访问数据的第二cache line;对其他cache line的状态标识进行更新,并将第二cache line的状态标识更新为设定状态标识,其中,设定状态标识用于标识第二cache line中数据的存储时长短于其他cache line中数据的存储时长。其中,设定状态标识包括以下任意之一:多个cache line各自对应的状态标识中的最大状态标识、多个cache line各自对应的状态标识中的最小状态标识。
其中,本实施例中上述步骤的实现原理和实现效果与上述图5、图9所对应实施例中步骤的实现原理和实现效果相类似,具体可参考上述陈述内容,在此不再赘述。
在一些实例中,在设定状态标识为最大状态标识时,对其他cache line的状态标识进行更新可以包括:获取第二cache line的调整前状态标识;对于状态标识小于调整前状态标识的cache line,则保持cache line的状态标识不变;对于状态标识大于调整前状态标识的cache line,则将cache line的状态标识各自减1。
在另一些实例中,在设定状态标识为最小状态标识时,对其他cache line的状态标识进行更新可以包括:获取第二cache line的调整前状态标识;在第二cache line的调整前状态标识为最大状态标识时,将最大状态标识调整为最小状态标识,并将其他cache line的状态标识各自加1。
在又一些实例中,对其他cache line的状态标识进行更新可以包括:在第二cache line的调整前状态标识小于最大状态标识时,则对于状态标识大 于调整前状态标识的cache line,则保持cache line的状态标识不变;对于状态标识小于调整前状态标识的cache line,则将cache line的状态标识各自加1。
在又一些实例中,对多个cache line各自对应的状态标识进行更新可以包括:在状态标识的大小与存储时长之间呈正相关时,将第一cache line的状态标识置零,并将多个cache line中的其他cache line各自所对应的状态标识加一;在状态标识的大小与存储时长之间呈负相关时,将第一cache line的状态标识配置为最大状态标识,并将多个cache line中的其他cache line各自所对应的状态标识减一。
本实施例中的方法的具体实现过程和实现效果与上述图5-图11所示的实施例中的方法的具体实现过程和实现效果相类似,本实施例未详细描述的部分,可参考对图5至图11所示中的实施例的相关说明。该技术方案的执行过程和技术效果参见图5至图11所示实施例中的描述,在此不再赘述。
具体应用时,参考附图13所示,本应用实施例提供了一种访问由N路cache line所构成的cache系统的方法,该方法不仅实现了对cache系统中cache line的状态标识进行及时、有效的更新,并且可以通过所配置的N个log 2(N)bit的状态标识(记录值可以为0到N-1)实现了全局最优的LRU替换策略。具体的,该方法包括以下步骤:
步骤1、获取用于为N路cache line进行配置的N个log 2(N)bit的状态标识值,以使得每个cache line均对应一个状态标识值,且每个cache line所对应的状态标识值不会重复,有且仅有一个。
步骤2、将状态标识值分别初始化到N路cache line中所对应的N个状态标识中。
具体的,在将状态标识值映射至N路cache系统中所包括的N个cache line中时,映射方式可以为顺序映射,即使得:lru_weight[0至N-1]为N个log 2(N)bit的状态标识值。举例来说,假设N个cache line分别为:cache line0到cache line N-1,则与上述N个cache line各自对应的状态标识值可以为0到N-1;参考附图13所示,w0-w3可以分别为lru_weight[0-3]的状态标志值,在w0-w3分别为:1-3时,则实现了通过4个2bit的二进制状态标志值来标识4个cache line。
在状态标识为0时,则说明所对应的cache line 0里存储有最新的数据;在状态标识为N-1时,则说明所对应的cache line N-1里存储有最久的数据。 数据实现层面可以通过以下方式来实现:
For i=0-N-1;
lru_weight[i]=i;
End。
步骤3、获取访问数据,基于访问数据对N个cache line中的数据和状态标识进行更新。
假设访问数据为A,在N个cache line中存储有访问数据A时,则命中cache line,而后可以获得命中的cache line的编号way_id;如果N个cache line中未存储有访问数据A,则未命中cache line,此时则可以获得对应替换的cache line的编号way_id。
具体的,在获取到cache line的编号way_id之后,可以获得上述cache line所对应的状态标志lru_weight[way_id],而后分别比较每个状态标志值与lru_weight[way_id]之间的大小关系,如果小于lru_weight[way_id],则将cache line所对应的状态标志值累加1,并将lru_weight[way_id]置0,此时,上述的状态值“0”用于标识cache line中存储有最新的数据,“N-1”用于标识cache line中存储有最旧的数据,数据实现层面可以通过以下方式来实现:
Figure PCTCN2021090189-appb-000010
步骤4、在访问数据未命中cache line时,则可以选择lru_weight中数值为N-1所对应的cache line,记为rpl_way_id,数据实现层面可以通过以下方式来实现:
Figure PCTCN2021090189-appb-000011
下面以访问一个由4路cache line所构成的cache系统为例来说明,若数据的访问系列为ABCDAECF,每次访问都会按照前述逻辑来更新状态标志值, 并可以基于状态标志值得到下次替换的cache line,基于下述表格即可确定本实施例中所获得的数据替换结果是全局最优的LRU替换结果。
表10
访问序列 0 1 2 3 4 5 6 7 8
数据序列   A B C D A E C F
缓存miss情况 Miss Miss Miss Miss     Miss   Miss
cache line0 (3) A(0) A(1) A(2) A(3) A(0) A(1) A(2) A(3)
cache line1 (3) (3) B(0) B(1) B(2) B(3) E(0) E(1) E(2)
cache line2 (3) (3) (3) C(0) C(1) C(2) C(3) C(0) C(1)
cache line3 (3) (3) (4) (3) D(0) D(1) D(2) D(3) F(0)
下次替换cache line 0 1 2 3 0 1 2 3 0
具体的,假设在初始状态时,4路cache line中未存储有任何数据,在获取到访问数据ABCDAECF时,可以将访问数据A存储在cache line0中,并将cache line所对应的状态标识值由“3”更新为“0”。将访问数据B存储在cache line1中,并将cache line1所对应的状态标识值由“3”更新为“0”,cache line0所对应的状态标识值由“0”更新为“1”。将访问数据C存储在cache line2中,并将cache line2所对应的状态标识值由“3”更新为“0”,cache line1所对应的状态标识值由“0”更新为“1”、cache line0所对应的状态标识值由“1”更新为“2”。将访问数据D存储在cache line3中,并将cache line3所对应的状态标识值由“3”更新为“0”,cache line2所对应的状态标识值由“0”更新为“1”、cache line1所对应的状态标识值由“1”更新为“2”、cache line0所对应的状态标识值由“2”更新为“3”。
当再次获取到访问数据A时,由于访问数据A已经存储在cache line0中,则此时的访问数据操作命中cache line,则可以基于上述的访问数据A将cache line所对应的状态标识值进行更新操作,具体的,可以将cache line0中的状态标识值由“3”更新为“0”,并将其他cache line的状态标识值加1,即将cache line1中的状态标识值由“2”更新为“3”,将cache line2中的状态标识值由“1”更新为“2”,将cache line3中的状态标识值由“0”更新为“1”。
在获取到访问数据E时,由于访问数据E未存储在cache line中,即此时的访问数据操作未命中cache line,此时,则可以获取用于存储访问数据E的 目标cache line,目标cache line可以为状态标识值为“3”所对应的cache line1,而后可以将访问数据E存储在cache line1中,并对cache line的状态标识值进行更新操作,具体的,可以将cache line1所对应的状态标识值由“3”更新为“0”,并将其他cache line所对应的状态标识值加1,即将cache line0所对应的状态标识值由“0”更新为“1”,将cache line2所对应的状态标识值由“2”更新为“3”,将cache line3所对应的状态标识值由“1”更新为“2”,从而有效地实现了对访问数据和cache line的状态标识值进行更新操作。
相类似的,在获取到访问数据C时,则可以基于访问数据C对cache line的状态标识值进行更新,即可以将4路cache line所对应的状态标识值由“1”、“0”、“3”、“2”更新为“2”、“1”、“0”、“3”。在获取到访问数据F时,则可以基于访问数据F对cache line进行数据更新,并对cache line的状态标识值进行更新,即可以将4路cache line所对应的状态标识值由“2”、“1”、“0”、“3”更新为“3”、“2”、“1”、“0”。
本应用实施例提供的访问缓存行cache line的方法,有效地实现了当存在需要进行分析处理的待访问数据时,则可以基于cache line的状态标识,在多个cache line中,将数据存储时长最大的cache line作为用于对待访问数据进行处理的第一cache line,而后可以将第一cache line中的数据更新为待访问数据,这样通过使用N个log 2(N)bit的状态位实现了全局最优的LRU替换策略,逻辑资源消耗较小,状态位更新与查找可以并行操作,速度快,这样有利于实现对cache line中的数据进行及时的替换和更新操作,并且这种实现方式设计简单、功耗小、时序性好,这样有效地保证了访问缓存行cache line的方法的实用性,有利于市场的推广与应用。
图14为本发明实施例提供的一种访问缓存行的装置的结构示意图;参考附图14所示,本实施例提供了一种访问缓存行cache line的装置,该装置用于执行上述图5所示的访问缓存行cache line的方法。具体的,该装置可以包括:
第一存储器12,用于存储计算机程序;
第一处理器11,用于运行第一存储器12中存储的计算机程序以实现:
获取待访问数据;
在多个缓存行cache line中未存储待访问数据时,则获取多个cache line 各自对应的状态标识,其中,所述状态标识所对应的二进制数的位数与所述多个cache line的数量相关;
基于多个cache line各自对应的状态标识,在多个cache line中确定第一cache line,第一cache line中存储数据的存储时长大于其他cache line中存储数据的存储时长;
将第一cache line中的存储数据更新为待访问数据。
可选地,第一处理器11还用于执行前述图5-图11、图13所示中的至少部分实施例中的全部或部分步骤。
其中,电子设备的结构中还可以包括第一通信接口13,用于电子设备与其他设备或通信网络通信。
在一些实例中,在获取多个cache line各自对应的状态标识之前,第一处理器11还用于:获取多个cache line所对应的数量信息;基于数量信息为多个cache line配置初始状态标识,不同cache line对应有不同的初始状态标识。
在一些实例中,在第一处理器11基于数量信息为多个cache line配置初始状态标识时,第一处理器11用于:基于数量信息,确定与多个cache line相对应的连续的初始状态标识;将初始状态标识映射至多个cache line。
在一些实例中,在第一处理器11基于数量信息,确定与多个cache line相对应的连续的初始状态标识时,第一处理器11用于:基于数量信息对多个cache line进行排序,获取多个cache line的序列;在多个cache line的序列中,将与cache line相对应的序号信息确定为与cache line相对应的连续的初始状态标识。
在一些实例中,在基于数量信息为多个cache line配置初始状态标识之后,第一处理器11用于:获取针对多个cache line的数据访问请求;基于数据访问请求对多个cache line各自对应的初始状态标识进行更新,获得多个cache line各自对应的状态标识。
在一些实例中,在第一处理器11基于多个cache line各自对应的状态标识,在多个cache line中确定第一cache line时,第一处理器11用于:基于多个cache line各自对应的状态标识,确定多个cache line中的存储数据各自对应的存储时长;基于存储时长,在多个cache line中确定第一cache line。
在一些实例中,状态标识的大小与存储时长之间呈正相关;或者,状态 标识的大小与存储时长之间呈负相关。
在一些实例中,在将第一cache line中的存储数据更新为待访问数据之后,第一处理器11用于:对多个cache line各自对应的状态标识进行更新。
在一些实例中,在第一处理器11对多个cache line各自对应的状态标识进行更新时,第一处理器11用于:在状态标识的大小与存储时长之间呈正相关时,将第一cache line的状态标识信息置零,并将多个cache line中的其他cache line各自所对应的状态标识加一;在状态标识的大小与存储时长之间呈负相关时,将第一cache line的状态标识配置为最大状态标识,并将多个cache line中的其他cache line各自所对应的状态标识减一。
在一些实例中,第一处理器11用于:在多个缓存行cache line中存储待访问数据时,则确定存储待访问数据的第二cache line;对其他cache line的状态标识进行更新,并将第二cache line的状态标识更新为设定状态标识,其中,设定状态标识用于标识第二cache line中数据的存储时长短于其他cache line中数据的存储时长。
在一些实例中,设定状态标识包括以下任意之一:多个cache line各自对应的状态标识中的最大状态标识、多个cache line各自对应的状态标识中的最小状态标识。
在一些实例中,在设定状态标识为最大状态标识时,在第一处理器11对其他cache line的状态标识进行更新时,第一处理器11用于:获取第二cache line的调整前状态标识;对于状态标识小于调整前状态标识的cache line,则保持cache line的状态标识不变;对于状态标识大于调整前状态标识的cache line,则将cache line的状态标识各自减1。
在一些实例中,在设定状态标识为最小状态标识时,在第一处理器11对其他cache line的状态标识进行更新时,第一处理器11用于:获取第二cache line的调整前状态标识;在第二cache line的调整前状态标识为最大状态标识时,将最大状态标识调整为最小状态标识,并将其他cache line的状态标识各自加1。
在一些实例中,在处理器对其他cache line的状态标识进行更新时,第一处理器11用于:在第二cache line的调整前状态标识小于最大状态标识时,则对于状态标识大于调整前状态标识的cache line,则保持cache line的状态标识不变;对于状态标识小于调整前状态标识的cache line,则将cache  line的状态标识各自加1。
在一些实例中,在所述多个cache line的数量为N时,所述状态标识所对应的二进制数的位数为log 2(N)。
图14所示访问缓存行cache line的装置可以执行图5-图11、图13所示中的实施例的方法,本实施例未详细描述的部分,可参考对图5-图11、图13所示中的实施例的相关说明。该技术方案的执行过程和技术效果参见图5-图11、图13所示实施例中的描述,在此不再赘述。
另外,本发明实施例提供了一种计算机存储介质,用于储存电子设备所用的计算机软件指令,其包含用于执行上述图5-图11、图13所示中的至少部分实施例中访问缓存行cache line的方法所涉及的程序。
图15为本发明实施例提供的另一种访问缓存行的装置的结构示意图;参考附图15所示,本实施例提供了另一种访问缓存行cache line的装置,该装置用于执行上述图12所示的访问缓存行cache line的方法。具体的,该装置可以包括:
第二存储器22,用于存储计算机程序;
第二处理器21,用于运行第二存储器22中存储的计算机程序以实现:
获取待访问数据;
确定多个cache line各自对应的状态标识,状态标识用于标识cache line中存储数据的存储时长,且所述状态标识所对应的二进制数的位数与所述多个cache line的数量相关;
基于状态标识对待访问数据进行处理,并对多个cache line各自对应的状态标识进行更新。
可选地,第二处理器21还用于执行前述图12-图13所示中的至少部分实施例中的全部或部分步骤。
其中,电子设备的结构中还可以包括第二通信接口23,用于电子设备与其他设备或通信网络通信。
在一些实例中,在第二处理器21基于状态标识对待访问数据进行处理时,第二处理器21用于:在多个缓存行cache line中未存储待访问数据时,在多个cache line中确定第一cache line,第一cache line中数据的存储时长大于其他cache line中数据的存储时长;将第一cache line中的数据更新为待访问数据。
在一些实例中,第二处理器21还用于:在多个缓存行cache line中存储待访问数据时,则确定存储待访问数据的第二cache line;对其他cache line的状态标识进行更新,并将第二cache line的状态标识更新为设定状态标识,其中,设定状态标识用于标识第二cache line中数据的存储时长短于其他cache line中数据的存储时长。
在一些实例中,设定状态标识包括以下任意之一:多个cache line各自对应的状态标识中的最大状态标识、多个cache line各自对应的状态标识中的最小状态标识。
在一些实例中,在设定状态标识为最大状态标识时,在第二处理器21对其他cache line的状态标识进行更新时,第二处理器21用于:获取第二cache line的调整前状态标识;对于状态标识小于调整前状态标识的cache line,则保持cache line的状态标识不变;对于状态标识大于调整前状态标识的cache line,则将cache line的状态标识各自减1。
在一些实例中,在设定状态标识为最小状态标识时,在第二处理器21对其他cache line的状态标识进行更新时,第二处理器21用于:获取第二cache line的调整前状态标识;在第二cache line的调整前状态标识为最大状态标识时,将最大状态标识调整为最小状态标识,并将其他cache line的状态标识各自加1。
在一些实例中,在第二处理器21对其他cache line的状态标识进行更新时,第二处理器21用于:在第二cache line的调整前状态标识小于最大状态标识时,则对于状态标识大于调整前状态标识的cache line,则保持cache line的状态标识不变;对于状态标识小于调整前状态标识的cache line,则将cache line的状态标识各自加1。
在一些实例中,在第二处理器21对多个cache line各自对应的状态标识进行更新时,第二处理器21用于:在状态标识的大小与存储时长之间呈正相关时,将第一cache line的状态标识置零,并将多个cache line中的其他cache line各自所对应的状态标识加一;在状态标识的大小与存储时长之间呈负相关时,将第一cache line的状态标识配置为最大状态标识,并将多个cache line中的其他cache line各自所对应的状态标识减一。
在一些实例中,在所述多个cache line的数量为N时,所述状态标识所对应的二进制数的位数为log 2(N)。
图15所示访问缓存行cache line的装置可以执行图12-图13所示中的实施例的方法,本实施例未详细描述的部分,可参考对图12-图13所示中的实施例的相关说明。该技术方案的执行过程和技术效果参见图12-图13所示实施例中的描述,在此不再赘述。
另外,本发明实施例提供了一种计算机存储介质,用于储存电子设备所用的计算机软件指令,其包含用于执行上述图12-图13所示中的至少部分实施例中访问缓存行cache line的方法所涉及的程序。
以上各个实施例中的技术方案、技术特征在与本相冲突的情况下均可以单独,或者进行组合,只要未超出本领域技术人员的认知范围,均属于本申请保护范围内的等同实施例。
在本发明所提供的几个实施例中,应该理解到,所揭露的相关检测装置和方法,可以通过其它的方式实现。例如,以上所描述的检测装置实施例仅仅是示意性的,例如,所述模块或单元的划分,仅仅为一种逻辑功能划分,实际实现时可以有另外的划分方式,例如多个单元或组件可以结合或者可以集成到另一个系统,或一些特征可以忽略,或不执行。另一点,所显示或讨论的相互之间的耦合或直接耦合或通信连接可以是通过一些接口,检测装置或单元的间接耦合或通信连接,可以是电性,机械或其它的形式。
所述作为分离部件说明的单元可以是或者也可以不是物理上分开的,作为单元显示的部件可以是或者也可以不是物理单元,即可以位于一个地方,或者也可以分布到多个网络单元上。可以根据实际的需要选择其中的部分或者全部单元来实现本实施例方案的目的。
另外,在本发明各个实施例中的各功能单元可以集成在一个处理单元中,也可以是各个单元单独物理存在,也可以两个或两个以上单元集成在一个单元中。上述集成的单元既可以采用硬件的形式实现,也可以采用软件功能单元的形式实现。
所述集成的单元如果以软件功能单元的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。基于这样的理解,本发明的技术方案本质上或者说对现有技术做出贡献的部分或者该技术方案的全部或部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质中,包括若干指令用以使得计算机处理器(processor)执行本发明 各个实施例所述方法的全部或部分步骤。而前述的存储介质包括:U盘、移动硬盘、只读存储器(ROM,Read-Only Memory)、随机存取存储器(RAM,Random Access Memory)、磁盘或者光盘等各种可以存储程序代码的介质。
以上所述仅为本发明的实施例,并非因此限制本发明的专利范围,凡是利用本发明说明书及附图内容所作的等效结构或等效流程变换,或直接或间接运用在其他相关的技术领域,均同理包括在本发明的专利保护范围内。
最后应说明的是:以上各实施例仅用以说明本发明的技术方案,而非对其限制;尽管参照前述各实施例对本发明进行了详细的说明,本领域的普通技术人员应当理解:其依然可以对前述各实施例所记载的技术方案进行修改,或者对其中部分或者全部技术特征进行等同替换;而这些修改或者替换,并不使相应技术方案的本质脱离本发明各实施例技术方案的范围。

Claims (50)

  1. 一种访问缓存行的方法,其特征在于,包括:
    获取待访问数据;
    在多个缓存行中未存储所述待访问数据时,则获取多个缓存行各自对应的状态标识,其中,所述状态标识所对应的二进制数的位数与所述多个缓存行的数量相关;
    基于所述多个缓存行各自对应的状态标识,在所述多个缓存行中确定第一缓存行,所述第一缓存行中数据的存储时长大于其他缓存行中数据的存储时长;
    将所述第一缓存行中的数据更新为所述待访问数据。
  2. 根据权利要求1所述的方法,其特征在于,在获取多个缓存行各自对应的状态标识之前,所述方法还包括:
    获取所述多个缓存行所对应的数量信息;
    基于所述数量信息为所述多个缓存行配置初始状态标识,不同缓存行对应有不同的初始状态标识。
  3. 根据权利要求2所述的方法,其特征在于,基于所述数量信息为所述多个缓存行配置初始状态标识,包括:
    基于所述数量信息,确定与所述多个缓存行相对应的连续的初始状态标识;
    将所述初始状态标识映射至所述多个缓存行。
  4. 根据权利要求3所述的方法,其特征在于,基于所述数量信息,确定与所述多个缓存行相对应的连续的初始状态标识,包括:
    基于所述数量信息对所述多个缓存行进行排序,获取所述多个缓存行的序列;
    在所述多个缓存行的序列中,将与所述缓存行相对应的序号信息确定为与所述缓存行相对应的连续的初始状态标识。
  5. 根据权利要求2所述的方法,其特征在于,在基于所述数量信息为所述多个缓存行配置初始状态标识之后,所述方法还包括:
    获取针对所述多个缓存行的数据访问请求;
    基于所述数据访问请求对所述多个缓存行各自对应的初始状态标识进行更新,获得多个缓存行各自对应的状态标识。
  6. 根据权利要求1所述的方法,其特征在于,基于所述多个缓存行各自对应的状态标识,在所述多个缓存行中确定第一缓存行,包括:
    基于所述多个缓存行各自对应的状态标识,确定多个缓存行中的存储数据各自对应的存储时长;
    基于所述存储时长,在所述多个缓存行中确定第一缓存行。
  7. 根据权利要求6所述的方法,其特征在于,所述状态标识的大小与所述存储时长之间呈正相关;或者,所述状态标识的大小与所述存储时长之间呈负相关。
  8. 根据权利要求7所述的方法,其特征在于,在将所述第一缓存行中的存储数据更新为所述待访问数据之后,所述方法还包括:
    对所述多个缓存行各自对应的状态标识进行更新。
  9. 根据权利要求8所述的方法,其特征在于,对所述多个缓存行各自对应的状态标识进行更新,包括:
    在所述状态标识的大小与所述存储时长之间呈正相关时,将所述第一缓存行的状态标识信息置零,并将多个缓存行中的其他缓存行各自所对应的状态标识加一;
    在所述状态标识的大小与所述存储时长之间呈负相关时,将所述第一缓存行的状态标识配置为最大状态标识,并将多个缓存行中的其他缓存行各自所对应的状态标识减一。
  10. 根据权利要求1所述的方法,其特征在于,所述方法还包括:
    在所述多个缓存行中存储所述待访问数据时,则确定存储所述待访问数据的第二缓存行;
    对其他缓存行的状态标识进行更新,并将所述第二缓存行的状态标识更新为设定状态标识,其中,所述设定状态标识用于标识所述第二缓存行中数据的存储时长短于其他缓存行中数据的存储时长。
  11. 根据权利要求10所述的方法,其特征在于,
    所述设定状态标识包括以下任意之一:
    多个缓存行各自对应的状态标识中的最大状态标识、多个缓存行各自对应的状态标识中的最小状态标识。
  12. 根据权利要求10所述的方法,其特征在于,在所述设定状态标识为最大状态标识时,对其他缓存行的状态标识进行更新,包括:
    获取第二缓存行的调整前状态标识;
    对于状态标识小于调整前状态标识的缓存行,则保持所述缓存行的状态标识不变;
    对于状态标识大于调整前状态标识的缓存行,则将所述缓存行的状态标识各自减1。
  13. 根据权利要求10所述的方法,其特征在于,在所述设定状态标识为最小状态标识时,对其他缓存行的状态标识进行更新,包括:
    获取第二缓存行的调整前状态标识;
    在所述第二缓存行的调整前状态标识为最大状态标识时,将所述最大状态标识调整为所述最小状态标识,并将其他缓存行的状态标识各自加1。
  14. 根据权利要求13所述的方法,其特征在于,对其他缓存行的状态标识进行更新,包括:
    在所述第二缓存行的调整前状态标识小于最大状态标识时,则对于状态标识大于调整前状态标识的缓存行,则保持所述缓存行的状态标识不变;
    对于状态标识小于调整前状态标识的缓存行,则将所述缓存行的状态标识各自加1。
  15. 根据权利要求1-14中任意一项所述的方法,其特征在于,在所述多个缓存行的数量为N时,所述状态标识所对应的二进制数的位数为log 2(N)。
  16. 一种访问缓存行的方法,其特征在于,包括:
    获取待访问数据;
    确定多个缓存行各自对应的状态标识,所述状态标识用于标识缓存行中数据的存储时长,且所述状态标识所对应的二进制数的位数与所述多个缓存行的数量相关;
    基于所述状态标识对所述待访问数据进行处理,并对所述多个缓存行各自对应的状态标识进行更新。
  17. 根据权利要求16所述的方法,其特征在于,基于所述状态标识对所述待访问数据进行处理,包括:
    在多个缓存行中未存储所述待访问数据时,在所述多个缓存行中确定第一缓存行,所述第一缓存行中数据的存储时长大于其他缓存行中数据的存储时长;
    将所述第一缓存行中的数据更新为所述待访问数据。
  18. 根据权利要求16所述的方法,其特征在于,所述方法还包括:
    在所述多个缓存行中存储所述待访问数据时,则确定存储所述待访问数据的第二缓存行;
    对其他缓存行的状态标识进行更新,并将所述第二缓存行的状态标识更新为设定状态标识,其中,所述设定状态标识用于标识所述第二缓存行中数据的存储时长短于其他缓存行中数据的存储时长。
  19. 根据权利要求18所述的方法,其特征在于,
    所述设定状态标识包括以下任意之一:
    多个缓存行各自对应的状态标识中的最大状态标识、多个缓存行各自对应的状态标识中的最小状态标识。
  20. 根据权利要求18所述的方法,其特征在于,在所述设定状态标识为最大状态标识时,对其他缓存行的状态标识进行更新,包括:
    获取第二缓存行的调整前状态标识;
    对于状态标识小于调整前状态标识的缓存行,则保持所述缓存行的状态标识不变;
    对于状态标识大于调整前状态标识的缓存行,则将所述缓存行的状态标识各自减1。
  21. 根据权利要求18所述的方法,其特征在于,在所述设定状态标识为最小状态标识时,对其他缓存行的状态标识进行更新,包括:
    获取第二缓存行的调整前状态标识;
    在所述第二缓存行的调整前状态标识为最大状态标识时,将所述最大状态标识调整为所述最小状态标识,并将其他缓存行的状态标识各自加1。
  22. 根据权利要求21所述的方法,其特征在于,对其他缓存行的状态标识进行更新,包括:
    在所述第二缓存行的调整前状态标识小于最大状态标识时,则对于状态标识大于调整前状态标识的缓存行,则保持所述缓存行的状态标识不变;
    对于状态标识小于调整前状态标识的缓存行,则将所述缓存行的状态标识各自加1。
  23. 根据权利要求17所述的方法,其特征在于,对所述多个缓存行各自对应的状态标识进行更新,包括:
    在所述状态标识的大小与所述存储时长之间呈正相关时,将所述第一缓 存行的状态标识置零,并将多个缓存行中的其他缓存行各自所对应的状态标识加一;
    在所述状态标识的大小与所述存储时长之间呈负相关时,将所述第一缓存行的状态标识配置为最大状态标识,并将多个缓存行中的其他缓存行各自所对应的状态标识减一。
  24. 根据权利要求16-23中任意一项所述的方法,其特征在于,在所述多个缓存行的数量为N时,所述状态标识所对应的二进制数的位数为log 2(N)。
  25. 一种访问缓存行的装置,其特征在于,包括:
    存储器,用于存储计算机程序;
    处理器,用于运行所述存储器中存储的计算机程序以实现:
    获取待访问数据;
    在多个缓存行中未存储所述待访问数据时,则获取多个缓存行各自对应的状态标识,其中,所述状态标识所对应的二进制数的位数与所述多个缓存行的数量相关;
    基于所述多个缓存行各自对应的状态标识,在所述多个缓存行中确定第一缓存行,所述第一缓存行中存储数据的存储时长大于其他缓存行中存储数据的存储时长;
    将所述第一缓存行中的存储数据更新为所述待访问数据。
  26. 根据权利要求25所述的装置,其特征在于,在获取多个缓存行各自对应的状态标识之前,所述处理器还用于:
    获取所述多个缓存行所对应的数量信息;
    基于所述数量信息为所述多个缓存行配置初始状态标识,不同缓存行对应有不同的初始状态标识。
  27. 根据权利要求26所述的装置,其特征在于,在所述处理器基于所述数量信息为所述多个缓存行配置初始状态标识时,所述处理器用于:
    基于所述数量信息,确定与所述多个缓存行相对应的连续的初始状态标识;
    将所述初始状态标识映射至所述多个缓存行。
  28. 根据权利要求27所述的装置,其特征在于,在所述处理器基于所述数量信息,确定与所述多个缓存行相对应的连续的初始状态标识时,所述处理器用于:
    基于所述数量信息对所述多个缓存行进行排序,获取所述多个缓存行的序列;
    在所述多个缓存行的序列中,将与所述缓存行相对应的序号信息确定为与所述缓存行相对应的连续的初始状态标识。
  29. 根据权利要求26所述的装置,其特征在于,在基于所述数量信息为所述多个缓存行配置初始状态标识之后,所述处理器用于:
    获取针对所述多个缓存行的数据访问请求;
    基于所述数据访问请求对所述多个缓存行各自对应的初始状态标识进行更新,获得多个缓存行各自对应的状态标识。
  30. 根据权利要求25所述的装置,其特征在于,在所述处理器基于所述多个缓存行各自对应的状态标识,在所述多个缓存行中确定第一缓存行时,所述处理器用于:
    基于所述多个缓存行各自对应的状态标识,确定多个缓存行中的存储数据各自对应的存储时长;
    基于所述存储时长,在所述多个缓存行中确定第一缓存行。
  31. 根据权利要求30所述的装置,其特征在于,所述状态标识的大小与所述存储时长之间呈正相关;或者,所述状态标识的大小与所述存储时长之间呈负相关。
  32. 根据权利要求31所述的装置,其特征在于,在将所述第一缓存行中的存储数据更新为所述待访问数据之后,所述处理器用于:
    对所述多个缓存行各自对应的状态标识进行更新。
  33. 根据权利要求32所述的装置,其特征在于,在所述处理器对所述多个缓存行各自对应的状态标识进行更新时,所述处理器用于:
    在所述状态标识的大小与所述存储时长之间呈正相关时,将所述第一缓存行的状态标识信息置零,并将多个缓存行中的其他缓存行各自所对应的状态标识加一;
    在所述状态标识的大小与所述存储时长之间呈负相关时,将所述第一缓存行的状态标识配置为最大状态标识,并将多个缓存行中的其他缓存行各自所对应的状态标识减一。
  34. 根据权利要求25所述的装置,其特征在于,所述处理器用于:
    在所述多个缓存行中存储所述待访问数据时,则确定存储所述待访问数 据的第二缓存行;
    对其他缓存行的状态标识进行更新,并将所述第二缓存行的状态标识更新为设定状态标识,其中,所述设定状态标识用于标识所述第二缓存行中数据的存储时长短于其他缓存行中数据的存储时长。
  35. 根据权利要求34所述的装置,其特征在于,
    所述设定状态标识包括以下任意之一:
    多个缓存行各自对应的状态标识中的最大状态标识、多个缓存行各自对应的状态标识中的最小状态标识。
  36. 根据权利要求34所述的装置,其特征在于,在所述设定状态标识为最大状态标识时,在所述处理器对其他缓存行的状态标识进行更新时,所述处理器用于:
    获取第二缓存行的调整前状态标识;
    对于状态标识小于调整前状态标识的缓存行,则保持所述缓存行的状态标识不变;
    对于状态标识大于调整前状态标识的缓存行,则将所述缓存行的状态标识各自减1。
  37. 根据权利要求34所述的装置,其特征在于,在所述设定状态标识为最小状态标识时,在所述处理器对其他缓存行的状态标识进行更新时,所述处理器用于:
    获取第二缓存行的调整前状态标识;
    在所述第二缓存行的调整前状态标识为最大状态标识时,将所述最大状态标识调整为所述最小状态标识,并将其他缓存行的状态标识各自加1。
  38. 根据权利要求37所述的装置,其特征在于,在所述处理器对其他缓存行的状态标识进行更新时,所述处理器用于:
    在所述第二缓存行的调整前状态标识小于最大状态标识时,则对于状态标识大于调整前状态标识的缓存行,则保持所述缓存行的状态标识不变;
    对于状态标识小于调整前状态标识的缓存行,则将所述缓存行的状态标识各自加1。
  39. 根据权利要求25-38中任意一项所述的装置,其特征在于,在所述多个缓存行的数量为N时,所述状态标识所对应的二进制数的位数为log 2(N)。
  40. 一种访问缓存行的装置,其特征在于,包括:
    存储器,用于存储计算机程序;
    处理器,用于运行所述存储器中存储的计算机程序以实现:
    获取待访问数据;
    确定多个缓存行各自对应的状态标识,所述状态标识用于标识缓存行中存储数据的存储时长,且所述状态标识所对应的二进制数的位数与所述多个缓存行的数量相关;
    基于所述状态标识对所述待访问数据进行处理,并对所述多个缓存行各自对应的状态标识进行更新。
  41. 根据权利要求40所述的装置,其特征在于,在所述处理器基于所述状态标识对所述待访问数据进行处理时,所述处理器用于:
    在多个缓存行中未存储所述待访问数据时,在所述多个缓存行中确定第一缓存行,所述第一缓存行中数据的存储时长大于其他缓存行中数据的存储时长;
    将所述第一缓存行中的数据更新为所述待访问数据。
  42. 根据权利要求40所述的装置,其特征在于,所述处理器还用于:
    在所述多个缓存行中存储所述待访问数据时,则确定存储所述待访问数据的第二缓存行;
    对其他缓存行的状态标识进行更新,并将所述第二缓存行的状态标识更新为设定状态标识,其中,所述设定状态标识用于标识所述第二缓存行中数据的存储时长短于其他缓存行中数据的存储时长。
  43. 根据权利要求42所述的装置,其特征在于,
    所述设定状态标识包括以下任意之一:
    多个缓存行各自对应的状态标识中的最大状态标识、多个缓存行各自对应的状态标识中的最小状态标识。
  44. 根据权利要求42所述的装置,其特征在于,在所述设定状态标识为最大状态标识时,在所述处理器对其他缓存行的状态标识进行更新时,所述处理器用于:
    获取第二缓存行的调整前状态标识;
    对于状态标识小于调整前状态标识的缓存行,则保持所述缓存行的状态标识不变;
    对于状态标识大于调整前状态标识的缓存行,则将所述缓存行的状态标 识各自减1。
  45. 根据权利要求42所述的装置,其特征在于,在所述设定状态标识为最小状态标识时,在所述处理器对其他缓存行的状态标识进行更新时,所述处理器用于:
    获取第二缓存行的调整前状态标识;
    在所述第二缓存行的调整前状态标识为最大状态标识时,将所述最大状态标识调整为所述最小状态标识,并将其他缓存行的状态标识各自加1。
  46. 根据权利要求45所述的装置,其特征在于,在所述处理器对其他缓存行的状态标识进行更新时,所述处理器用于:
    在所述第二缓存行的调整前状态标识小于最大状态标识时,则对于状态标识大于调整前状态标识的缓存行,则保持所述缓存行的状态标识不变;
    对于状态标识小于调整前状态标识的缓存行,则将所述缓存行的状态标识各自加1。
  47. 根据权利要求41所述的装置,其特征在于,在所述处理器对所述多个缓存行各自对应的状态标识进行更新时,所述处理器用于:
    在所述状态标识的大小与所述存储时长之间呈正相关时,将所述第一缓存行的状态标识置零,并将多个缓存行中的其他缓存行各自所对应的状态标识加一;
    在所述状态标识的大小与所述存储时长之间呈负相关时,将所述第一缓存行的状态标识配置为最大状态标识,并将多个缓存行中的其他缓存行各自所对应的状态标识减一。
  48. 根据权利要求40-47中任意一项所述的装置,其特征在于,在所述多个缓存行的数量为N时,所述状态标识所对应的二进制数的位数为log 2(N)。
  49. 一种计算机可读存储介质,其特征在于,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于实现权利要求1-15中任意一项所述的访问缓存行的方法。
  50. 一种计算机可读存储介质,其特征在于,所述存储介质为计算机可读存储介质,该计算机可读存储介质中存储有程序指令,所述程序指令用于实现权利要求16-24中任意一项所述的访问缓存行的方法。
PCT/CN2021/090189 2021-04-27 2021-04-27 访问缓存行的方法和装置 WO2022226770A1 (zh)

Priority Applications (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/090189 WO2022226770A1 (zh) 2021-04-27 2021-04-27 访问缓存行的方法和装置

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
PCT/CN2021/090189 WO2022226770A1 (zh) 2021-04-27 2021-04-27 访问缓存行的方法和装置

Publications (1)

Publication Number Publication Date
WO2022226770A1 true WO2022226770A1 (zh) 2022-11-03

Family

ID=83847639

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/090189 WO2022226770A1 (zh) 2021-04-27 2021-04-27 访问缓存行的方法和装置

Country Status (1)

Country Link
WO (1) WO2022226770A1 (zh)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060036811A1 (en) * 2004-08-11 2006-02-16 International Business Machines Corporation Method for software controllable dynamically lockable cache line replacement system
CN101286140A (zh) * 2007-04-12 2008-10-15 智多微电子(上海)有限公司 一种采用lru替换算法的缓存
CN101866318A (zh) * 2010-06-13 2010-10-20 北京北大众志微系统科技有限责任公司 一种高速缓存替换策略的管理系统及方法
CN102799538A (zh) * 2012-08-03 2012-11-28 中国人民解放军国防科学技术大学 一种基于分组LRU的Cache替换算法
CN112612727A (zh) * 2020-12-08 2021-04-06 海光信息技术股份有限公司 一种高速缓存行替换方法、装置及电子设备

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20060036811A1 (en) * 2004-08-11 2006-02-16 International Business Machines Corporation Method for software controllable dynamically lockable cache line replacement system
CN101286140A (zh) * 2007-04-12 2008-10-15 智多微电子(上海)有限公司 一种采用lru替换算法的缓存
CN101866318A (zh) * 2010-06-13 2010-10-20 北京北大众志微系统科技有限责任公司 一种高速缓存替换策略的管理系统及方法
CN102799538A (zh) * 2012-08-03 2012-11-28 中国人民解放军国防科学技术大学 一种基于分组LRU的Cache替换算法
CN112612727A (zh) * 2020-12-08 2021-04-06 海光信息技术股份有限公司 一种高速缓存行替换方法、装置及电子设备

Similar Documents

Publication Publication Date Title
TWI627536B (zh) 用於具有調適分割之一共用快取之系統及方法
US10242050B2 (en) Database caching in a database system
JP6356675B2 (ja) 集約/グループ化動作:ハッシュテーブル法のハードウェア実装
US11561930B2 (en) Independent evictions from datastore accelerator fleet nodes
CN107038123A (zh) 用于数据处理系统中的缓存一致性的探听过滤器
CN108009008A (zh) 数据处理方法和系统、电子设备
US10853193B2 (en) Database system recovery using non-volatile system memory
CN105938458B (zh) 软件定义的异构混合内存管理方法
KR102449585B1 (ko) 버저닝 저장 장치 및 방법
CN107066397A (zh) 剖析缓存替换
CN107077453B (zh) 用于使用集群缓存进行数据库查询的并行优化的系统和方法
WO2017117734A1 (zh) 一种缓存管理方法、缓存控制器以及计算机系统
WO2020199760A1 (zh) 数据存储方法、存储器和服务器
WO2019128958A1 (zh) 缓存替换技术
WO2023000536A1 (zh) 一种数据处理方法、系统、设备以及介质
US10705977B2 (en) Method of dirty cache line eviction
CN109086462A (zh) 一种分布式文件系统中元数据的管理方法
US10146833B1 (en) Write-back techniques at datastore accelerators
US20220385732A1 (en) Allocation of distributed cache
WO2022226770A1 (zh) 访问缓存行的方法和装置
CN115129618A (zh) 用于优化数据缓存的方法和设备
CN107656992B (zh) 面向多插入源的快照版本管理方法
WO2019201091A1 (zh) 一种数据处理方法、设备和计算机可读存储介质
US11775433B2 (en) Cache management for search optimization
US10936501B2 (en) Cache management for search optimization

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: 21938257

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: 21938257

Country of ref document: EP

Kind code of ref document: A1