Go theorytheory 0/50 · 0%
Concurrency · medium

21. Goroutines

Cheap concurrent functions.

`go f()` starts a goroutine — a lightweight thread multiplexed onto OS threads by the runtime, starting at a few kilobytes of stack. Millions can exist, but nothing waits for them: a program exits when main returns, so lifecycles must be managed explicitly.

Check your understanding

  1. 1. When does a Go program exit?

  2. 2. Goroutine stacks start…