Jessica Kerr covers some of the concurrency tools existing in JVM languages including ExecutorService, Futures, Akka actors, and core.async coroutines, providing advice on writing deadlock-free code.
Gentle Introduction to Lockless Concurrency
I've recently visited
#jcrete
, a Java Un-Conference. After talking with people, it struck me that many things that were available and extremely popular in the other communities (like Clojure and Haskell) are still so little used in Java world.
Ever since Java got
Lambdas
, Streams
and default method implementations in Interfaces
, it actually became much more enjoyable language to use. It should have also changed ways people write their code, although this process is much slower than I would have expected.Lambdas
allowed us to pass anonymous functions in order to avoid creating a class for every single possible clause where variables escape the context. They also allow to think of operations in terms of small, atomic pieces that can be combined, passed around, reused and referenced.
In this post I’ll try to examine the question of lockless concurrency in Java - an extremely useful, yet shamefully overlooked topic. Implementing lockless algorithms and data structures requires some intuition on basic principles, so let's start with something simple.
No comments:
Post a Comment