Open In App

Cache Coherence Protocols in Multiprocessor System

Improve
Improve
Like Article
Like
Save
Share
Report

Prerequisite – Cache Memory 
In multiprocessor system where many processes needs a copy of same memory block, the maintenance of consistency among these copies raises a problem referred to as Cache Coherence Problem. 
This occurs mainly due to these causes:-

  • Sharing of writable data.
  • Process migration.
  • Inconsistency due to I/O.

Cache Coherence Protocols: 
These are explained as following below:

 1. MSI Protocol: 
This is a basic cache coherence protocol used in multiprocessor system. The letters of protocol name identify possible states in which a cache can be. So, for MSI each block can have one of the following possible states:

  • Modified – 
    The block has been modified in cache, i.e., the data in the cache is inconsistent with the backing store (memory). So, a cache with a block in “M” state has responsibility to write the block to backing store when it is evicted.
  • Shared – 
    This block is not modified and is present in atleast one cache. The cache can evict the data without writing it to backing store.
  • Invalid – 
    This block is invalid and must be fetched from memory or from another cache if it is to be stored in this cache.

2. MOSI Protocol: 
This protocol is an extension of MSI protocol. It adds the following state in MSI protocol:

  • Owned – 
    It indicates that the present processor owns this block and will service requests from other processors for the block.

3. MESI Protocol – 
It is the most widely used cache coherence protocol. Every cache line is marked with one the following states:

  • Modified – 
    This indicates that the cache line is present in current cache only and is dirty i.e its value is different from the main memory. The cache is required to write the data back to main memory in future, before permitting any other read of invalid main memory state.
  • Exclusive – 
    This indicates that the cache line is present in current cache only and is clean i.e its value matches the main memory value.
  • Shared – 
    It indicates that this cache line may be stored in other caches of the machine.
  • Invalid – 
    It indicates that this cache line is invalid.

4. MOESI Protocol: 
This is a full cache coherence protocol that encompasses all of the possible states commonly used in other protocols. Each cache line is in one of the following states:

  • Modified – 
    A cache line in this state holds the most recent, correct copy of the data while the copy in the main memory is incorrect and no other processor holds a copy.
  • Owned – 
    A cache line in this state holds the most recent, correct copy of the data. It is similar to shared state in that other processors can hold a copy of most recent, correct data and unlike shared state however, copy in main memory can be incorrect. Only one processor can hold the data in owned state while all other processors must hold the data in shared state.
  • Exclusive – 
    A cache line in this state holds the most recent, correct copy of the data. The main memory copy is also most recent, correct copy of data while no other holds a copy of data.
  • Shared – 
    A cache line in this state holds the most recent, correct copy of the data. Other processors in system may hold copies of data in shared state as well. The main memory copy is also the most recent, correct copy of the data, if no other processor holds it in owned state.
  • Invalid – 
    A cache line in this state does not hold a valid copy of data. Valid copies of data can be either in main memory or another processor cache.

Last Updated : 23 Dec, 2022
Like Article
Save Article
Previous
Next
Share your thoughts in the comments
Similar Reads