Operating Systems MCQs with Explanation

When a memory write operation updates both main memory and cache memory it is called

  1. Write-through 
  2. Write-back
  3. Write-once
  4. None of these



Answer:
Option a: Write-through

What is write-through policy?

When a memory write operation updates both main memory and cache memory, it is called write-through.

In write-through, every time data is written to the cache, it is also written to main memory. This ensures that the data in main memory is always up-to-date, even if the cache is updated multiple times. Write-through is a simple and reliable way to maintain data consistency between the cache and main memory. But it can be slower than write-back, as every write operation requires two updates.

What is write-back operation?

Write-back means, the data is initially written to only cache memory. This data is updated to main memory (only once) when that cache block is no longer  needed. 

However, this means that there is a risk of data loss if the cache is lost or corrupted.

What is write-once operation?

Write-once is a caching policy that is used for data that is not modified after it is written to the cache. In write-once, data is written to the cache once, and then never modified. This ensures that the data in the cache is always consistent with the data in main memory. 

Write-once can be inefficient for data that is frequently modified.


Post a Comment

0 Comments