ELSEIF
Your brief EB
232 stories from 207 feeds 1245 clusters Refreshed 33 minutes ago next pull 21:39

TECH Signal 243 2 feeds carried it

Spin-lock optimization achieves 5.7x speedup and 5.4x energy reduction

A step-by-step spin-lock optimization reduces latency by 5.7x and energy draw by 5.4x through memory ordering and test-and-test-and-set techniques.

WHY IT MATTERS

Spin-locks are used in high-performance concurrency where sleeping is too costly. Reducing energy draw matters for colocation services that charge for power, and lower latency improves throughput. The techniques shown, using acquire/release ordering and read-only spinning, are directly applicable to any lock implementation.

Written by elseif from the cluster below · every claim links back to a source

The three things worth knowing

01

The naive exchange-based spin-lock takes 246 ns with four threads and draws 64.92 J.

02

Switching to acquire/release memory ordering halves uncontended latency to 1.57 ns and cuts four-thread latency to 131 ns.

03

Adding a read-only spin with _mm_pause reduces two-thread latency from 32.5 ns to 21.3 ns.

THE CLUSTER

Same story, 2 feeds.

ORDERED BY FIRST SEEN
alvarezrosa.com via Lobsters Optimizing a Spin-Lock Open ↗
alvarezrosa.com via Hacker News Optimizing a Spin-Lock Open ↗