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:
>
> n := syscall(syscall.GETCPU, ...)
John
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 m
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:
n := syscall(syscall.GETCPU, ...)
// The goroutine could be re-scheduled here to another CPU, b
On Sun, Aug 14, 2016 at 9:58 AM, Gaurav Agarwal
wrote:
> 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
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
On Sun, Aug 14, 2016 at 2:25 AM, gaurav wrote:
>
> How do I get to know the Thread (or CpuCore) id on which the goroutine is
> running?
Go does not expose this information. In Go it's also unreliable
because the language makes no guarantees about when a goroutine may
move from one thread, or CPU
Hi there,
Just for heck of it - I am trying to come up with a ConcurrentCounter that
does not suffer memory sharing or the cost of mutex lock/unlock.
The idea as described in the following Java code snippet is quite
straightforward:
- Pin every thread to a unique int32 variable.
- Put th