O'Reilly logo

Distributed Computing with Go by V.N. Nikhil Anurag

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Goroutine

It is the logical unit of execution that contains the actual instructions for our program/functions to run. It also contains other important information regarding the goroutine, such as the stack memory, which machine (M) it is running on, and which Go function called it. The following are some of the elements in the goroutine struct that might come in handy for this section:

// Denoted as G in runtime type g struct { stack stack // offset known to runtime/cgo m *m // current m; offset known to arm liblink goid int64 waitsince int64 // approx time when the g become blocked waitreason string // if status==Gwaiting gopc uintptr // pc of go statement that created this goroutine startpc uintptr // pc of goroutine function timer *timer ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required