What is the impact of cache coherence on multi-core MCUs?
Technical Blog / Author: icDirectory / Date: Apr 06, 2024 15:04
Let%27s delve into the impact of cache coherence on multi-core microcontrollers (MCUs) in detail.

1. Understanding Cache Coherence:
- Cache coherence is a critical concern in multi-core systems where each core has its private cache.
- The goal is to ensure that all cores observe a consistent view of shared memory.
- Incoherent caches can lead to incorrect program behavior, data corruption, and unpredictable results.

2. Why Cache Coherence Matters:
- Correctness: Coherence ensures that all cores see the same value for a memory location.
- Performance: Efficient cache coherence minimizes unnecessary cache invalidations and updates.
- Predictability: Coherence impacts program execution time and latency.

3. Challenges in Multi-Core MCUs:
- Shared Data: Multiple cores may read and write to the same memory locations.
- Private Caches: Each core has its private cache, introducing the need for synchronization.
- Communication Overhead: Coherence protocols introduce communication overhead between cores.

4. Cache Coherence Protocols:
- Write Propagation: Ensures that writes eventually become visible to all cores.
- Write Serialization: Serializes writes to the same location (all cores see them in the same order).
- Snooping-Based Protocols:
- All caches observe each other%27s actions through a shared bus.
- Bus acts as the serialization point.
- Directory-Based Protocols:
- A coherence directory tracks private cache contents and serializes requests.
- Directory serves as the serialization point.

5. Example: Cache Coherence Avoids Stale Data:
- Consider two cores accessing memory location 0xA:
1. Core 1 loads 0xA (reads from its cache).
2. Core 2 stores a new value to 0xA (writes to its cache).
3. Without coherence, Core 1 would still have the old (stale) value.
- Coherence protocols ensure that Core 1 sees the updated value.

6. Trade-Offs and Considerations:
- Latency vs. Consistency: Coherence introduces communication delays.
- Granularity: Coherence can operate at cache line or word level.
- Scalability: Coherence becomes more complex with more cores.
- Energy Efficiency: Coherence protocols consume power.

7. Real-World Impact:
- Incoherent caches can lead to race conditions, deadlocks, and incorrect results.
- Efficient coherence designs balance performance and correctness.
- MCU designers must choose appropriate protocols based on their system requirements.

In summary, cache coherence is essential for maintaining data consistency and predictable behavior in multi-core MCUs. Balancing performance and correctness ensures efficient and reliable operation!


(1) Cache Coherence - Massachusetts Institute of Technology. http://csg.csail.mit.edu/6.823S21/Lectures/L13.pdf.
(2) Cache in Multicore Systems: Staying Coherent - Inside the IoT. https://www.insidetheiot.com/cache-in-multicore-systems/.
(3) Enhanced Multicore Performance Using Novel Thread-Aware Cache Coherence .... https://www.x-mol.com/paper/1632114062933004288.
(4) Efficient Cache Coherence on Manycore Optical Networks. https://dspace.mit.edu/bitstream/handle/1721.1/51734/MIT-CSAIL-TR-2010-009.pdf?sequence=1.
(5) Cache Where you Want! Reconciling Predictability and Coherent Caching. https://arxiv.org/pdf/1909.05349.pdf.
(6) undefined. https://www.karlrupp.net/2018/02/42-years-of-microprocessor-trend-data/.

icDirectory Limited | https://www.icdirectory.com/b/blog/what-is-the-impact-of-cache-coherence-on-multi-core-mcus.html
  • How do MCUs handle memory-mapped peripherals with variable register widths?
  • What are the limitations of using EEPROM for non-volatile storage in MCUs?
  • Explain the concept of bit manipulation instructions in MCUs.
  • What is the role of the vector table in ARM Cortex-M MCUs?
  • How do MCUs handle communication protocols (UART, SPI, I2C, etc.)?
  • What is the purpose of the brown-out detector in an MCU?
  • Discuss the impact of process technology (e.g., 28nm, 14nm) on MCU performance.
  • What are the challenges of implementing security features in MCUs?
  • Explain the concept of memory-mapped peripherals in MCUs.
  • What is the role of the JTAG (Joint Test Action Group) interface in MCU debugging?
  • How do MCUs handle floating-point arithmetic?
  • What is the difference between flash memory and EEPROM in MCUs?
  • Describe the role of DMA (Direct Memory Access) controllers in MCUs.
  • What is the significance of the interrupt vector table (IVT) in MCUs?
  • How do MCUs handle real-time clock (RTC) functionality?
  • What are the different types of timers/counters available in MCUs?
  • Discuss the impact of cache memory on MCU performance.
  • What is the purpose of the bootloader in an MCU?
  • Explain the concept of bit-banding in ARM-based MCUs.
  • What is the role of the memory management unit (MMU) in an MCU?