</>EmbeddedInterview

How do Arm multi-core processors support parallel programming?

MediumMicrocontrollers & ARM Cortex-M

Short answer: Arm multi-core clusters provide hardware cache coherency between cores (snoop control unit, coherent interconnects), atomic and exclusive-access instructions for locks and lock-free data structures (LDXR/STXR, and Armv8.1 LSE atomics like LDADD, CAS, SWP), memory barriers (DMB, DSB, ISB, and load-acquire/store-release LDAR/STLR) because the memory model is weakly ordered, event signalling (WFE/SEV) for power-efficient spinning, inter-processor interrupts via the GIC (SGIs), and SIMD (Neon/SVE) inside each core. Heterogeneous designs (big.LITTLE, DynamIQ) add cores with different performance and power.

Building blocks

Feature Purpose
Cache coherency (MOESI, SCU/CCI/CMN) every core sees the latest value of shared data without software flushes
LDXR/STXR (exclusive monitor) atomic read-modify-write by retry loop (Armv8.0)
LSE atomics (LDADD, CAS, SWP) single-instruction atomics that scale better under contention (Armv8.1+)
Barriers and acquire/release enforce ordering on a weakly ordered memory model
WFE/SEV a waiting core sleeps until another core signals (spinlocks)
GIC SGIs one core interrupts another (scheduler IPIs, TLB shootdown, function calls on other CPUs)
Generic timer per core per-core scheduling ticks with a common time base
big.LITTLE / DynamIQ run demanding threads on big cores, background work on LITTLE cores

Weak memory ordering example (message passing):

#include <stdatomic.h>

int data;
atomic_int ready;

void producer(void) { data = 42; atomic_store_explicit(&ready, 1, memory_order_release); }   /* STLR */
int consumer(void)
{
    while (!atomic_load_explicit(&ready, memory_order_acquire)) { }                           /* LDAR */
    return data;   /* guaranteed to see 42 */
}

Without acquire/release, a core could observe ready == 1 before the write to data becomes visible.

Software side: POSIX threads, OpenMP, and data-parallel frameworks (OpenCL, Vulkan compute) on the GPU. Processor affinity pins threads to cores to keep caches warm or isolate real-time work.

Scalability limits: contention on shared locks and cache lines (false sharing), memory bandwidth, and Amdahl's law: if 10% of a program is serial, the speed-up can never exceed 10×.

Follow-up example: merge sort. With unlimited processors, the sorting of halves can run in parallel, and with a parallel merge the depth is O(log² n) (O(n) if the merge itself is sequential at the top level); with p processors, the time is roughly O((n log n)/p + n) for the simple version where the final merge is sequential.