并发编程规范:goroutine、channel 与 sync 的纪律
goroutine 的创建成本低:一个 go 语句即可启动,初始栈仅需几 KB。但创建成本低意味着终止必须显式设计——每个 goroutine 都是需要被负责回收的资源。多数并发故障并非源于高深特性,而是几类基础疏漏:goroutine 未定义退出机制、接收方关闭 channel、select 遗漏取消信号、WaitGroup.Add 的调用位置错误。
10 min read
Loading…
Quote of the day · October 26 · 关于意义 · Rick and Morty
Nobody exists on purpose. Nobody belongs anywhere. Everybody's gonna die. Come watch TV?
Notes on Agent runtimes — design decisions laid open: why it is this way, what it costs, and when it stops being true.