Forwarding you to www.pvk.ca

Preemption Is GC for Memory Reordering - Paul Khuong: some Lisp

I previously noted how preemption makes lock-free programming harder in userspace than in the kernel . I now believe that preemption ought to be treated as a sunk cost, like garbage collection: we’re already paying for it, so we might as well use it. Interrupt processing (returning from an interrupt handler, actually) is fully serialising on x86, and on other platforms, no doubt: any userspace instruction either fully executes before the interrupt, or is (re-)executed from scratch some time after the return back to userspace. That’s something we can abuse to guarantee ordering between memory accesses, without explicit barriers.