TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Understanding the Go Scheduler

179 点作者 gnabgib7 天前

6 条评论

__turbobrew__4 天前
Make sure you set GOMAXPROCS when the runtime is cgroup limited.<p>I once profiled a slow go program running on a node with 168 cores, but cpu.max was 2 cores for the cgroup. The runtime defaults to set GOMAXPROCS to the number of visible cores which was 168 in this case. Over half the runtime was the scheduler bouncing goroutines between 168 processes despite cpu.max being 2 CPU.<p>The JRE is smart enough to figure out if it is running in a resource limited cgroup and make sane decisions based upon that, but golang has no such thing.
评论 #44055856 未加载
评论 #44058136 未加载
评论 #44056125 未加载
jasonthorsness4 天前
It&#x27;s always a sign of good design when something as complex as the scheduler described &quot;just works&quot; with the simple abstraction of the goroutine. What a great article.<p>&quot;1&#x2F;61 of the time, check the global run queue.&quot; Stuff like this is a little odd; I would have thought this would be a variable dependent on the number of physical cores.
评论 #44058144 未加载
kortex4 天前
Fantastic writeup! Visualizations are great, the writeup is thorough but readable.
weiwenhao3 天前
Your write-up is so detailed that I even feel like I could implement a complete golang scheduler myself
davidw3 天前
I&#x27;d be interested in seeing a comparison of this and the BEAM&#x2F;Erlang&#x2F;Elixir scheduler by someone paying attention to the details.
90s_dev4 天前
I heard that the scheduler is a huge obstacle to many potential optimizations, is that true?
评论 #44055453 未加载