[concurrency-interest] ConcurrentLinkedQueue padding
martinrb at google.com
Wed Nov 22 11:06:59 EST 2017
None of the linked list based node classes use @Contended. Node classes
tend to be small and @Contended adds a lot of memory overhead. When
multiple threads are enqueueing, you're likely instead to get "true
sharing" contention as they all try to CAS the very same next link.
On Tue, Nov 21, 2017 at 1:33 PM, Carl Mastrangelo via Concurrency-interest <
concurrency-interest at cs.oswego.edu> wrote:
> Hi concurrency interest,
> I was looking through ConcurrentLinkedQueue and noticed that unlike
> several of the other concurrent classes, the volatile Node pointers as well
> as the Nodes themselves don't have any padding. This makes me wonder,
> could there be false sharing when using multiple producers to add to the
> queue? I was under the impression that the GC tends to group fields of a
> class near each other, which would imply that there is going to likely be
> contention when quickly updating (and reading) from it.
> Concurrency-interest mailing list
> Concurrency-interest at cs.oswego.edu
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Concurrency-interest