原理剖析
数据结构
字符串 String # String 底层是 stringStruct
type stringStruct { str unsafe.point len int } String 与 []byte 的转换,会发生一次值拷贝
GMP
参考:https://learnku.com/articles/41728
Go 调度本质是把大量的 goroutine 分配到少量线程上去执行,并利用多核并行,实现更强大的并发。
Go 线程模型 # GMP 模型 # 线程是运行 goroutine 的实体,调度器的功能是把可运行的 goroutine 分配到工作线程上。