In this presentation from QCon London 2008, Brian Goetz discusses the difficulties of creating multithreaded programs correctly, incorrect synchronization, race conditions, deadlock, Software Transactional Memory, the history of concurrency, alternatives to threads, Erlang, Scala, and recommendations for concurrency in Java.
Watch Concurrency: Past and Present (60 minutes).
Peter Pilgrim, who attended this talk, said:
Brian Goetz does NOT expect people to dump Java and move to JKOCaml, Erlang or other model any time soon.
He promotes "Immutable object where you can". Surprise, surprise. Sometimes it cheaper to make a copy than it is to share. Copying an immutable object is always thread safe.
He recommends to take a look at Scala, in particular the Scala Actors library.
Leonid Maslov also added:
The idea behind [Software Transactional Memory] is the following: let the smart-smart-smart and one more again smart JVM handle these difficult problems, let's delegate this to smart folks behind JVM impls. Hmmm. Sounds like a good stuff (at least for me). The problem is: we won't get it soon, soon enough. Research is still done in this area. Possible (mention-worth) solutions: (I really recommend You to watch that f* great presentation)
- Functional languages like Haskell, Erlang, Scala (Actors? library), JOCaml and so on
- Not shared state.
- Message passing only. Callback mechanisms.