Micro-benchmarks evaluating cacheline contention (false sharing) and cache-to-cache (c2c) transfer latency on multi-core x86_64 architectures.
When threads on different processor cores write to distinct variables located on the same 64-byte cache line, the MESI/MOESI cache coherency protocol forces constant line invalidations (HITM - Hit Modified transfers). This project benchmarks the latency differential and provides automated perf c2c profiling wrappers.
cpp/: C++20 pthreads/std::jthread benchmarks comparing contiguous shared state vsalignas(64)padded state.go/: Go runtime benchmarks evaluatingsync/atomicoperations with and without CPU cache padding.perf/: Shell and Python scripts parsingperf c2cmetrics and calculating HITM penalties.
# Build C++ benchmarks
cd cpp && make
./bench_unpadded
./bench_padded
# Run Go benchmarks
cd ../go
go test -bench=. -benchmem
# Record perf c2c trace (Linux)
sudo ../perf/record_c2c.sh
python3 ../perf/analyze.py