You have an L1 cache with a write through nonwrite allocate
You have an L1 cache with a write through, non-write allocate policy, and an L2 cache with a write back, write allocate policy. What will happen on a write miss in the L1 cache? Consider both the case of the block being in L2, and having to go to main memory to fetch the block.
Solution
A catche is write through,non write allocate policy:
The only thing that change s from the case is what happens if we have a write miss
On a write miss,we pay WH + WLL only.since catche is no-write-allocate we dont read a block on a write miss.
Read_time_for_this_catche will be R=RH + miss_rate*RLL
write_time_for_this_catche will be W=WH + WLL
catche with write back ,write allocate policy:
. On a read hit let RH be the time needed to get the daya from this catche to one level higher.the size of data we are getting is sixe that a higher level needs. On a read miss,we pay RH plus we pay some time E to evict one block from this catche to a lower level plus we pay RLL to read one block from lower level.if the block we are evict ing is not dirty,then the E is zero otherwise E is sometime D which is the time needed to write a block.one level lower.in all those cases a block size is for this catche.
Read_time_for_this_catche will be R = RH+miss_rate*(RLL + E)=RH+miss_rate*(RLL + %dirty*D)
Write_time_for_this_catche will be W = WH+miss_rate*(RLL +E)=WH + miss_rate*(RLL + %dirty*D)
A catche with a write back policy(and write allocate) reads an entire block (catcheline) from memory on a catche miss,may need to write dirty catcheline first.
Any thing writes to memory need to be the entire catcheline.since there is no way to distinguish which word was dirty with only a single dirty bit.Evictions of a dirty catcheline cause a write to memory.
