Electrical computers and digital processing systems: memory – Storage accessing and control – Hierarchical memories
Reexamination Certificate
1999-03-16
2002-02-26
Kim, Matthew (Department: 2186)
Electrical computers and digital processing systems: memory
Storage accessing and control
Hierarchical memories
C711S133000, C711S148000, C711S142000, C711S143000, C711S144000, C711S145000, C711S146000
Reexamination Certificate
active
06351790
ABSTRACT:
FIELD OF THE INVENTION
The present invention relates to a computer system and to a cache coherency mechanism therefor.
BACKGROUND TO THE INVENTION
As is well known in the art, cache memories are used in computer systems to decrease the access latency to certain data and code and to decrease the memory bandwidth used for that data and code. A cache memory can delay, aggregate and reorder memory accesses.
A cache memory operates between a processor and a main memory of a computer. Data and/or instructions which are required by the process running on the processor can be held in the cache while that process runs. An access to the cache is normally much quicker than an access to main memory. If the processor does not locate a required data item or instruction item in the cache memory, it directly accesses main memory to retrieve it, and the requested data or instruction item is loaded into the cache. There are various known systems for using and refilling cache memories.
A computer system may have more than one processor, and each processor may have its own cache. Alternatively, a processor may have a plurality of CPUs, each with its own cache. However, these caches will commonly access a single main memory resource.
FIG. 1
illustrates a case where there are two processors (2) CPU
1
, CPU
2
each with their own cache (
22
) CACHE
1
, CACHE
2
. The caches share a single memory resource MEM(
6
).
FIG. 2
shows what can happen in such a situation. Consider an address in main memory
1010
. This maps onto cache location
10
in both CACHE
1
and CACHE
2
. The value V
3
stored at address
1010
had an initial value of X, and the value V
3
=X was initially stored at cache location
10
in both of the caches. At that stage, the data item V
3
was “visible”, that is either the processor accessing address
1010
would retrieve from its cache the value V
3
=X. However, the CPU
1
has executed a process, modified the value V
3
=Y and returned this to the location
10
in CACHE
1
. Now, the value V
3
=X in main memory is “dirty”—it no longer reflects the current value of V
3
. Moreover, the value V
3
=X in CACHE
2
is “stale”—it differs from the true value. Clearly, this situation needs to be rectified before CPU
2
attempts to retrieve V
3
, because otherwise it will wrongly retrieve V
3
=X.
Thus cache coherency control is required to ensure that several processors and devices can correctly share memory. This can be achieved by:
1. Automatic coherency. Additional hardware guarantees that loads can retrieve the most recently written value regardless of which processor or device wrote it. Note that a functional, but low performance, implementation of automatic coherency is to disable the cache. Such additional hardware COHERE is referenced
3
in FIG.
1
.
2. Software coherency. Special code sequences are used in the program to control the transfer of data between cache and memory. They allow precise control of coherency and efficient use of the cache.
The visibility of data depends on whether the cache is automatically coherent or not. If the cache is not automatically coherent then only the contents of memory and its own cache are visible to a processor. Software has to cooperate to ensure that data is written to memory when appropriate. If the cache is automatically coherent then the most recently written value by any processor will be visible to all other processors.
Visibility Definitions
Visible A data item is visible to a processor if a load from the data item's address will return that item.
Stale A data item is stale if the value in the cache is different from the last value written.
Dirty A data item is dirty if it has been modified in the cache with respect to main memory.
In a situation where a process wishes to clear a location in the cache, but the process does not have access to the address stored at that cache location, existing software coherency techniques require usage of a special, privileged mode of processor operation termed kernel mode. In a normal user mode it is not possible in such a circumstance to render the cache coherent using software coherency techniques other than by transfer into kernel mode.
Furthermore, contemporary processors, which have flexible cache coherency mechanisms, usually require software to specify, either by a property of the page translation or by the execution of instructions, the extent to which coherency will be actively managed by instruction sequences and the extent to which hardware will be responsible for maintaining coherency. This leads to the problem that code written for one model will not provide coherency if implemented on hardware with different coherency restrictions. For example, software written assuming a hardware coherency mechanism (e.g. MESI) will not generally run correctly on implementations for which no specific hardware has been provided.
SUMMARY OF THE INVENTION
According to one aspect of the present invention there is provided a computer system comprising a plurality of processors, each comprising an execution unit for executing a sequence of instructions and at least one of the processors having associated there with a cache memory having a plurality of cache locations for holding items for use by the processor; storage circuitry having addressable storage locations in the memory address space of said at least one processor in which items are stored for use by the processors; a behaviour store for holding in association with an address of an item a cache behaviour identifying the cacheable behaviour of the item, wherein the cacheable behaviours include a software coherent behaviour and an automatically coherent behaviour and wherein the instructions for execution by the execution unit include cache coherency instructions which each specify an operation to be executed on the contents of a cache location and an address in the storage circuitry; each processor being operable responsive to the cache coherency instructions to execute an operation on the contents of the specified cache location and to effect a cache coherency operation to render the contents coherent with the storage circuitry in a manner dependent on the cacheable behaviour of the specified address and whether or not the processor contains a cache coherency unit for automatically implementing coherency.
Where the computer comprises a cache coherency unit for automatically implementing coherency, the cache coherency instructions effect a cache coherency operation for automatically coherent and software coherent behaviour dependent on the nature of the cache coherency unit. Where the computer system has no cache coherency unit for automatically implementing coherency, items having an automatically coherent behaviour are denied access to the cache memory.
In the computer system, each of the processors can have a respective cache memory associated therewith. The storage circuitry can be a main memory accessible by all the processors.
In the cache memory, each item can be stored in association with a valid bit (which indicates whether or not that item is valid) and/or a dirty bit (which indicates whether or not that item has been modified with respect to the main memory).
The cacheable behaviours can include:
an unshared behaviour for items unique to one of said processors;
an uncacheable behaviour for accesses to memory devices other than said storage circuitry; and
a device behaviour for accesses to devices other than memory devices, said devices being addressable in the memory address space of the processors.
One type of cache coherency instruction is a flush instruction which makes dirty items in the cache memory associated with said at least one processor visible to the other processors.
Another cache coherency instruction is a purge instruction which removes items from the cache memory.
Another type of cache coherency instruction is a validate instruction which ensures that stale items are not read from the cache memory.
According to another aspect of the present invention there is provided a method of m
Kim Matthew
Morris James H.
Peugh R.
STMicroelectronics Limited
Wolf Greenfield & Sacks P.C.
LandOfFree
Cache coherency mechanism does not yet have a rating. At this time, there are no reviews or comments for this patent.
If you have personal experience with Cache coherency mechanism, we encourage you to share that experience with our LandOfFree.com community. Your opinion is very important and Cache coherency mechanism will most certainly appreciate the feedback.
Profile ID: LFUS-PAI-O-2964917