At the moment, Scala already supports two major strategies for concurrency – thread-based concurrency (derived from Java) and type-safe Actor-based concurrency (inspired by Erlang). In the nearest future (Scala 2.9), there will be two big additions to that:
- Software Transactional Memory (the basis for concurrency in Clojure, and probably the second most popular concurrency-style in Haskell)
- Parallel Collections (without going into detail, they allow for parallelizing basic collection transformers, like
foreach
ormap
across multiple threads).
Actor syntax (concurrency operators) is heavily influenced by Erlang (with some important additions) – with regards to the library you use (standard actors, Akka, Lift, scalaz), there will be different combinations of question and exclamation marks: !
(in the most cases for sending a message one-way), !!
, !?
, etc.
Besides that, first-class functions make your life way easier even when you work with old Java concurrency frameworks: ExecutorService, Fork-Join Framework, etc.
Above all of that stands immutability that simplifies concurrency a lot, making code more predictable and reliable.