为什么Windows还在调整关键节?——旧闻新谈
Why is Windows still tinkering with critical sections? – The Old New Thing

原始链接: https://devblogs.microsoft.com/oldnewthing/20250924-00/?p=111624

最近,由于Windows 11 24H2更新,GTA圣安地列斯中一个20年前的bug再次出现,这表明即使像关键节(critical sections)这样成熟的系统组件也在不断改进——不一定是为了修复bug,而是为了*性能*。 虽然关键节本身可能很稳定,但优化仍在持续进行,以满足现代高度并发计算的需求。最近的更改侧重于减少内存使用(特别是非分页池,一种宝贵的资源)和缓解优先级反转。 24H2更新进一步优化了这些缓解措施,将工作从内核转移到用户模式,从而提高了效率。这表明,尽管关键节已经存在很长时间,但它们仍在积极演进,以处理日益增长的工作负载并维持当今复杂计算环境中系统的稳定性。微小的改进,乘以无数次操作,会产生重大影响。

相关文章

原文

Adrian aka Silent aka CookiePLMonster did a deep investigation into how a 20 year old bug in GTA San Andreas surfaced in Windows 11 24H2.

One reaction I saw to this was “Why is Windows still tinkering with critical sections? Surely there aren’t any bugs in it after all these years.”

While there may not be bugs in critical sections, there may still be performance issues. And since critical sections are so heavily used, small performance issues can add up to large ones.

We saw some time ago that many synchronization objects were made unfair to avoid lock convoys.

At around the same time, critical sections were optimized to reduce their memory footprint, particularly their cost to non-paged pool. Non-paged pool is an expensive resource since (as the name suggests) it cannot be paged out. On systems doing large-scale computing, even a small cost in non-paged pool is multiplied by a enormous number of critical sections, resulting in outsized non-paged pool pressure that creates performance and reliability problems.

More recently, changes were made to critical sections to try to detect and mitigate priority inversions, and (what is significant in 24H2) those mitigations were optimized further by moving more of the work into user mode and avoiding some cases that previously entailed kernel mode transitions.

The critical section may be an old dog, but it’s still learning new tricks in order to keep pace with a computing environment that is bigger, faster, and more concurrent that it was three decades ago.

联系我们 contact @ memedata.com