FAQ
Hi all,

I noticed there is one change in the collector code between Go 1.1 and 1.2,
which is that in Go 1.1 the addstackroots() allowed to scan current running
goroutine (g)'s stack while in Go 1.2 it is not allowed and a runtime error
is thrown. I tried to figure out why this change is required but failed. I
could not find any code elsewhere that does the work of scanning the
current running goroutine's stack. Can anyone give a hint?

Thanks,
Qi

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Search Discussions

  • Ian Lance Taylor at Mar 24, 2014 at 8:58 pm

    On Mon, Mar 24, 2014 at 1:47 PM, Qi Chen wrote:
    I noticed there is one change in the collector code between Go 1.1 and 1.2,
    which is that in Go 1.1 the addstackroots() allowed to scan current running
    goroutine (g)'s stack while in Go 1.2 it is not allowed and a runtime error
    is thrown. I tried to figure out why this change is required but failed. I
    could not find any code elsewhere that does the work of scanning the current
    running goroutine's stack. Can anyone give a hint?
    In Go 1.2, the garbage collector runs on the g0 stack, which is the
    stack allocated when the thread (not the goroutine) is created. By
    definition this stack does not contain any Go roots. In effect the
    garbage collector is being run as a system call, and is not being run
    by any particular goroutine. The goroutine that invoked the garbage
    collector is put into Gwaiting state and its stack is scanned by
    addroots via addstackroots.

    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.
  • Qi Chen at Mar 24, 2014 at 9:30 pm
    Thank you. These info are really helpful. :)

    On Mon, Mar 24, 2014 at 4:58 PM, Ian Lance Taylor wrote:
    On Mon, Mar 24, 2014 at 1:47 PM, Qi Chen wrote:

    I noticed there is one change in the collector code between Go 1.1 and 1.2,
    which is that in Go 1.1 the addstackroots() allowed to scan current running
    goroutine (g)'s stack while in Go 1.2 it is not allowed and a runtime error
    is thrown. I tried to figure out why this change is required but failed. I
    could not find any code elsewhere that does the work of scanning the current
    running goroutine's stack. Can anyone give a hint?
    In Go 1.2, the garbage collector runs on the g0 stack, which is the
    stack allocated when the thread (not the goroutine) is created. By
    definition this stack does not contain any Go roots. In effect the
    garbage collector is being run as a system call, and is not being run
    by any particular goroutine. The goroutine that invoked the garbage
    collector is put into Gwaiting state and its stack is scanned by
    addroots via addstackroots.

    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+unsubscribe@googlegroups.com.
    For more options, visit https://groups.google.com/d/optout.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupgolang-nuts @
categoriesgo
postedMar 24, '14 at 8:50p
activeMar 24, '14 at 9:30p
posts3
users2
websitegolang.org

2 users in discussion

Qi Chen: 2 posts Ian Lance Taylor: 1 post

People

Translate

site design / logo © 2022 Grokbase