On Friday, February 18, 2011 4:48:36 PM UTC+2, Ian Lance Taylor wrote:
josvazg <jos...@gmail.com <javascript:>> writes:
There are no locks on maps. So I can make a concurrent map by putting a
goroutine in charge of it, and communicating with the goroutine via a
channel. [snipped]
So, what specifically do we gain by defining a concurrent map?
josvazg <jos...@gmail.com <javascript:>> writes:
There are no locks on maps. So I can make a concurrent map by putting a
goroutine in charge of it, and communicating with the goroutine via a
channel. [snipped]
So, what specifically do we gain by defining a concurrent map?
maps, like Java's ConcurrentMap, would stripe the locks, and a write would
lock only a subset of the keys, reducing contention. See [0]. I'm not
talking about things like Cliff Click's concurrent hashmap, which is
completely lock free, and design to avoid contention even for a large
number of working threads[1].
I'm not saying it should be in the standard library, but I'll be very happy
to see proven implementation. These algorithms are hard to get right.
[0] http://javaopensourcecode.blogspot.co.il/2012/06/concurrenthashmap.html
[1] http://www.azulsystems.com/events/javaone_2007/2007_LockFreeHash.pdf
>
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.