On Nov 4, 2:15 pm, Rich Hickey <[EMAIL PROTECTED]> wrote:
> On Nov 4, 3:47 am, "Christian Vest Hansen" <[EMAIL PROTECTED]>
> wrote:
> > My view is that TMs are another tool in the box, just like CAS, locks,
> > agents, volatile, thread-locals, immutables, atomics and all the rest
> > of java.util.concurrent.
>
> Precisely.

I agree. However, in pure Java the locks, volatility, immutability,
atomics, java.util.concurrent are all accessible and can all interact,
e.g., you can create your own synchronizer based on locks and
volatiles, combined java.util.concurrent classes. Is this the case in
Clojure?

In Clojure the locks are not accessible to the user which is generally
a good thing. However the 'toolbox argument' is saying: "OK,
*sometimes* you do want locks," and saying "STM is no silver bullet so
go ahead and use locks in those (rare cases)." Now, I have yet to see
an actual example that the STM is not good enough;^1 however, for this
particular argument to hold we need to consider how to combine these
tools in an actual Clojure application.

So really, I am wondering whether it is possible combine all these
concurrency tools in a Clojure program. For example you can (from pure
Clojure) create a ConcurrentHashMap and hammer on it from different
threads -- works out of the box, no need for locks or Java classes.
But what about volatiles and acquiring locks? Can you have a decent
Clojure program that uses locks in one component, together with STM
and agents in others? What about interaction between such components?

/krukow

^1 Even STM opponent and concurrency guru Cliff Click seems to be
impressed with Clojure ;-)
http://blogs.azulsystems.com/cliff/2008/09/jvm-language-su.html

Comment: [[
I'm not doing Clojure enough justice here. [...] The purely functional
data-structures also look really nice; and the STM scaled surprisingly
well. I definitely need to do some coding with it. [...]

Cliff
]]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To post to this group, send email to clojure@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/clojure?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to