GB2214669A - Cache memory - Google Patents

Cache memory Download PDF

Info

Publication number
GB2214669A
GB2214669A GB8825243A GB8825243A GB2214669A GB 2214669 A GB2214669 A GB 2214669A GB 8825243 A GB8825243 A GB 8825243A GB 8825243 A GB8825243 A GB 8825243A GB 2214669 A GB2214669 A GB 2214669A
Authority
GB
United Kingdom
Prior art keywords
cache memory
recently used
data
cache
data item
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
GB8825243A
Other versions
GB8825243D0 (en
GB2214669B (en
Inventor
David Paul Crane
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fujitsu Services Ltd
Original Assignee
Fujitsu Services Ltd
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 Fujitsu Services Ltd filed Critical Fujitsu Services Ltd
Publication of GB8825243D0 publication Critical patent/GB8825243D0/en
Publication of GB2214669A publication Critical patent/GB2214669A/en
Application granted granted Critical
Publication of GB2214669B publication Critical patent/GB2214669B/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

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

Abstract

A cache memory has a RAM 23 for holding flags pointing to the most recently used data item in each of a plurality of sets. When a data item is loaded into the cache, the item to be replaced is selected by excluding the most recently used item in the set in question, and selecting one of the remaining items on a non-usage basis, for example a random basis. This not-most-recently-used (NMRU) replacement algorithm requires fewer storage bits than a conventional least-recently- used (LRU) replacement algorithm, while giving better performance than a purely non-usage based replacement algorithm. <IMAGE>

Description

CACHE MEMORY.
Background to the invention.
This invention relates to cache memories.
In a data processing system, it is known to include a cache memory between the processing unit and the main memory. The cache is of smaller size than the main memory, but has a faster access speed, and serves to match the speed requirements of the processing unit to the relatively slow access speed of the main memory.
Caches are described for example in "Cache Memories" by A.J. Smith, ACM Computing surveys, September 1982, page 473.
Whenever the processing unit requires to access a data item, the cache is inspected to determine whether that item is currently resident in the cache. If so, the item can be accessed immediately. If not, then the item must be fetched from the main memory and loaded into the cache, replacing one of the existing data items in the cache.
In general a given data item may be held in any of a number of different locations in the cache. For example, in a fully associative cache, a data item may be held anywhere in the cache, whereas in a set-associative cache, a data item may be held in any of a particular set of locations. When a new data item is to be loaded into the cache, it is necessary to decide which of the possible locations is to be replaced.
This decision is referred to as the cache replacement algorithm.
Known cache replacement algorithms are divided into usage-based and non-usage based. Usage-based algorithmns take account of the history of usage of the data items in the cache so as to select, for example, the least recently used item for replacement. In general, usage-based algorithms result in a significantly lower cache miss rate, and hence a higher performance, than non-usage based algoritmns. However, they do this at a significantly higher cost in terms of the hardware required to implement the replacement algorithm.
The object of the present invention is to provide a cache store with a replacement algorithm which provides better performance than conventional non-usage-based systems, at a lower cost than usage-based systems.
Summary of the invention.
According to the invention, there is provided a cache memory holding a plurality of data items, and including: (a) indication means for indicating the most recently used data item in said plurality of data items, and (b) replacement means responsive to said indication means, for selecting one of said data items, excluding the most recently used data item, on a non-usage basis.
It can be seen that the invention gives a better performance than conventional non-usage based algorithms, since it ensures that the most recently used item is not selected for replacement. This is consistent with the cache philosophy that information used recently is likely to be used again in the near future. On the other hand, the invention requires less hardware than a least-recently used algorithm, since substantially fewer bits are required to remember the most recently used location than to store the usage information for identifying the least-recently used location.
Brief description of the drawings.
One cache memory in accordance with the invention will now be described by way of example with reference to the accompanying drawings.
Figure 1 is a block diagram of a computer system incorporating a cache memory.
Figure 2 is a more detailed block diagram of the cache memory.
Figure 3 is a more detailed block diagram of a replacement selection circuit within the cache memory.
Description of an embodiment of the invention.
Referring to Figure 1, the computer system comprises a central processing unit 10, a main memory 11, and a cache memory 12. The cache memory is of smaller size than the main memory, and has a substantially faster access speed.
Referring to Figure 2, the cache 12 comprises a data random-access memory (RAM) 20 and a tag RAM 21. As shown, each of these RAMs consists of four sections.
The cache receives an input address ADDR from the processing unit. This address comprises two portions, referred to as INDEX and the TAG. The INDEX portion of the address is applied to the address inputs of both the data RAM and the tag RAM, so as to select a set of data items and their corresponding four tags.
The tag RAM 21 includes comparators (not shown) which compare the TAG portion of the address with the selected set of four tags. If any of the tags matches the TAG portion, a MATCH signal is produced on one of four output lines 22. This enables the corresponding one of the four sections of the data RAM 20, so as to allow the corresponding data item to be accessed for reading or writing, as required.
As described so far, the cache memory is a conventional four-way set-associative cache.
This cache also includes a further RAM 23, referred to herein as the most recently used (MRU) RAM.
This holds a 2-bit flag for each set of data items in the data RAM, indicating which of the four items in the set has been used (i.e written or read) most recently.
The MRU RAM is addressed by the INDEX portion of the address, so that whenever one of the sets of data items is selected, the corresponding MRU flag is accessed.
The four MATCH signals from the tag RAM 21 are combined in an OR gate 24, to produce a HIT signal if any one of the MATCH signals is true. The HIT signal therefore indicates that the required data item, as specified by the input address ADDR, is available in the cache. The OR gate 24 also produces a MISS signal, which is the inverse of HIT.
The four MATCH signals are also applied to a 4:2 encoder 25, which produces a 2-bit code indicating which of the four sections of the data RAM contains the required data item. This code is fed to the data input of the MRU RAM 23. The HIT signal is fed to the write enable input of the RAM 23, so that, when HIT is true, the 2-bit code is written into the currently addressed location of the RAM23.
Thus, it can be seen that whenever the required data item is found to be in the cache, the MRU RAM 23 is updated, to indicate that this data item is the most recently used item of the set in question.
On a miss, the MRU flag from the RAM 23 is applied to a replacement selection circuit 26, which generates a 2-bit signal NMRU (not most recently used) which points to one of the data items in the currently addressed set, other than the most recently used item.
The NMRU signal is fed to a 2:4 decoder 27 which, when enabled, produces one of four write enable signals WEO-WE3. These signals are applied to the write enable inputs of the four sections of the data RAM 20, and also of the tag RAM 21.
Whenever a required data item is not present in the cache, the MISS signal is produced. This enables conventional logic (not shown) for fetching the required data item from the main memory for the cache. When the data is ready, this logic produces a signal DATA READY.
The signal DATA READY and MISS together enable the decoder 27, which in turn causes one of the four sections of the data RAM 20 to be enabled for writing.
This causes the data item from the main memory to be written into one of the four locations of the currently addressed set, replacing the previous data item. The data item to be replaced is selected by the signal NMRU, and is therefore not the most-recently used item.
Referring now to Figure 3, this shows the replacement selection circuit 26 in more detail.
This circuit includes a free-running 2-bit counter 30 which produces an output count value which continuously cycles through the values 0-3. The count value is compared with the signal MRU in a comparator 31.
The replacement selection circuit also includes a multiplexer 32, one input of which receives the count value from the counter 30, and the other input of which receives the inverse of this count value. The multiplexer 32 is controlled by the output of the comparator 31, such that, when the count is not equal to MRU, the multiplexer selects the count value, and when the count value is equal to MRU, the inverse of the count value is selected.
The output of the multiplexer 32 provides the signal NMRU which selects the data item to be replaced.
It can be seen that the signal NMRU is never equal to MRU, and is selected at random from one of the three count values not equal to MRU. For example, if MRU equals 2, then NMRU is selected at random from the values 0, 1, and 3.
In an alternative form of the invention, the circuit of Figure 3 may be replaced by a circuit which simply inverts one of the bits of MRU to produce NMRU.
It can be seen that, in general, if there are N data items in each set in the cache, the NMRU replacement algorithm described above requires log2N bits of storage per set. By way of comparison, the conventional LRU (least recently used) replacement algorithm typically requires N(N-1)/2 bits of storage per set. For example, if N=4, then the NMRU algorithm requires 2 bits/set, while the LRU algorithm requires 6 bits/set. Thus, the NMRU algorithm leads to a substantial saving in hardware.
It will be appreciated that while the invention has been described above in the context of a set-associative cache, the invention is equally applicable to a fully-associative cache organisation. In that case, the MRU flag would indicate the most recently used item in the cache as a whole.

Claims (9)

CLAIMS.
1. A cache memory holding a plurality of data items, and comprising: (a) indication means for indicating the most recently used data item in said plurality of data items, and (b) replacement means responsive to said indication means, for selecting one of said data items, excluding the most recently used data item, on a non-usage basis.
2. A cache memory according to Claim 1 wherein said replacement means comprises: (a) means for making a selection of one of the data items on a non-usage basis, and (b) means for modifying said selection in the event that the most recently used data item is selected.
3. A cache memory according to Claim 2 wherein said means for making a selection on a non-usage basis comprises means for selecting one of the data items at random.
4. A cache memory according to Claim 3 wherein said means for selecting one of the data items at random comprises a free-running counter.
5. A cache memory comprising: (a) a plurality of sets of data storage locations, each set holding a plurality of items, (b) indication means for indicating the most recently used data item in each of said sets, and (c) replacement means, responsive to the indication means, for selecting one of the data items from one of said sets, excluding the most recently used data item in that set, on a non-usage basis.
6. A cache memory according to Claim 5 wherein said indication means comprises a random-access memory having a plurality of individually addressable locations, one for each set, each location holding a flag indicating the most recently used data item in the corresponding set.
7. A data processing system comprising: (A) a data processing unit, (B) a main memory, and (C) a cache memory connected between the data processing unit and the main memory, the cache memory comprising (a) indication means for indicating the most recently used data item in said plurality of data items, and (b) replacement means responsive to said indication means, for selecting one of said data items, excluding the most recently used data item, on a non-usage basis.
8. A cache memory substantially as hereinbefore described with reference to the accompanying drawings.
9. A data processing system substantially as hereinbefore described with reference to the accompanying drawings.
GB8825243A 1988-01-30 1988-10-28 Cache memory Expired - Fee Related GB2214669B (en)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
GB888802102A GB8802102D0 (en) 1988-01-30 1988-01-30 Cache memory

Publications (3)

Publication Number Publication Date
GB8825243D0 GB8825243D0 (en) 1988-11-30
GB2214669A true GB2214669A (en) 1989-09-06
GB2214669B GB2214669B (en) 1991-12-11

Family

ID=10630806

Family Applications (2)

Application Number Title Priority Date Filing Date
GB888802102A Pending GB8802102D0 (en) 1988-01-30 1988-01-30 Cache memory
GB8825243A Expired - Fee Related GB2214669B (en) 1988-01-30 1988-10-28 Cache memory

Family Applications Before (1)

Application Number Title Priority Date Filing Date
GB888802102A Pending GB8802102D0 (en) 1988-01-30 1988-01-30 Cache memory

Country Status (1)

Country Link
GB (2) GB8802102D0 (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2663136A1 (en) * 1990-06-12 1991-12-13 Philips Electronique Lab Device for controlling a buffer memory and method of managing digital data
EP0593968A1 (en) * 1992-10-19 1994-04-27 Hewlett-Packard Company Cache-based data compression/decompression
US5481691A (en) * 1991-04-22 1996-01-02 International Business Machines Corporation Cache page replacement using sequential LIFO and non-sequential LRU cast out
EP0875842A2 (en) * 1997-05-02 1998-11-04 Pioneer Electronic Corporation Information retrieval apparatus, information retrieval method and navigation apparatus with information retrieval function
US5897651A (en) * 1995-11-13 1999-04-27 International Business Machines Corporation Information handling system including a direct access set associative cache and method for accessing same
WO2006085140A2 (en) * 2004-06-24 2006-08-17 Sony Computer Entertainment Inc. Disable write back on atomic reserved line in a small cache system
CN1985244B (en) * 2005-06-24 2010-05-12 捷讯研究有限公司 System and method for managing memory in a mobile device

Cited By (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
FR2663136A1 (en) * 1990-06-12 1991-12-13 Philips Electronique Lab Device for controlling a buffer memory and method of managing digital data
US5481691A (en) * 1991-04-22 1996-01-02 International Business Machines Corporation Cache page replacement using sequential LIFO and non-sequential LRU cast out
EP0593968A1 (en) * 1992-10-19 1994-04-27 Hewlett-Packard Company Cache-based data compression/decompression
EP0880100A2 (en) * 1992-10-19 1998-11-25 Hewlett-Packard Company Cache-based data compression/decompression
EP0880100A3 (en) * 1992-10-19 1999-08-25 Hewlett-Packard Company Cache-based data compression/decompression
US5897651A (en) * 1995-11-13 1999-04-27 International Business Machines Corporation Information handling system including a direct access set associative cache and method for accessing same
EP0875842A2 (en) * 1997-05-02 1998-11-04 Pioneer Electronic Corporation Information retrieval apparatus, information retrieval method and navigation apparatus with information retrieval function
EP0875842A3 (en) * 1997-05-02 2000-02-23 Pioneer Electronic Corporation Information retrieval apparatus, information retrieval method and navigation apparatus with information retrieval function
WO2006085140A2 (en) * 2004-06-24 2006-08-17 Sony Computer Entertainment Inc. Disable write back on atomic reserved line in a small cache system
WO2006085140A3 (en) * 2004-06-24 2007-08-16 Sony Computer Entertainment Inc Disable write back on atomic reserved line in a small cache system
CN1985244B (en) * 2005-06-24 2010-05-12 捷讯研究有限公司 System and method for managing memory in a mobile device

Also Published As

Publication number Publication date
GB8825243D0 (en) 1988-11-30
GB2214669B (en) 1991-12-11
GB8802102D0 (en) 1988-02-24

Similar Documents

Publication Publication Date Title
US6912623B2 (en) Method and apparatus for multithreaded cache with simplified implementation of cache replacement policy
US6990557B2 (en) Method and apparatus for multithreaded cache with cache eviction based on thread identifier
EP0232526B1 (en) Paged virtual cache system
US6282617B1 (en) Multiple variable cache replacement policy
US5465342A (en) Dynamically adaptive set associativity for cache memories
US5133058A (en) Page-tagging translation look-aside buffer for a computer memory system
US5353426A (en) Cache miss buffer adapted to satisfy read requests to portions of a cache fill in progress without waiting for the cache fill to complete
US6405287B1 (en) Cache line replacement using cache status to bias way selection
US6023747A (en) Method and system for handling conflicts between cache operation requests in a data processing system
US7020748B2 (en) Cache replacement policy to mitigate pollution in multicore processors
KR20030025297A (en) Fast and accurate cache way selection
KR100285533B1 (en) Write-Through Virtual Cache Memory, Alias Addressing, and Cache Flush
US6571316B1 (en) Cache memory array for multiple address spaces
GB2293672A (en) Virtual page memory buffer
US20100011165A1 (en) Cache management systems and methods
US6145057A (en) Precise method and system for selecting an alternative cache entry for replacement in response to a conflict between cache operation requests
WO2001088716A1 (en) Method for controlling cache system comprising direct-mapped cache and fully-associative buffer
EP0365117A2 (en) Data-processing apparatus including a cache memory
US5953747A (en) Apparatus and method for serialized set prediction
US6049849A (en) Imprecise method and system for selecting an alternative cache entry for replacement in response to a conflict between cache operation requests
US6434670B1 (en) Method and apparatus for efficiently managing caches with non-power-of-two congruence classes
GB2214669A (en) Cache memory
US5555379A (en) Cache controller index address generator
EP2866148B1 (en) Storage system having tag storage device with multiple tag entries associated with same data storage line for data recycling and related tag storage device
US7302530B2 (en) Method of updating cache state information where stores only read the cache state information upon entering the queue

Legal Events

Date Code Title Description
PCNP Patent ceased through non-payment of renewal fee

Effective date: 20041028