6

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."

Community
  • 1
  • 1
Devarsh Desai
  • 5,984
  • 3
  • 19
  • 21

1 Answers1

1

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.

Community
  • 1
  • 1
apangin
  • 92,924
  • 10
  • 193
  • 247
  • hey apangin, thank you for the article and the explanation! I had to dig way back into my computer architecture knowledge to connect all the dots here, but your explanation and Martin Thompson's article was great. hope you have a good week ahead! – Devarsh Desai Sep 16 '14 at 03:35