4 ms·
I'm still trying to figure out exactly where the Clojure concurrency model is useful. How many problem domains require extremely high throughput in a single sha
by cageface 16y ago
I'm still trying to figure out exactly where the Clojure concurrency model is useful. How many problem domains require extremely high throughput in a single shared memory space? It seems to me that you're usually either well within the bounds of what a single cpu can handle or you're going to need multiple machines and can just keep throwing procs at the problem.
- troutwine 16y agoThis echoes my sentiments rather precisely. On the not infrequent occasion that I am building something which requires massive concurrency I _also_ need it to be distributed, if only for service reliability. Multi-core might be the (very near) future, but distributed processing is now. Languages that make distributed computing easy (well, easier) are more valuable, to my mind, than those that make multi-core computing more simple. That is why, for me, Clojure is a lovely little toy, but Erlang's a workhorse.
- dedward 16y agoThose are still different issues - threading & concurrency in one memory area -vs- distributed computing. Clojure is attempting to optimize for the former... it's easy to write thread-safe applications.
- troutwine 16y agoThey are distinct issues, to be sure, but, then again, they are part and parcel. Properly implemented, a language with distributed computing primitives buys you single address space concurrency: it's the degenerate case of a cluster. No matter what, a single machine is going to be less in terms of total computational capacity and fail-over ability. Languages that optimize for single machines, however nice, are something of a tease.
- deleted 16y ago[deleted]
- jared314 16y agoIn a previous post, he mentioned Swarmiji (http://github.com/amitrathore/swarmiji http://github.com/amitrathore/swarmiji) for spreading things across multiple machines.
- pjscott 16y agoIt's great for doing things like k-means clustering or Delaunay triangulation. Those might not come up a lot for you, but some people need to do them, and would love to be able to speed that up by throwing several processor cores at the problem. Solving them on a cluster is a lot harder, and often unnecessary. (On k-means clustering, in particular, Clojure-style transactional memory gives an almost linear speedup with the number of processor cores, without significantly changing the code. That's worth something.)
- kanak 16y agoCould you please provide a link to the implementation? I'm really interested in learning how this is done. Thanks.
- pjscott 16y agoSorry, I can't point to any code, but in both cases the approach is the same: you have some shared data structures, like an array of regions containing points, or a red-black tree, or a priority queue, and several threads all read and write these data structures. Since transactional memory lets you run concurrently unless there are actual memory conflicts, this often gives better concurrency than locks. Of course, for examples like these, the tricky part is designing data structures that don't have many inherent memory conflicts. Red-black trees, for example, are tricky because the rebalancing transformations tend to step on other threads' toes.
- jerf 16y agoCounter-question: How many people have been so trained by decades of terror with multithreading horrors that they can no longer see when it is the right choice when you have a non-nightmare multithreading capability? When you encounter a new paradigm like this, its very important to work in it for at least a little and give yourself some time to untrain before writing off the usefulness of the paradigm. I work mostly in servers and the answer to your question is really quite a lot. (Unfortunately, I'm in the worst place, I untrained myself and am now able to see where this is useful, but not really able to use it at work. Sad.) I am reminded of this I saw yesterday: http://www.reddit.com/r/programming/comments/cq6wo/why_dvcs_provides_better_central_control/c0uen0a http://www.reddit.com/r/programming/comments/cq6wo/why_dvcs_...