Cache Placement


There are many placement schemes for placing a block in the cache. The following figures show the location of a memory block whose address is 12 in a cache with eight blocks varies for (i) direct-mapped, (ii) set-associative, and (iii) fully associative placement.

Direct-Mapped Cache
In direct-mapped placement, a block can be placed in exactly one location. There is only one cache block where memory block 12 can be found, and that block is given by “12 modulo 8=4” because
 (Block #) modulo (# of blocks in cache)
Set-Associative Cache
It is a cache that has a fixed number of locations (at least two) where each block can be placed. In a two-way set-associative cache, there would be four sets, and memory block 12 must be in set “12 modulo 4=0;” the memory block could be in either element of the set because
 (Block #) modulo (# of sets in cache)
Fully-Associative Cache
It is a cache structure in which a block can be placed any location in the cache. In a fully associative placement, the memory block for block address 12 can appear in any of the eight cache blocks. To find a given block, all the entries in the cache must be searched because a block can be placed in any one.




      “My soul is in the sky.”    
      ― William Shakespeare, A Midsummer Night’s Dream