On Sat, Jun 7, 2025 at 8:40 AM Nghĩa Nguyễn <nghiant3...@gmail.com> wrote: > > The comment for the systemstack function states that it "runs fn on a system > stack." My understanding is that fn is executed on the thread's g0 stack. > However, g0 is allocated via the malg function, just like a regular > goroutine's stack. That suggests the g0 stack is not implicitly created by > the kernel (e.g., via a traditional thread stack), but explicitly by the Go > runtime. > > Given that, I'm wondering: if the g0 stack is runtime-allocated and not a > kernel-managed stack, is the term “system” in systemstack still meaningful?
In a program that uses cgo, or for any program for which mStackIsSystemAllocated reports true, the g0 stack is allocated by pthread_create. So in those cases it is a system stack. I suppose we could use a different name if we cared enough. Ian -- 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 visit https://groups.google.com/d/msgid/golang-nuts/CAOyqgcUbZoXkhBVGVV4-sRb5Vtxk4Gf9HWDe7GBZcKpwjhaGdA%40mail.gmail.com.