2

I read Brian Goetz's Java concurrency in practice and I started to read some articles and slides of Lock-free programming: Compare-And-Swap, RingBuffer, etc.

I was very glad to see the JDK's ConcurrentHashMap is one good example of replacing one single lock by multiple locks to reduce the lock impact.

I was wondering if there are any more examples / source codes / or best practices of Lock-free programming in real life, that I could draw more understanding and inspiration from?

Thanks so much!

closed as off-topic by RockPaperLizard, Jan Doggen, VicAche, ᔕᖺᘎᕊ, unor Apr 27 '15 at 6:35

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about software recommendations, within the scope defined on meta and in the help center." – RockPaperLizard, Jan Doggen, VicAche, ᔕᖺᘎᕊ, unor
If this question can be reworded to fit the rules in the help center, please edit the question.

3

Here is list of libraries with lock-free and wait-free data structures for JVM:

https://github.com/JCTools/JCTools

https://github.com/ben-manes/caffeine

If you can read Scala code then look into actors that are wait-free on submit and handle messages in batches:

https://github.com/scalaz/scalaz/blob/series/7.2.x/concurrent/src/main/scala/scalaz/concurrent/Actor.scala

https://github.com/plokhotnyuk/actors/blob/c5bac2e1bf70bab518102c13269838ea9b9e90e6/src/test/scala/com/github/gist/viktorklang/Actor.scala

Best principles and practices can be found from sources, discussion groups, blog posts and presentations:

https://groups.google.com/forum/#!forum/mechanical-sympathy

http://mechanical-sympathy.blogspot.com/

http://vanillajava.blogspot.com/

http://www.1024cores.net/

http://shipilev.net/

http://psy-lob-saw.blogspot.com/

Please also try high level libraries and tools that are based on these principles:

http://chronicle.software/

https://github.com/LMAX-Exchange/disruptor

https://github.com/real-logic

  • Thanks so much for your information! – Kewei Shang Apr 27 '15 at 6:36

Not the answer you're looking for? Browse other questions tagged or ask your own question.