1
$\begingroup$

When the CPU writes or reads from the memory and stores the value that was read or written into L1 cache. Do the CPU store the whole block( 1 block , leaves the other three ways empty) or the whole set ( 4 blocks)?

$\endgroup$
  • 1
    $\begingroup$ What have tou tried? Where did you get stuck? What have you read? Since it is "basic question" maybe there is "easy to find common reference"? $\endgroup$ – Evil Jul 28 '16 at 17:57
  • $\begingroup$ Yeah I was wondering how a set associative cache work. Some say that you can write to individual blocks ( one block = 1 way ) and skip the rest. (meaning leaving block(way 2) = empty, block (way 3) = empty , block ( way 4) four empty and write to block (way 1) = data) or do the CPU write to all the ways immediatly in parallell (way 1)block 1 = data,(way 2) block 2 = data , (way 3)block 3 = data ,(way 4) block 4= data). $\endgroup$ – bopia Jul 29 '16 at 9:58
2
$\begingroup$

Four way set associative does not mean 4 sets.

It means each set is of 4 blocks.

Individual block can be read or written.

Go through this document for understanding the concept of set associative cache.

$\endgroup$
  • $\begingroup$ But how do we know if individual blocks are written or all the ways ( 4 blocks each way contains 1 block) are written ? Isnt there a common rule to write to the cache or is it the hardware that decides this rule ???? $\endgroup$ – bopia Jul 29 '16 at 9:51
  • $\begingroup$ Block is collection of bytes.whenever we fetch data into cache from memory the unit of transfer is a block. $\endgroup$ – Maharaj Jul 29 '16 at 9:57
  • $\begingroup$ Ok that was the answer I was looking for thanks! $\endgroup$ – bopia Jul 29 '16 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.