On Thursday, May 26, 2022 at 7:39:10 PM UTC+2 Ian Lance Taylor wrote:

> > But what about T0? Wouldn't throwing away T0 terminate the whole program 
> ... which doesn't seem to be the case? Or am I mistaken here? 
>
> Once you've created multiple threads in a process, the original thread 
> (what you are calling T0) can exit without affecting the other 
> threads. 


okay, thank you! I've now find something in the Linux procfs man page that 
seems to support this, as it says that /proc/PID/task becomes unavailable 
when the task leader/T0 exits.

But this now begs the question: if the task leader T0 has exited and the Go 
scheduler needs to start a new task: which of the tasks does the scheduler 
doing the clone run in? Can it happen to be an OS-level locked task? I'm 
asking because I'm wondering why with my code explicitly locking new 
goroutines to their OS tasks/threads before switching namespaces and not 
ever switching back but terminating the goroutine, turning its locked 
thread into a throw-away task. Yet, I see the T0 task leader suddenly 
ending up executing non-locked goroutines and with the wrong network 
namespace. This is on Go 1.18.2, but I might have seen this before on 1.16 
or 1.17.

-- 
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+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/golang-nuts/ecd9c7d5-0ae6-44a0-a362-f6cd63317133n%40googlegroups.com.

Reply via email to