I think java locks may be the only good answer. I can't usefully divide the 
vector, because the distribution of updates is uniform along the length of 
it.

Perhaps there's a solution with queues, with multiple threads generating 
potential placements, and a single thread updating the vector and 
re-queuing any conflicting placements.

On Monday, January 30, 2017 at 7:11:03 PM UTC-8, Alex Miller wrote:
>
> One technique is to batch locks at a coarser granularity. You've explored 
> both ends of the spectrum - 1 lock and N locks. You can also divide the 
> overall vector into any group of refs between 1 and N.
>
> If refs are too heavy, there are several other locking mechanisms on the 
> JVM. You could try Clojure atoms or Java locks. Atoms can only be used to 
> protect a single value so you would need a protocol for locking acquisition 
> to deal with that. For something like that, you'd probably end up using a 
> mutable data structure like a Java array.
>
>

-- 
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
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to