How do MCUs handle cache coherence in multi-core architectures?
Technical Blog / Author: icDirectory / Date: Apr 06, 2024 15:04
Let%27s delve into how microcontrollers (MCUs) manage cache coherence in multi-core architectures.

1. What is Cache Coherence?
- Cache coherence ensures that multiple cores (processors) in a multi-core system observe a consistent view of shared memory.
- When multiple cores have private caches, maintaining coherence becomes crucial to avoid data inconsistencies.

2. Why is Cache Coherence Necessary?
- Without cache coherence, different cores may have stale data (outdated copies) in their caches.
- Inconsistent data can lead to incorrect program behavior, race conditions, and unexpected results.

3. Challenges in Multi-Core Systems:
- Private Caches: Each core has its own private cache.
- Shared Memory: All cores access the same main memory.
- Parallel Execution: Cores execute instructions concurrently.
- Data Sharing: Cores read and write shared data.

4. Cache Coherence Protocols:
- Snooping-Based Protocols:
- Cores monitor each other%27s cache actions via a shared bus.
- When a core writes to a memory location, other cores invalidate their copies.
- Examples: MESI (Modified, Exclusive, Shared, Invalid), MOESI (Modified, Owned, Exclusive, Shared, Invalid).
- Directory-Based Protocols:
- A central directory tracks which cores have copies of each memory block.
- Cores request permission from the directory before accessing shared data.
- Examples: MSI (Modified, Shared, Invalid), MESIF (Modified, Exclusive, Shared, Invalid, Forward).

5. Write Propagation and Serialization:
- Write Propagation: Ensures that writes eventually become visible to all cores.
- Write Serialization: Ensures that writes to the same location are serialized (all cores see them in the same order).

6. Example: Snooping-Based Protocol:
- Core 1 writes to a memory location.
- Other cores observe this action via the shared bus.
- Coherence protocol ensures that all cores invalidate their copies of the modified data.

7. Benefits of Cache Coherence:
- Correctness: Ensures data consistency across cores.
- Performance: Allows efficient parallel execution.
- Predictability: Guarantees expected behavior.

In summary, cache coherence protocols enforce rules to maintain consistent data across cores, preventing stale cache lines and ensuring reliable multi-core operation¹³.


(1) Cache in Multicore Systems: Staying Coherent - Inside the IoT. https://www.insidetheiot.com/cache-in-multicore-systems/.
(2) Cache Coherence - Massachusetts Institute of Technology. http://csg.csail.mit.edu/6.823S21/Lectures/L13.pdf.
(3) . https://bing.com/search?q=cache+coherence+in+multi-core+MCUs.
(4) Cache Coherence - GeeksforGeeks. https://www.geeksforgeeks.org/cache-coherence/.
(5) Efficient Cache Coherence on Manycore Optical Networks. https://dspace.mit.edu/bitstream/handle/1721.1/51734/MIT-CSAIL-TR-2010-009.pdf?sequence=1.
(6) undefined. https://arxiv.org/pdf/1706.07568v2.
(7) undefined. https://link.springer.com/chapter/10.1007/978-981-19-5845-8_49.
(8) undefined. https://www.karlrupp.net/2018/02/42-years-of-microprocessor-trend-data/.

icDirectory Limited | https://www.icdirectory.com/b/blog/how-do-mcus-handle-cache-coherence-in-multi-core-architectures.html
  • What are the trade-offs between SRAM and DRAM in MCUs?
  • Explain the concept of flash wear leveling in MCUs.
  • What is the significance of the reset vector in an MCU?
  • How do MCUs handle memory-mapped I/O devices?
  • What is the role of the memory bus in an MCU?
  • Discuss the impact of process scaling on MCU power consumption.
  • What are the challenges of implementing low-power modes in MCUs?
  • Explain the concept of clock gating in MCUs.
  • What is the purpose of the cache controller in an MCU?
  • How do MCUs handle external interrupts?
  • What is the purpose of the memory protection unit (MPU) in an MCU?
  • How do MCUs handle external memory interfaces (SDRAM, DDR, etc.)?
  • What is the significance of the system control block (SCB) in ARM Cortex-M MCUs?
  • Discuss the impact of process variations on MCU performance and reliability.
  • What is the role of the NVIC (Nested Vectored Interrupt Controller) in ARM-based MCUs?
  • Explain the concept of memory protection units (MPUs) in MCUs.
  • What are the challenges of implementing secure boot in MCUs?
  • How do MCUs handle temperature compensation for clock oscillators?
  • What is the purpose of the power-on reset (POR) circuitry in an MCU?
  • Discuss the trade-offs between flash memory endurance and write speed in MCUs.