On Fri, Nov 17, 2017 at 01:34:54PM +0100, Markus Armbruster wrote:
"Daniel P. Berrange" <berrange(a)redhat.com> writes:
[...]
> Goroutines are basically a union of the thread + coroutine concepts. The
> Go runtime will create N OS level threads, where the default N currently
> matches the number of logical CPU cores you host has (but is tunable to
> other values). The application code just always creates Goroutines which
> are userspace threads just like coroutines. The Go runtime will dynamically
> switch goroutines at key points, and automatically pick suitable OS level
> threads to run them on to maximize concurrency. Most cleverly goroutines
> have a 2 KB default stack size, and runtime will dynamically grow the
> stack if that limit is reached.
Does this work even when the stack limit is exceeded in a C function?
When you make a C call in go, it runs in a separate stack. The goroutines
own stack is managed by the garbage collector, so can't be exposed to C
code. I'm unclear exactly what size the C stack would be, but it'll be
the traditional fixed size, not the grow-on-demand behaviour of the Go
stack.
Regards,
Daniel
--
|:
https://berrange.com -o-
https://www.flickr.com/photos/dberrange :|
|:
https://libvirt.org -o-
https://fstop138.berrange.com :|
|:
https://entangle-photo.org -o-
https://www.instagram.com/dberrange :|