Re: [go-nuts] Fast ConcurrentCounter without memory sharing

2016-08-14 Thread Ian Lance Taylor
On Sun, Aug 14, 2016 at 2:49 PM, Nigel Tao wrote: > On Aug 15, 2016 05:21, "Ian Lance Taylor" wrote: >> If these approaches seem awkward, I suppose you could get >> syscall(syscall.GETCPU, ...) when you want to increment a counter. > > That still seems racy:

RE: [go-nuts] Fast ConcurrentCounter without memory sharing

2016-08-14 Thread John Souvestre
John Souvestre - New Orleans LA -Original Message- From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On Behalf Of Ian Lance Taylor Sent: 2016 August 14, Sun 14:21 To: Gaurav Agarwal Cc: golang-nuts Subject: Re: [go-nuts] Fast ConcurrentCounter without memory

Re: [go-nuts] Fast ConcurrentCounter without memory sharing

2016-08-14 Thread Gaurav Agarwal
Ian, thanks for the explanation and the link ! But I am still unclear how to implement such a concurrent counter in Go - given that we can't find out what thread/cpu is the goroutine executing. Note that in this case there was never the need of pinning a goroutine to a thread or cpu; just that we