« links for 2007-05-30 | Main | Surface Tension »

Threads plus shared mutable state

Last year, I blathered:

"For the set of credible commercial languages Java is the winner if you are going to do threads. But it's a stretch to say its shared memory model is the right approach to concurrent programming altogether. Languges like Erlang and Mozart, are arguably better"

Insights gleaned when reading CTM figured into that assertion. So who better than one of the authors, Peter Van Der Roy, to explain things while comenting on the assertion that "for concurrent programming to become mainstream, we must discard threads as a programming model.":

"I assume that by "threads" the authors mean "shared-state concurrency". Their statement is right if we assume that a mainstream language must be stateful. But if not, then there is another way to solve the problem. The real problem is not threads as such; it is threads plus shared mutable state. To solve this problem, it's not necessary to throw away threads. It is sufficient to disallow mutable state shared between threads (mutable state local to one thread is still allowed). "

In Java, shared mutable state would be the memory heap. It seems that the coordination mechanism is the issue rather than the number of actors.


June 1, 2007 07:38 PM

Comments

Patrick Mueller
(June 4, 2007 08:34 PM #)

And it's a real shame that Java's runtime memory footprint is so large, because an obvious solution of "just run multiple VMs" is so expensive.

Bill de hOra
(June 4, 2007 10:52 PM #)

Patrick,

that's why I pine for Java Isolates sometimes - logical VMs running inside a physical one, message passing only - really good idea. They were slated to land in Java at some point, that was a few years ago.

IanRae
(June 5, 2007 05:29 PM #)

Removing shared state from the language my be preferable, but nothing stops people from building Java applications that use message passing between threads. Like unit test coverage, it's a matter of discipline, unfortunately.

Post a comment

(you may use HTML tags for style)




Remember Me?

Trackback Pings

TrackBack URL for this entry:
http://www.dehora.net/mt/mt-tb.cgi/1863