Preemption is GC for memory reordering (2019)
3 days ago
- #interrupts
- #lock-free programming
- #memory ordering
- Preemption can be leveraged as a 'sunk cost' to provide ordering between memory accesses in lock-free programming, using interrupts as implicit barriers.
- Bounded TSO ensures liveness without barriers but lacks real-time guarantees; interrupt tracking offers conservative time-based ordering guarantees.
- Event counts enable efficient blocking in lock-free algorithms, with single-producer optimizations using non-atomic increments and interrupt-based safety checks.
- Asymmetric flag flips (e.g., in hazard pointers and epoch reclamation) use interrupts to avoid expensive barriers like membarrier, reducing overhead via a daemon (barrierd).
- Interrupt-driven barriers (via barrierd) offer lower latency and better scalability than IPI-based methods under load, though they depend on regular interrupt firing.