Re: [go-nuts] Goroutine to thread mapping

2022-11-10 Thread Piotr Wyderski
Thank you for your answer, it is clear now. wtorek, 8 listopada 2022 o 13:38:33 UTC+1 ren...@ix.netcom.com napisał(a): > To answer the rest of the question, since they are premptable they can be > resumed on any thread. Go tries to use the same thread for performance but > will issue memory bar

Re: [go-nuts] Goroutine to thread mapping

2022-11-08 Thread Robert Engels
To answer the rest of the question, since they are premptable they can be resumed on any thread. Go tries to use the same thread for performance but will issue memory barriers when it cannot. > On Nov 8, 2022, at 5:17 AM, peterGo wrote: > >  > piotr, > > Goroutines are now asynchronously pr

Re: [go-nuts] Goroutine to thread mapping

2022-11-08 Thread peterGo
piotr, Goroutines are now asynchronously preemptible. As a result, loops without function calls no longer potentially deadlock the scheduler or significantly delay garbage collection. February 2020, https://go.dev/doc/go1.14#runtime peter On Tuesday, November 8, 2022 at 3:31:25 AM UTC-5 pio

Re: [go-nuts] Goroutine to thread mapping

2022-11-08 Thread Piotr Wyderski
I am fine with affinity changes during, say, a mutex or channel operation. But does (or merely can) Go preempt the execution of leaf assembly functions, basically re-creating threads in user space? Or is the currently assigned thread mapping locked until the function decides to return, as coope

Re: [go-nuts] Goroutine to thread mapping

2022-11-08 Thread Piotr Wyderski
I mean the Plan 9 assembler. Also assume the function is a leaf function, just a long one. Can such a function be preempted by Go runtime and re-assigned to another thread or can the reassignment happen only cooperatively, in a number of roughly predictable selected places? poniedziałek, 7 lis

Re: [go-nuts] Goroutine to thread mapping

2022-11-07 Thread Robert Engels
You can use runtime.LockOSThread() to control this. > On Nov 7, 2022, at 12:01 PM, Amnon wrote: > > Go makes no guarantees about the affinity between goroutines and threads, > and the mapping does typically jump around a lot during the execution of a > program. > >> On Monday, 7 November 2

Re: [go-nuts] Goroutine to thread mapping

2022-11-07 Thread Amnon
Go makes no guarantees about the affinity between goroutines and threads, and the mapping does typically jump around a lot during the execution of a program. On Monday, 7 November 2022 at 17:46:42 UTC ren...@ix.netcom.com wrote: > Do you mean Go assembly or an assembly function called via CGo?

Re: [go-nuts] Goroutine to thread mapping

2022-11-07 Thread Robert Engels
Do you mean Go assembly or an assembly function called via CGo? > On Nov 7, 2022, at 11:28 AM, Piotr Wyderski wrote: > >  > Hello, > > A goroutine needs ultimately to be assigned to an OS thread. If a goroutine > calls an assembly function F, can the thread assignment change during the > exe

[go-nuts] Goroutine to thread mapping

2022-11-07 Thread Piotr Wyderski
Hello, A goroutine needs ultimately to be assigned to an OS thread. If a goroutine calls an assembly function F, can the thread assignment change during the execution of F? In other words, is F guaranteed to return on the same thread it was called? Best regards, Piotr -- You received th