Prerequisite – Write Through and Write Back in Cache
During a read operation, when the CPU determines a word in the cache, the main memory is not included in the transfer. Thus, there are two ways that the system can proceed when the operation is a write.
1. Write Through Method : The simplest method is to update the main memory with every memory write operation, when the cache memory is update in parallel when it contains the word at the specified address. This can be known as the write through method.
2. Write Back Method :
During write operation, only the cache location is updated in the write back method. Then, the location is marked by a flag so that it is later copied to the main memory when the word is removed from the cache. For the write back method, the reason is that during the time a word remains in the cache, it can be updated multiple times. Thus, as long as the word remains in the cache, it does not matter if the copy in the main cache. This is only when the word is displaced from the cache which needs an exact copy that is rewritten into main memory.
Differentiate Between Write Through and Write Back Methods :
|S.No.||Write Through Method||Write Back Method|
|1||In this method main memory is updated with every memory write operation as well as cache memory is updated in parallel if it contains the word at the specified address.||In this method only cache location is updated during write operation.|
|2||Main memory always contains same data as cache.||Main memory and cache memory may have different data.|
|3||Number of memory write operation in a typical program is more.||Numeber of memory write operation in a typical program is less|
|4||When I/O device communicated through DMA would receive most recent data.||When I/O device communicated through DMA would not receive most recent data.|
|5||It is a process of writing cache and main memory simultaneously.||It is a process of writing cache and data is removed from cache, first copied to main memory.|
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Write Through and Write Back in Cache
- Thomas Write Rule in DBMS
- Journaling or write-ahead logging
- Read and Write operations in Memory
- Main difference between Timestamp protocol and Thomos write rule in DBMS
- Difference between Console.Write and Console.WriteLine in C#
- Back-off Algorithm for CSMA/CD
- Implementation of a Back-off Algorithm for CSMA/CD
- Difference Between Go-Back-N and Selective Repeat Protocol
- Methods on NumPy.add()
- Methods in Interprocess Communication
- Memory Access Methods
- Methods vs. Functions in C++ with Examples
- Difference between the Constructors and Methods
- ReactJS | Methods as Props
- Data Hazards and its Handling Methods
- Difference between next() and nextLine() methods in Java
- Types of Static Analysis Methods
- Implementation of file allocation methods using vectors
- Differences between wait() and join() methods in Java
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.