|
|
Concurrency programming is difficult to get right– when I mused that I was concerned “that nobody really cares”, I was pleasantly surprised by a series of comments which serve to highlight the issue at hand; that is, CPU architectures are evolving, man, and Java’s concurrency model might not fit the bill.
For instance, Brian Goetz, author of Java Concurrency in Practice, commented that
…the trend [with CPU design] is towards weaker memory models, so programs that have “worked” for years will start breaking as we deploy on new generations of hardware.
What’s more, Christian Vest Hansen aptly pointed out that
In my experience, people realize that they don’t know enough to deal with concurrency, so they try to avoid writing code where they have to deal with it directly. But they don’t realize that their lack of knowledge on concurrency actually makes it near impossible for them to write code that is devoid of the concurrency they sought to dodge.
And Kirk Pepperdine commented
Any time you access data that is being shared with other threads/processes, you are programming concurrently. So, developers are already writing concurrent code albeit accidentally. This typically results in some very strange bugs. More over, the tools that we have today aren’t very helpful in helping to resolve these issues which makes them difficult if not impossible to resolve.
Accordingly, future versions of Java are targeting improved concurrency features. Nevertheless, Java’s concurrency design is fundamentally different than other languages, such as Erlang, which has no notion of shared memory (consequently, there are no needs for locks, for example). Erlang isn’t the only language built with concurrency in mind, however. Relative newcomers, Scala and Clojure also address concurrency programming and all three languages are capable of running (in some form or another) on the JVM. Thus, if it’s your bag, you can address concurrency challenges now.
Given these three languages (plus future versions of Java) then, which one is better suited for concurrent programming on the JVM?
Which language is better suited for JVM concurrency?
Erlang
Clojure
Scala
Future versions of Java
You can follow thediscoblog on Twitter now!