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 CS Theory concepts for SDE interviews with the CS Theory Course at a student-friendly price and become industry ready.
- Write Through and Write Back in Cache
- Difference Between Go-Back-N and Selective Repeat Protocol
- Back-off Algorithm for CSMA/CD
- Implementation of a Back-off Algorithm for CSMA/CD
- Differences between wait() and join() methods in Java
- Difference between the Constructors and Methods
- Difference between next() and nextLine() methods in Java
- Human - Computer interaction through the ages
- PSU Recruitment through GATE
- How to Earn Money While Studying in College through Coding?
- Generating RGBA portable graphic images through C++
- Main difference between Timestamp protocol and Thomos write rule in DBMS
- Difference between Console.Write and Console.WriteLine in C#
- Green vs Native Threads and Deprecated Methods in Java
- Data Hazards and its Handling Methods
- Understanding storage of static methods and static variables in Java
- Methods in Interprocess Communication
- Methods on NumPy.add()
- File Access Methods in Operating System
- Types of Static Analysis Methods
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.