~/talk

Goroutines: the dark side of the runtime

Talkat GoLab 2018 · 2018-10-22..10-23· [go]
slides:none on file

Explains that goroutines run on a fixed number of OS threads via the M P G scheduler, shows a real example where a loop with a closure capturing loop variable prints ten identical values, and demonstrates a subtle live lock where a tight for loop with an outer byte counter prevents GC because goroutines are preemption only at safe points, causing endless garbage collection. Shows practical fixes: copy loop vars, introduce checkpoints (channel ops, go, noinline), and adopt context for cooperative cancellation, while noting the runtime cannot forcibly kill goroutines.

AI-written summary · about

  1. 0:00Intro
  2. 1:50Why Go
  3. 3:04Surprises
  4. 11:20MGP model
  5. 13:45Issues with goroutines
  6. 16:20The trick
  7. 20:12Debugging
  8. 23:11Stop a goroutine
  9. 24:45PHP
  10. 30:15QA
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.