~/talk

Go Channels Internals

Talkat GoWayFest 3.0 2019 · on Friday, 2019-07-05· [go, compilers-and-language-design]
links:none on file
slides:none on file

Walks the Go source to show exactly how channels work: three core structs — hchan with buffer, send/recv indices, mutex , pseudo-G and a waitQ linked list of blocked goroutines, plus the runtime send/receive paths. Demonstrates debug flags, the special-case of zero-sized empty structs, and why closed or new channels block or panic. Calls out the surprising detail that a send can write directly into another goroutine’s stack, and shows which runtime checks and queues make select, GC and scheduling interact with channels.

AI-written summary · about

  1. 0:00Introduction to channels
  2. 1:23Channel basics and examples
  3. 3:23Channel characteristics
  4. 4:32Theoretical background (CSP)
  5. 5:53Internal channel structs
  6. 8:05Data structures and locking
  7. 10:48Memory allocation of channels
  8. 11:43Detailed analysis of hchan
  9. 15:52Wait queues and goroutines
  10. 17:28Wait queue example
  11. 20:09Source code demo
  12. 22:52Sending and receiving data
  13. 26:16Closing and edge cases
  14. 28:25The select statement
  15. 28:59Advanced channel usage
  16. 30:28Conclusion and resources
  17. 31:27Q&A
~/search
type to search 8,222 conferences, 162,397 speakers and 219,688 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
← →
on a talk: 5 seconds back / forward
0–9
on a talk: jump to 0%–90% of the recording
?
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.