0% found this document useful (0 votes)
21 views9 pages

Cache Read Write policies(3)

The document discusses cache operation read/write policies, detailing how cache addressing works, including block addressing, indexing, and the significance of valid bits. It explains cache hits and misses, block replacement strategies, and various replacement policies such as LRU and FIFO. Additionally, it covers write operations, differentiating between write hits and misses, and outlines the write allocate and write no allocate policies.

Uploaded by

mandavasanjana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
21 views9 pages

Cache Read Write policies(3)

The document discusses cache operation read/write policies, detailing how cache addressing works, including block addressing, indexing, and the significance of valid bits. It explains cache hits and misses, block replacement strategies, and various replacement policies such as LRU and FIFO. Additionally, it covers write operations, differentiating between write hits and misses, and outlines the write allocate and write no allocate policies.

Uploaded by

mandavasanjana
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Cache Operation :

Read/Write Policies

Presented by:
Dr. Amanpreet Kaur(Sr.)
Assistant Professor
Department of Electronics and Communication Engineering,
Thapar Institute of Engineering and Technology, Patiala
Cache Read operation : How is a block found if it is
in the cache?[1]
 Cache Addressing

/
INDEX

 Address from processor split up into


 BLOCK ADDRESS and OFFSETT
 BLOCK OFFSETT = LOG2(BLOCK SIZE)
 BLOCK ADDRESS => TAG AND INDEX
 INDEX = LOG2 (NO. OF SETS IN THE CACHE)
 NUMBER OF SETS IN THE CACHE = CACHE SIZE / SET SIZE
 = CACHE SIZE / SET ASSOCIATIVITY X BLOCK SIZE
Address Mapping [1]:

 Set Index field – is used to locate the desired set in the cache

 Tag field is used to locate the desired block

 A Valid bit in the TAG field indicates whether the block is empty or contains some
data.

 Block offset is used to locate the data in the respective block identified

 Cache Hit – If the address matches and the data block is found in the cache .

 Cache Miss- If the cache is empty/ Address does not match / the valid bit is zero for
that address.
Cache Miss and block Replacement [1] :
 A Cache miss causes the address from the processor to search for the
same in the next hierarchical level in the memory .

 If the cache is empty the block found from the next hierarchical level is
placed in the cache depending upon the placement policy followed .

 If the cache is already full, a replacement /policy is followed.

 For a Direct mapped cache the block replacement depends upon the
calculated block number from the formula.

 For a Fully Associative and Set Associative Cache

 The replacement of any block with the new one depends upon the
replacement policy followed.
Replacement Policy [1]:
 Random—To spread allocation uniformly,
candidate blocks are randomly selected.

 Least-recently used (LRU)—The block replaced


is the one that has been unused for the longest
time. LRU makes use of a corollary of locality: If
recently used blocks are likely to be used again,
then the best candidate for disposal is the least-
recently used block.

 FIFO- First in first out


Cache Write operation :
 A write operation for cache for a specific address cab ne a
cache write hit or a cache write miss

 Write Hit operation :


 Write through (or store through)—The information is written to
both the block in the cache and to the block in the lower-level
memory.

 Write back (also called copy back or store in)—The information


is written only to the block in the cache. The modified cache block is
written to main memory only when it is replaced.
 Dirty bit: This status bit indicates whether the block is dirty
(modified while in the cache) or clean (not modified). If it is
clean, block is not written on a miss, since the next level has
Cache Write operation(contd.) :
 Cache Write Miss
 A write miss for cache means that the address from the CPU
for a Write operation is not found in the cache .

 Therefore the address is searched in the next hierarchical level


of the memory

 The respective location is written into and a copy of the data is


maintained in Cache depending upon two main policies:

 Write Allocate :The block is loaded on a write miss, followed by the


write-hit actions above.

 Write no Allocate :The block is modified in the lower level and not
loaded into the cache.
References :
 [1].Computer Architecture: A Quantitative Approach, 2 nd
edition , John L. Hennessy, David A. Patterson

You might also like