The article "Atomic*.lazySet is a performance win for single writers," goes over how lazySet
is a weak volatile write (in the sense that it acts as a store-store and not a store-load fence). But I don't understand how leveraging semi-volatile writes improves concurrent queue performance. How exactly does it offer extra low latency as claimed by Menta-queue?
I already read up on it's implementation and it's claims on the stack overflow question: "How is lazySet in Java's Atomic* classes implemented" and "Atomic Integer's lazySet vs set."
The problem with a volatile write on x86 is that it issues full memory barrier which results in a stall until the store buffer is drained. Meanwhile lazySet
on x86 is a simple store. It does not require all previous stores waiting in the store buffer to be flushed, thus allowing writing thread to proceed at full speed.
This is described a bit in Martin Thompson's article.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With