随笔分类 -  golang / go源码

摘要:map 简介 golang的map主要是基于hash-bucket实现 demoMap:=make(int,len) type hmap struct { // Note: the format of the hmap is also encoded in cmd/compile/internal/ 阅读全文
posted @ 2023-11-10 12:12 我才不是老家伙 阅读(31) 评论(0) 推荐(0) 编辑
摘要:golang-epoll模型源码解析 epoll epoll is an io multipexing model in linux env. epoll generate epoll table. A new socket will be put into epoll table after bi 阅读全文
posted @ 2023-11-10 12:12 我才不是老家伙 阅读(21) 评论(0) 推荐(0) 编辑
摘要:mutex 排队规则 正常模式 一个g尝试获取锁失败后,会自旋一定次数,失败后加入队列(fifo) g1出队后要和自旋的g竞争,但大概率获取不到,因为自旋g处于运行状态,不需要上下文切换 g1竞争mutexh失败后会重新加入队列头 饥饿模式 进入条件:当一个g获取mutex 等待时间 > 1ms,m 阅读全文
posted @ 2023-09-08 11:47 我才不是老家伙 阅读(16) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示