Re: [go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-19 Thread 'David Chase' via golang-nuts
If you want preemption within a particular package, you can compile it "go build -gcflags=particular_package=-d=ssa/insert_resched_checks/on" . That will not fix any problems with underlying raciness, though it may mask them. If you want an entire compiler that defaults to that mode and

Re: [go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-17 Thread Jesper Louis Andersen
On Fri, Aug 16, 2019 at 8:09 PM wrote: > The Go-Scheduler is unable to allow to switch to another goroutine in > busy-waiting-loops - > the only possibility to get around that problem is either to put > "switch-steps" into the source > - either "time.Sleep(1)" or "runtime.Gosched()". > I think

Re: [go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-17 Thread Robert Engels
But as was pointed out, in this case it does not matter as the code is sharing memory without proper synchronization so preemption doesn’t really matter. > On Aug 16, 2019, at 11:29 PM, Ian Lance Taylor wrote: > >> On Fri, Aug 16, 2019 at 9:24 PM wrote: >> >> Could you let me know which

Re: [go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-16 Thread Ian Lance Taylor
On Fri, Aug 16, 2019 at 9:24 PM wrote: > > Could you let me know which compiler can support pre-emption and how to > enable it? Thanks. No current Go toolchain supports preemption in all cases; for the gc toolchain, that is https://golang.org/issue/10958. But the exact definition of a busy

Re: [go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-16 Thread xkwang
Could you let me know which compiler can support pre-emption and how to enable it? Thanks. On Saturday, August 17, 2019 at 9:20:07 AM UTC+8, Ian Davis wrote: > > On Fri, 16 Aug 2019, at 7:09 PM, dr.ch...@gmail.com wrote: > > Dear Community and dear Go-developers, > > Meanwhile it is clear why

Re: [go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-16 Thread Ian Davis
On Fri, 16 Aug 2019, at 7:09 PM, dr.ch.mau...@gmail.com wrote: > Dear Community and dear Go-developers, > > Meanwhile it is clear why things do not work: > The Go-Scheduler is unable to allow to switch to another goroutine in > busy-waiting-loops - > the only possibility to get around that

Re: [go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-16 Thread Jan Mercl
On Fri, Aug 16, 2019 at 8:09 PM wrote: > Meanwhile it is clear why things do not work: > The Go-Scheduler is unable to allow to switch to another goroutine in > busy-waiting-loops - > the only possibility to get around that problem is either to put > "switch-steps" into the source > - either

Re: [go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-16 Thread Robert Engels
Your code is incorrect for Go. You need to use correct concurrent code. It is documented that tight loops that do not involve function calls may not allow GC to occur. > On Aug 16, 2019, at 1:09 PM, dr.ch.mau...@gmail.com wrote: > > Dear Community and dear Go-developers, > > Meanwhile it is

[go-nuts] Re: mutual exclusion algorithm of Dijkstra - strange behaviour

2019-08-16 Thread dr . ch . maurer
Dear Community and dear Go-developers, Meanwhile it is clear why things do not work: The Go-Scheduler is unable to allow to switch to another goroutine in busy-waiting-loops - the only possibility to get around that problem is either to put "switch-steps" into the source - either