Question

In: Computer Science

In the implementation of a cache replacement policies, some write policies are employed. Explain two of...

In the implementation of a cache replacement policies, some write policies are employed. Explain two of them. What is the relevance of a dirty block or bit in cache replacement policies?

Solutions

Expert Solution

The 2 cache replacement write policies are :

  • Write back replacement policy
  • Write through replacement policy

In write back cache, when the contents of the cache are updated after the CPU executes an instruction, the contents of the block are written back to main memory when the cache block is replaced by some other block. This can be illustrated by the following example :

Suppose instruction I1 is executed by CPU and it requires the cache block B1 which contains the value of a variable a as 5. This is also present in the main memory too. Every cache block has a dirty bit and when some new value is updated in a particular cache block, the corresponding value of the dirty bit changes from 0 to 1.

After the instruction is executed, let the value of a be changed from a = 5 to a = 10. In write back technique, the value is changed only on the cache and it will changed in main memory after sometime. Since an updation occurs, the value of dirty bit of cache block B1 will change from 0 to 1.

After executing some instructions, let the cache block B1 be present in the cache and the value of a is updated only in the cache and not in main memory as of now.

Then, after sometime, an instruction I12 is executed and a block B2 is needed which is currently not in cache.and it is mapped to the same location in cache as that of block B1. So, there is a conflict miss in the cache. Hence, the block B1 has to be replaced.

Now, when the main memory finds out that the value of dirty bit of block B1 is 1, it will update its value from a = 5 to a = 10 and so the main memory will also be updated.

So, this concludes that the updation in main memory takes place when the cache block with dirty bit 1 that is dirty block is replaced during the write back procedure.

Write through is the cache replacement technique which updates the main memory at the same time the cache is updated during execution. This can be illustrated using the following diagram :

So, this concludes that the updation in main memory takes place at the same time as that of the cache during write through procedure.


Related Solutions

Discuss some of the alternative policies that could have been employed for COVID-19.
Discuss some of the alternative policies that could have been employed for COVID-19.
Write and explain accounting policies for organization
Write and explain accounting policies for organization
WRITE AND EXPLAIN ACCOUNTING POLICIES FOR AN INTERNATIONAL ORGANIZATION
WRITE AND EXPLAIN ACCOUNTING POLICIES FOR AN INTERNATIONAL ORGANIZATION
Identify common reuse practices that are employed in the requirements, design and implementation activities of a...
Identify common reuse practices that are employed in the requirements, design and implementation activities of a project. Explain under what circumstances each practice is / can be employed. b. Consider the DataSource class in Case Study 2. Explain how inheritance is intended to be used with this class. Does this represent a good use of inheritance? Explain your answer.
Identify common reuse practices that are employed in the requirements, design and implementation activities of a...
Identify common reuse practices that are employed in the requirements, design and implementation activities of a project. Explain under what circumstances each practice is / can be employed.
Identify common reuse practices that are employed in the requirements, design and implementation activities of a...
Identify common reuse practices that are employed in the requirements, design and implementation activities of a project. Explain under what circumstances each practice is / can be employed.
With the implementation of the Affordable Care Act discuss: How are the policies of the Exchange...
With the implementation of the Affordable Care Act discuss: How are the policies of the Exchange identified in NYS? Are they all the same cost? What disparities have the beneficiaries of the Exchange insurance policies experienced? Name at lease 3 disparities (challenges) and discuss the impact to their healthcare services.
What are barriers in society that prevent the implementation of certain social policies?
What are barriers in society that prevent the implementation of certain social policies?
Discuss the political economy of trade policies. Explain why some policies get implemented even though they...
Discuss the political economy of trade policies. Explain why some policies get implemented even though they may be against economic principles.
explain some of the policies and pieces of legislation that transformed the self government of first...
explain some of the policies and pieces of legislation that transformed the self government of first people to state control as outlined by Mawhiney and Hardy
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT