Rob Thornton
2014-02-20 21:51:21 UTC
I've been searching as best I can but most search attempts ended up with
results about: stack data structures, stack overflow (the website) or
stacks as they relate to groups of objects in video games. Not very helpful.
I did come across this article from Ian Lance Taylor on the gcc wiki which
talks about an implementation: http://gcc.gnu.org/wiki/SplitStacks but it
didn't really answer much for me.
I also came across this article by Dave Cheney but it raised as many
questions as it answered:
http://dave.cheney.net/2013/06/02/why-is-a-goroutines-stack-infinite
When a Go program starts, it's my understanding that the OS allocates an
amount of stack space (between 1-8mb, typically, depending on the
OS/architecture). In a single thread if a program requests more stack space
but the frame pointer would exceed the stack segment then the result would
be a stack overflow. However, in Go a new stack would be created on the
heap to prevent this from happening. If you continually straddle this
boundary between the heap allocated stack and the "true" system allocated
stack, it would be called stack splitting?
I have read http://golang.org/doc/faq#goroutines but it's not clear
specifically what is meant by a segmented stack. Is a segmented stack
having one or more heap allocated stacks on top of the system allocated
stack or is it how goroutines have their own mini-stack segments?
I'm very (emphasis on VERY) new to assembly but my understanding is that
the stack pointer is an internal CPU register. When a stack overflow would
occur and the program responds by requesting more stack space from the
heap, must the stack pointer now be maintained by the Go program rather
than a CPU register? This would be an assembly based stack data structure
(linked list)? Or I am I way off base now?
results about: stack data structures, stack overflow (the website) or
stacks as they relate to groups of objects in video games. Not very helpful.
I did come across this article from Ian Lance Taylor on the gcc wiki which
talks about an implementation: http://gcc.gnu.org/wiki/SplitStacks but it
didn't really answer much for me.
I also came across this article by Dave Cheney but it raised as many
questions as it answered:
http://dave.cheney.net/2013/06/02/why-is-a-goroutines-stack-infinite
When a Go program starts, it's my understanding that the OS allocates an
amount of stack space (between 1-8mb, typically, depending on the
OS/architecture). In a single thread if a program requests more stack space
but the frame pointer would exceed the stack segment then the result would
be a stack overflow. However, in Go a new stack would be created on the
heap to prevent this from happening. If you continually straddle this
boundary between the heap allocated stack and the "true" system allocated
stack, it would be called stack splitting?
I have read http://golang.org/doc/faq#goroutines but it's not clear
specifically what is meant by a segmented stack. Is a segmented stack
having one or more heap allocated stacks on top of the system allocated
stack or is it how goroutines have their own mini-stack segments?
I'm very (emphasis on VERY) new to assembly but my understanding is that
the stack pointer is an internal CPU register. When a stack overflow would
occur and the program responds by requesting more stack space from the
heap, must the stack pointer now be maintained by the Go program rather
than a CPU register? This would be an assembly based stack data structure
(linked list)? Or I am I way off base now?
--
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.
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-/JYPxA39Uh5TLH3MbocFF+G/***@public.gmane.org
For more options, visit https://groups.google.com/groups/opt_out.